diff --git a/packages/examples/sdk-frontend-react/src/app/components/Connect.tsx b/packages/examples/sdk-frontend-react/src/app/components/Connect.tsx index bb86a0764..72c56fafb 100644 --- a/packages/examples/sdk-frontend-react/src/app/components/Connect.tsx +++ b/packages/examples/sdk-frontend-react/src/app/components/Connect.tsx @@ -17,7 +17,7 @@ const NETWORK_MAPPING: NwMappingType = { 97: 'BSC_TESTNET', 11155420: 'OPTIMISM_TESTNET', 10: 'OPTIMISM_MAINNET', - 1442: 'POLYGON_ZK_EVM_TESTNET', + 2442: 'POLYGON_ZK_EVM_TESTNET', 1101: 'POLYGON_ZK_EVM_MAINNET', 421614: 'ARBITRUM_TESTNET', 42161: 'ARBITRUMONE_MAINNET', @@ -28,7 +28,7 @@ const NETWORK_MAPPING: NwMappingType = { const injected = new InjectedConnector({ supportedChainIds: [ - 1, 3, 4, 11155111, 42, 137, 80002, 56, 97, 10, 11155420, 1442, 1101, 421614, + 1, 3, 4, 11155111, 42, 137, 80002, 56, 97, 10, 11155420, 2442, 1101, 421614, 42161, 122, 123, 80085, ], }); diff --git a/packages/examples/sdk-frontend-react/src/app/helpers.ts b/packages/examples/sdk-frontend-react/src/app/helpers.ts index f7a467193..afb608532 100644 --- a/packages/examples/sdk-frontend-react/src/app/helpers.ts +++ b/packages/examples/sdk-frontend-react/src/app/helpers.ts @@ -19,7 +19,7 @@ const Constants = { DEFAULT_CHAIN_ID: 11155111, DEV_CHAIN_ID: 99999, NON_ETH_CHAINS: [ - 137, 80002, 56, 97, 10, 11155420, 1442, 1101, 421614, 42161, 122, 123, + 137, 80002, 56, 97, 10, 11155420, 2442, 1101, 421614, 42161, 122, 123, 80085, ], ETH_CHAINS: [1, 11155111], diff --git a/packages/restapi/CHANGELOG.md b/packages/restapi/CHANGELOG.md index aac21ddce..b63ac582d 100644 --- a/packages/restapi/CHANGELOG.md +++ b/packages/restapi/CHANGELOG.md @@ -2,6 +2,29 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [0.0.1-alpha.86](https://github.com/push-protocol/push-sdk/compare/restapi-0.0.1-alpha.85...restapi-0.0.1-alpha.86) (2024-04-23) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([46dcbc3](https://github.com/push-protocol/push-sdk/commit/46dcbc38358c7fd2ec59df4280e7c5969ce2bfb8)) + + +### Features + +* Add Polygon zkEvm Cardona support ([#1243](https://github.com/push-protocol/push-sdk/issues/1243)) ([70f63b1](https://github.com/push-protocol/push-sdk/commit/70f63b1d80d1f3f77a33266c91335c2807bf18b9)), closes [#1237](https://github.com/push-protocol/push-sdk/issues/1237) [#952](https://github.com/push-protocol/push-sdk/issues/952) [#930](https://github.com/push-protocol/push-sdk/issues/930) + + + +## [0.0.1-alpha.85](https://github.com/push-protocol/push-sdk/compare/restapi-0.0.1-alpha.84...restapi-0.0.1-alpha.85) (2024-04-18) + + +### Bug Fixes + +* error meta fix ([5b7c30a](https://github.com/push-protocol/push-sdk/commit/5b7c30ad43d08ab683c80d3a4407b58a4e6abf74)) + + + ## [0.0.1-alpha.84](https://github.com/push-protocol/push-sdk/compare/restapi-1.7.8...restapi-0.0.1-alpha.84) (2024-04-17) diff --git a/packages/restapi/package.json b/packages/restapi/package.json index e79ab46b3..eb3fad6a2 100644 --- a/packages/restapi/package.json +++ b/packages/restapi/package.json @@ -1,6 +1,6 @@ { "name": "@pushprotocol/restapi", - "version": "0.0.1-alpha.84", + "version": "0.0.1-alpha.86", "type": "commonjs", "publishConfig": { "registry": "https://registry.npmjs.org/" diff --git a/packages/restapi/src/lib/config.ts b/packages/restapi/src/lib/config.ts index c70c38087..6afd11afc 100644 --- a/packages/restapi/src/lib/config.ts +++ b/packages/restapi/src/lib/config.ts @@ -10,7 +10,6 @@ import { optimism, optimismSepolia, polygonZkEvm, - polygonZkEvmTestnet, sepolia, arbitrum, arbitrumSepolia, @@ -19,6 +18,28 @@ import { } from 'viem/chains'; import { defineChain } from 'viem'; +const polygonZkEvmCordona = defineChain({ + id: 2442, + name: 'Polygon zkEVM Cardona Testnet', + network: 'polygon-zkevm-testnet', + nativeCurrency: { + decimals: 18, + name: 'ETH', + symbol: 'ETH', + }, + rpcUrls: { + default: { http: ['https://rpc.cardona.zkevm-rpc.com/'] }, + public: { http: ['https://rpc.cardona.zkevm-rpc.com/'] }, + }, + blockExplorers: { + default: { + name: 'Polygon zkEVM Cardona', + url: ' https://cardona-zkevm.polygonscan.com/', + }, + }, + testnet: true, +}) + const polygonAmoy = defineChain({ id: 80002, name: 'Polygon Amoy Testnet', @@ -86,7 +107,7 @@ const BLOCKCHAIN_NETWORK = { BSC_TESTNET: 'eip155:97', OPTIMISM_TESTNET: 'eip155:11155420', OPTIMISM_MAINNET: 'eip155:10', - POLYGON_ZK_EVM_TESTNET: 'eip155:1442', + POLYGON_ZK_EVM_TESTNET: 'eip155:2442', POLYGON_ZK_EVM_MAINNET: 'eip155:1101', ARBITRUM_TESTNET: 'eip155:421614', ARBITRUMONE_MAINNET: 'eip155:42161', @@ -133,9 +154,9 @@ export const ALIAS_CHAIN_ID: { }, POLYGONZKEVM: { [ENV.PROD]: 1101, - [ENV.STAGING]: 1442, - [ENV.DEV]: 1442, - [ENV.LOCAL]: 1442, + [ENV.STAGING]: 2442, + [ENV.DEV]: 2442, + [ENV.LOCAL]: 2442, }, ARBITRUMONE: { [ENV.PROD]: 42161, @@ -177,7 +198,7 @@ export const CHAIN_NAME: { [key: number]: string } = { 11155420: 'OPTIMISM', // plygonzkevm 1101: 'POLYGONZKEVM', - 1442: 'POLYGONZKEVM', + 2442: 'POLYGONZKEVM', // arbitrun 421614: 'ARBITRUN', 42161: 'ARBITRUM', @@ -284,7 +305,7 @@ const CONFIG = { }, [BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: { API_BASE_URL: API_BASE_URL[ENV.STAGING], - EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + EPNS_COMMUNICATOR_CONTRACT: '0x6e489b7af21ceb969f49a90e481274966ce9d74d', }, [BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: { API_BASE_URL: API_BASE_URL[ENV.STAGING], @@ -318,7 +339,7 @@ const CONFIG = { }, [BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: { API_BASE_URL: API_BASE_URL[ENV.DEV], - EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572', + EPNS_COMMUNICATOR_CONTRACT: '0x9cb3bd7550b5c92baa056fc0f08132f49508145f', }, [BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: { API_BASE_URL: API_BASE_URL[ENV.DEV], @@ -352,7 +373,7 @@ const CONFIG = { }, [BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: { API_BASE_URL: API_BASE_URL[ENV.LOCAL], - EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572', + EPNS_COMMUNICATOR_CONTRACT: '0x9cb3bd7550b5c92baa056fc0f08132f49508145f', }, [BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: { API_BASE_URL: API_BASE_URL[ENV.LOCAL], @@ -461,9 +482,9 @@ export const VIEM_CONFIG = { EPNS_COMMUNICATOR_CONTRACT: '0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A', }, [BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: { - NETWORK: polygonZkEvmTestnet, + NETWORK: polygonZkEvmCordona, API_BASE_URL: API_BASE_URL[ENV.STAGING], - EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + EPNS_COMMUNICATOR_CONTRACT: '0x6e489b7af21ceb969f49a90e481274966ce9d74d', }, [BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: { NETWORK: arbitrumSepolia, @@ -503,9 +524,9 @@ export const VIEM_CONFIG = { EPNS_COMMUNICATOR_CONTRACT: '0x754787358fac861ef904c92d54f7adb659779317', }, [BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: { - NETWORK: polygonZkEvmTestnet, + NETWORK: polygonZkEvmCordona, API_BASE_URL: API_BASE_URL[ENV.DEV], - EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572', + EPNS_COMMUNICATOR_CONTRACT: '0x9cb3bd7550b5c92baa056fc0f08132f49508145f', }, [BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: { NETWORK: arbitrumSepolia, @@ -545,9 +566,9 @@ export const VIEM_CONFIG = { EPNS_COMMUNICATOR_CONTRACT: '0x754787358fac861ef904c92d54f7adb659779317', }, [BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: { - NETWORK: polygonZkEvmTestnet, + NETWORK: polygonZkEvmCordona, API_BASE_URL: API_BASE_URL[ENV.DEV], - EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572', + EPNS_COMMUNICATOR_CONTRACT: '0x9cb3bd7550b5c92baa056fc0f08132f49508145f', }, [BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: { NETWORK: arbitrumSepolia, diff --git a/packages/restapi/src/lib/constants.ts b/packages/restapi/src/lib/constants.ts index e31535276..7750adc22 100644 --- a/packages/restapi/src/lib/constants.ts +++ b/packages/restapi/src/lib/constants.ts @@ -66,7 +66,7 @@ const Constants = { DEFAULT_CHAIN_ID: 11155111, DEV_CHAIN_ID: 99999, NON_ETH_CHAINS: [ - 137, 80002, 56, 97, 10, 11155420, 1442, 1101, 421614, 42161, 122, 123, + 137, 80002, 56, 97, 10, 11155420, 2442, 1101, 421614, 42161, 122, 123, 80085, ], ETH_CHAINS: [1, 11155111], diff --git a/packages/restapi/src/lib/payloads/constants.ts b/packages/restapi/src/lib/payloads/constants.ts index 4dc57268d..7fde41a26 100644 --- a/packages/restapi/src/lib/payloads/constants.ts +++ b/packages/restapi/src/lib/payloads/constants.ts @@ -11,7 +11,7 @@ export const CHAIN_ID_TO_SOURCE: ChainIdToSourceType = { 97: 'BSC_TESTNET', 10: 'OPTIMISM_MAINNET', 11155420: 'OPTIMISM_TESTNET', - 1442: 'POLYGON_ZK_EVM_TESTNET', + 2442: 'POLYGON_ZK_EVM_TESTNET', 1101: 'POLYGON_ZK_EVM_MAINNET', 421614: "ARBITRUM_TESTNET", 42161: "ARBITRUMONE_MAINNET", diff --git a/packages/restapi/src/lib/payloads/helpers.ts b/packages/restapi/src/lib/payloads/helpers.ts index de1be2071..29adee31e 100644 --- a/packages/restapi/src/lib/payloads/helpers.ts +++ b/packages/restapi/src/lib/payloads/helpers.ts @@ -329,7 +329,7 @@ export function getCAIPFormat(chainId: number, address: string) { // EVM based chains if ( [ - 1, 11155111, 42, 137, 80002, 56, 97, 10, 11155420, 1442, 1101, 421614, + 1, 11155111, 42, 137, 80002, 56, 97, 10, 11155420, 2442, 1101, 421614, 42161, 122, 123, 80085, ].includes(chainId) ) { diff --git a/packages/restapi/tests/.env.sample b/packages/restapi/tests/.env.sample index fbfbf384a..127ce1739 100644 --- a/packages/restapi/tests/.env.sample +++ b/packages/restapi/tests/.env.sample @@ -8,6 +8,7 @@ BERACHAIN_CHANNEL_PRIVATE_KEY=your_berachain_channel_private_key ARBITRUM_CHANNEL_PRIVATE_KEY=your_arbitrum_channel_private_key OPTIMISM_CHANNEL_PRIVATE_KEY=your_optimism_channel_private_key POLYGON_CHANNEL_PRIVATE_KEY=your_polygon_channel_private_key +POLYGON_ZKEVM_CHANNEL_PRIVATE_KEY=your_polygon_zkevm_channel_private_key WALLET_PRIVATE_KEY=your_wallet_private_key WALLET_PRIVATE_KEY_2=your_wallet_private_key_2 diff --git a/packages/restapi/tests/lib/alias/polygonZkevm.test.ts b/packages/restapi/tests/lib/alias/polygonZkevm.test.ts new file mode 100644 index 000000000..bc56975fe --- /dev/null +++ b/packages/restapi/tests/lib/alias/polygonZkevm.test.ts @@ -0,0 +1,85 @@ +import { ethers } from 'ethers'; +import { PushAPI } from '../../../src'; +import { ENV } from '../../../src/lib/constants'; + +describe('POLYGON ZKEVM ALIAS functionality', () => { + let userAlice: PushAPI; + let userBob: PushAPI; + let account: string; + let account2: string; + + // accessing env dynamically using process.env + type EnvStrings = keyof typeof ENV; + const envMode = process.env.ENV as EnvStrings; + const _env = ENV[envMode]; + + before(async () => { + const provider = new ethers.providers.JsonRpcProvider( + 'https://rpc.cardona.zkevm-rpc.com/' + ); + const signer = new ethers.Wallet( + `0x${process.env['POLYGON_ZKEVM_CHANNEL_PRIVATE_KEY']}`, + provider + ); + account = signer.address; + userAlice = await PushAPI.initialize(signer, { + env: _env, + }); + + const signer2 = new ethers.Wallet(ethers.Wallet.createRandom().privateKey); + account2 = signer2.address; + userBob = await PushAPI.initialize(signer2, { env: _env }); + }); + + it.skip('Should be able to create channel', async () => { + const res = await userAlice.channel.create({ + name: 'SDK Alias Test', + description: 'Testing using sdk', + url: 'https://push.org', + icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAz0lEQVR4AcXBsU0EQQyG0e+saWJ7oACiKYDMEZVs6GgSpC2BIhzRwAS0sgk9HKn3gpFOAv3v3V4/3+4U4Z1q5KTy42Ql940qvFONnFSGmCFmiN2+fj7uCBlihpgh1ngwcvKfwjuVIWaIGWKNB+GdauSk8uNkJfeNKryzYogZYoZY40m5b/wlQ8wQM8TayMlKeKcaOVkJ71QjJyuGmCFmiDUe+HFy4VyEd57hx0mV+0ZliBlihlgL71w4FyMnVXhnZeSkiu93qheuDDFDzBD7BcCyMAOfy204AAAAAElFTkSuQmCC', + alias: `eip155:2442:${account}`, + progressHook: (progress: any) => console.log(progress), + }); + console.log(res); + }); + + it('Should be able to send notifications', async () => { + await userAlice.channel.send(['*'], { + notification: { + title: 'hi', + body: 'test-broadcast', + }, + payload: { + title: 'testing broadcast notification', + body: 'testing with random body', + cta: 'https://google.com/', + embed: 'https://avatars.githubusercontent.com/u/64157541?s=200&v=4', + }, + channel: `eip155:2442:${account}`, + }); + }); + + it('Should be able to add delegatee', async () => { + await userAlice.channel.delegate.add(account2); + }); + + it('Should be able to send notifications from delegate', async () => { + await userBob.channel.send(['*'], { + notification: { + title: 'hi', + body: 'test-broadcast', + }, + payload: { + title: 'testing broadcast notification', + body: 'testing with random body', + cta: 'https://google.com/', + embed: 'https://avatars.githubusercontent.com/u/64157541?s=200&v=4', + }, + channel: `eip155:2442:${account}`, + }); + }); + + it('Should be able to remove delegatee', async () => { + await userAlice.channel.delegate.remove(account2); + }); +}); diff --git a/packages/uiweb/CHANGELOG.md b/packages/uiweb/CHANGELOG.md index a5a799e42..c4b9b2a98 100644 --- a/packages/uiweb/CHANGELOG.md +++ b/packages/uiweb/CHANGELOG.md @@ -2,6 +2,28 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [0.0.1-alpha.46](https://github.com/push-protocol/push-sdk/compare/uiweb-1.2.7...uiweb-0.0.1-alpha.46) (2024-04-23) + + +### Bug Fixes + +* add doman in user profile and chat profile and copy ([#1171](https://github.com/push-protocol/push-sdk/issues/1171)) ([e981565](https://github.com/push-protocol/push-sdk/commit/e9815656f76f99d841e0895ec4fc283abd04db16)) +* added settings name ([#1168](https://github.com/push-protocol/push-sdk/issues/1168)) ([62620ae](https://github.com/push-protocol/push-sdk/commit/62620ae7bc75f966b72f3058a8b4a08f40d6aa14)) +* fixed user giving undefined for info ([#1194](https://github.com/push-protocol/push-sdk/issues/1194)) ([5e6dcc5](https://github.com/push-protocol/push-sdk/commit/5e6dcc5554a720f08e9dbfee77e5fe44933b4c67)) +* horizontal scroll ([#1156](https://github.com/push-protocol/push-sdk/issues/1156)) ([8fb3301](https://github.com/push-protocol/push-sdk/commit/8fb3301146469df60eb32bef5703e3acb474101d)) +* Merge branch 'main' into alpha ([53a795d](https://github.com/push-protocol/push-sdk/commit/53a795db5ec82d44597410dca670dfadd9199277)) +* **migrate goerli to sepolia:** migrate goerli to sepolia ([#1149](https://github.com/push-protocol/push-sdk/issues/1149)) ([490b104](https://github.com/push-protocol/push-sdk/commit/490b104902b9a509c6a8c68d5c5f33446e91e113)) +* pulled main ([b7391b6](https://github.com/push-protocol/push-sdk/commit/b7391b6318b40117d61b86ea8163b116f757c94a)) +* support chat scroll ([#1184](https://github.com/push-protocol/push-sdk/issues/1184)) ([85cf829](https://github.com/push-protocol/push-sdk/commit/85cf829c44411cc8140c628a83c2f4900be77f28)) + + +### Features + +* Add Polygon zkEvm Cardona support ([#1243](https://github.com/push-protocol/push-sdk/issues/1243)) ([70f63b1](https://github.com/push-protocol/push-sdk/commit/70f63b1d80d1f3f77a33266c91335c2807bf18b9)), closes [#1237](https://github.com/push-protocol/push-sdk/issues/1237) [#952](https://github.com/push-protocol/push-sdk/issues/952) [#930](https://github.com/push-protocol/push-sdk/issues/930) +* **uiweb:** return response in createGroupModal ([#1198](https://github.com/push-protocol/push-sdk/issues/1198)) ([241080d](https://github.com/push-protocol/push-sdk/commit/241080dc703dd90797262f4852e25aab60db5a93)) + + + ## [1.1.15](https://github.com/push-protocol/push-sdk/compare/uiweb-0.0.1-alpha.44...uiweb-1.1.15) (2024-03-27) diff --git a/packages/uiweb/package.json b/packages/uiweb/package.json index e7d2c5a62..a3639a92f 100644 --- a/packages/uiweb/package.json +++ b/packages/uiweb/package.json @@ -1,6 +1,6 @@ { "name": "@pushprotocol/uiweb", - "version": "1.1.15", + "version": "0.0.1-alpha.46", "publishConfig": { "registry": "https://registry.npmjs.org/" }, diff --git a/packages/uiweb/src/lib/config/constants.ts b/packages/uiweb/src/lib/config/constants.ts index 6084e97a5..e96ad6f56 100644 --- a/packages/uiweb/src/lib/config/constants.ts +++ b/packages/uiweb/src/lib/config/constants.ts @@ -56,7 +56,7 @@ const TESTNET_NETWORK = { POLYGON: 'eip155:80002', BSC: 'eip155:97', OPTIMISM: 'eip155:11155420', - POLYGON_ZK_EVM: 'eip155:1442', + POLYGON_ZK_EVM: 'eip155:2442', ARBITRUM: 'eip155:421614', FUSE: 'eip155:123', BERACHAIN: 'eip155:80085', @@ -95,6 +95,7 @@ export const allowedNetworks = { 421614, // for arbitrum testnet 123, // for fuse testnet 80085, // for berachain testnet + 2442 // polygon zkevm ], staging: [ // 42, //for kovan @@ -105,6 +106,7 @@ export const allowedNetworks = { 421614, // for arbitrum testnet 123, // for fuse testnet 80085, // for berachain testnet + 2442 // polygon zkevm ], local: [ 11155111, // for eth sepolia @@ -114,6 +116,7 @@ export const allowedNetworks = { 421614, // for arbitrum testnet 123, // for fuse testnet 80085, // for berachain testnet + 2442 // polygon zkevm ], };