diff --git a/.github/workflows/tapir.yml b/.github/workflows/tapir.yml index f2d747e54..918f939bf 100644 --- a/.github/workflows/tapir.yml +++ b/.github/workflows/tapir.yml @@ -10,7 +10,7 @@ on: # TODO: Use variables when GH supports it for forks. See https://github.com/orgs/community/discussions/44322 env: - RPC_PROVIDER_URL: "https://polygon-mumbai-bor.publicnode.com" + RPC_PROVIDER_URL: "https://rpc-amoy.polygon.technology" ENCRYPTOR_PRIVATE_KEY: "0x900edb9e8214b2353f82aa195e915128f419a92cfb8bbc0f4784f10ef4112b86" CONSUMER_PRIVATE_KEY: "0xf307e165339cb5deb2b8ec59c31a5c0a957b8e8453ce7fe8a19d9a4c8acf36d4" RITUAL_ID: "0" diff --git a/demos/taco-demo/README.md b/demos/taco-demo/README.md index 356226297..982ed8036 100644 --- a/demos/taco-demo/README.md +++ b/demos/taco-demo/README.md @@ -27,7 +27,7 @@ production _just yet_. ### Lynx Testnet The current release of `@nucypher/taco` supports Ursulas working on Lynx (bleeding-edge) test -network and contracts deployed on Mumbai testnet. +network and contracts deployed on Polygon Amoy testnet. ## References diff --git a/demos/taco-demo/src/App.tsx b/demos/taco-demo/src/App.tsx index c2bf54e9b..118099df1 100644 --- a/demos/taco-demo/src/App.tsx +++ b/demos/taco-demo/src/App.tsx @@ -7,7 +7,7 @@ import { initialize, ThresholdMessageKit, } from '@nucypher/taco'; -import { Mumbai, useEthers } from '@usedapp/core'; +import { useEthers } from '@usedapp/core'; import { ethers } from 'ethers'; import React, { useEffect, useState } from 'react'; @@ -32,7 +32,7 @@ export default function App() { useEffect(() => { initialize(); - switchNetwork(Mumbai.chainId); + switchNetwork(80002); }, []); const encryptMessage = async (message: string) => { @@ -41,7 +41,7 @@ export default function App() { } setLoading(true); - await switchNetwork(Mumbai.chainId); + await switchNetwork(80002); const provider = new ethers.providers.Web3Provider(window.ethereum); const encryptedMessage = await encrypt( diff --git a/demos/taco-demo/src/ConditionBuilder.tsx b/demos/taco-demo/src/ConditionBuilder.tsx index e2c400545..1d14fa6cd 100644 --- a/demos/taco-demo/src/ConditionBuilder.tsx +++ b/demos/taco-demo/src/ConditionBuilder.tsx @@ -1,5 +1,5 @@ import { conditions } from '@nucypher/taco'; -import { Mumbai, useEthers } from '@usedapp/core'; +import { useEthers } from '@usedapp/core'; import React, { useState } from 'react'; interface Props { @@ -9,7 +9,7 @@ interface Props { } const rpcCondition = new conditions.base.rpc.RpcCondition({ - chain: Mumbai.chainId, + chain: 80002, method: 'eth_getBalance', parameters: [':userAddress'], returnValueTest: { diff --git a/demos/taco-demo/src/index.tsx b/demos/taco-demo/src/index.tsx index 2a85089c7..648c0b278 100644 --- a/demos/taco-demo/src/index.tsx +++ b/demos/taco-demo/src/index.tsx @@ -1,11 +1,11 @@ -import { Config, DAppProvider, Mumbai } from '@usedapp/core'; +import { Config, DAppProvider } from '@usedapp/core'; import React, { StrictMode } from 'react'; import * as ReactDOMClient from 'react-dom/client'; import App from './App'; const config: Config = { - networks: [Mumbai], + readOnlyChainId: 80002, }; const rootElement = document.getElementById('root'); diff --git a/demos/taco-nft-demo/README.md b/demos/taco-nft-demo/README.md index dd8fca4d1..1b594b3b6 100644 --- a/demos/taco-nft-demo/README.md +++ b/demos/taco-nft-demo/README.md @@ -27,7 +27,7 @@ production _just yet_. ### Lynx Testnet The current release of `@nucypher/taco` supports Ursulas working on Lynx (bleeding-edge) test -network and contracts deployed on Mumbai testnet. +network and contracts deployed on Polygon Amoy testnet. ## References diff --git a/demos/taco-nft-demo/src/App.tsx b/demos/taco-nft-demo/src/App.tsx index 2fb5d26e4..e27e1847f 100644 --- a/demos/taco-nft-demo/src/App.tsx +++ b/demos/taco-nft-demo/src/App.tsx @@ -7,7 +7,7 @@ import { initialize, ThresholdMessageKit, } from '@nucypher/taco'; -import { Mumbai, useEthers } from '@usedapp/core'; +import { useEthers } from '@usedapp/core'; import { ethers } from 'ethers'; import React, { useEffect, useState } from 'react'; @@ -40,7 +40,7 @@ export default function App() { } setLoading(true); - await switchNetwork(Mumbai.chainId); + await switchNetwork(80002); const provider = new ethers.providers.Web3Provider(window.ethereum); const encryptedMessage = await encrypt( diff --git a/demos/taco-nft-demo/src/index.tsx b/demos/taco-nft-demo/src/index.tsx index 2a85089c7..648c0b278 100644 --- a/demos/taco-nft-demo/src/index.tsx +++ b/demos/taco-nft-demo/src/index.tsx @@ -1,11 +1,11 @@ -import { Config, DAppProvider, Mumbai } from '@usedapp/core'; +import { Config, DAppProvider } from '@usedapp/core'; import React, { StrictMode } from 'react'; import * as ReactDOMClient from 'react-dom/client'; import App from './App'; const config: Config = { - networks: [Mumbai], + readOnlyChainId: 80002, }; const rootElement = document.getElementById('root'); diff --git a/examples/pre/nextjs/src/app/page.tsx b/examples/pre/nextjs/src/app/page.tsx index 772dfe070..431db626e 100644 --- a/examples/pre/nextjs/src/app/page.tsx +++ b/examples/pre/nextjs/src/app/page.tsx @@ -37,12 +37,12 @@ function App() { const provider = new ethers.providers.Web3Provider(window.ethereum, 'any'); const { chainId } = await provider.getNetwork(); - const mumbaiChainId = 80001; - if (chainId !== mumbaiChainId) { - // Switch to Polygon Mumbai testnet + const amoyChainId = 80002; + if (chainId !== amoyChainId) { + // Switch to Polygon Amoy testnet await window.ethereum.request({ method: 'wallet_switchEthereumChain', - params: [{ chainId: hexlify(mumbaiChainId) }], + params: [{ chainId: hexlify(amoyChainId) }], }); } diff --git a/examples/pre/nodejs/src/index.ts b/examples/pre/nodejs/src/index.ts index c684fdf10..2a629e373 100644 --- a/examples/pre/nodejs/src/index.ts +++ b/examples/pre/nodejs/src/index.ts @@ -51,10 +51,10 @@ const runExample = async () => { const provider = new ethers.providers.JsonRpcProvider(rpcProviderUrl); - // Make sure the provider is connected to Mumbai testnet + // Make sure the provider is connected to Polygon Amoy testnet const network = await provider.getNetwork(); - if (network.chainId !== 80001) { - console.error('Please connect to Mumbai testnet'); + if (network.chainId !== 80002) { + console.error('Please connect to Polygon Amoy testnet'); } const signer = new ethers.Wallet(privateKey); diff --git a/examples/pre/react/src/App.tsx b/examples/pre/react/src/App.tsx index 3bd6c2bc5..dbc9faeb6 100644 --- a/examples/pre/react/src/App.tsx +++ b/examples/pre/react/src/App.tsx @@ -33,12 +33,12 @@ function App() { const provider = new ethers.providers.Web3Provider(window.ethereum, 'any'); const { chainId } = await provider.getNetwork(); - const mumbaiChainId = 80001; - if (chainId !== mumbaiChainId) { - // Switch to Polygon Mumbai testnet + const amoyChainId = 80002; + if (chainId !== amoyChainId) { + // Switch to Polygon Amoy testnet await window.ethereum.request({ method: 'wallet_switchEthereumChain', - params: [{ chainId: hexlify(mumbaiChainId) }], + params: [{ chainId: hexlify(amoyChainId) }], }); } diff --git a/examples/pre/webpack-5/src/index.ts b/examples/pre/webpack-5/src/index.ts index eb555dc06..532b27b57 100644 --- a/examples/pre/webpack-5/src/index.ts +++ b/examples/pre/webpack-5/src/index.ts @@ -54,12 +54,12 @@ const runExample = async () => { await provider.send('eth_requestAccounts', []); const { chainId } = await provider.getNetwork(); - const mumbaiChainId = 80001; - if (chainId !== mumbaiChainId) { - // Switch to Polygon Mumbai testnet + const amoyChainId = 80002; + if (chainId !== amoyChainId) { + // Switch to Polygon Amoy testnet await window.ethereum!.request!({ method: 'wallet_switchEthereumChain', - params: [{ chainId: hexlify(mumbaiChainId) }], + params: [{ chainId: hexlify(amoyChainId) }], }); } diff --git a/examples/taco/nextjs/src/app/page.tsx b/examples/taco/nextjs/src/app/page.tsx index 7f2c9cc49..2fe2a84bf 100644 --- a/examples/taco/nextjs/src/app/page.tsx +++ b/examples/taco/nextjs/src/app/page.tsx @@ -36,12 +36,12 @@ function App() { const provider = new ethers.providers.Web3Provider(window.ethereum, 'any'); const { chainId } = await provider.getNetwork(); - const mumbaiChainId = 80001; - if (chainId !== mumbaiChainId) { - // Switch to Polygon Mumbai testnet + const amoyChainId = 80002; + if (chainId !== amoyChainId) { + // Switch to Polygon Amoy testnet await window.ethereum.request({ method: 'wallet_switchEthereumChain', - params: [{ chainId: hexlify(mumbaiChainId) }], + params: [{ chainId: hexlify(amoyChainId) }], }); } @@ -64,12 +64,14 @@ function App() { } const encryptMessage = async () => { - if(!provider) return; - setEncrypting(true) + if (!provider) { + return; + } + setEncrypting(true); try { const signer = provider.getSigner(); const hasPositiveBalance = new conditions.base.rpc.RpcCondition({ - chain: 80001, + chain: 80002, method: 'eth_getBalance', parameters: [':userAddress', 'latest'], returnValueTest: { diff --git a/examples/taco/nodejs/.env.example b/examples/taco/nodejs/.env.example index 377e44367..ef69135a5 100644 --- a/examples/taco/nodejs/.env.example +++ b/examples/taco/nodejs/.env.example @@ -1,6 +1,6 @@ -# URL for RPC blockchain provider. For TACo testnet you should use a Polygon Mumbai endpoint. -# Current default extracted from https://chainlist.org/chain/80001, but ideally, you'll use your own endpoint. -RPC_PROVIDER_URL=https://polygon-mumbai-bor.publicnode.com +# URL for RPC blockchain provider. For TACo testnet you should use a Polygon Amoy endpoint. +# Current default extracted from https://chainlist.org/chain/80002, but ideally, you'll use your own endpoint. +RPC_PROVIDER_URL=https://rpc-amoy.polygon.technology # Hex-encoded private keys for the Encryptor and the Consumer. # We provide here some defaults, but we encourage you to choose your own. ENCRYPTOR_PRIVATE_KEY=0x900edb9e8214b2353f82aa195e915128f419a92cfb8bbc0f4784f10ef4112b86 diff --git a/examples/taco/nodejs/README.md b/examples/taco/nodejs/README.md index a0a7578b8..bccebb083 100644 --- a/examples/taco/nodejs/README.md +++ b/examples/taco/nodejs/README.md @@ -6,7 +6,7 @@ This example shows how to use `@nucypher/taco` in Node.js. This script needs 3 environment variables, that you can set in the `.env` file: -* `RPC_PROVIDER_URL`: For TACo testnet you should use a Polygon Mumbai endpoint. +* `RPC_PROVIDER_URL`: For TACo testnet you should use a Polygon Amoy endpoint. * `ENCRYPTOR_PRIVATE_KEY` and `CONSUMER_PRIVATE_KEY`: Hex-encoded private keys for the Encryptor and the Consumer, respectively. diff --git a/examples/taco/nodejs/src/index.ts b/examples/taco/nodejs/src/index.ts index fefbd1340..42d453f1c 100644 --- a/examples/taco/nodejs/src/index.ts +++ b/examples/taco/nodejs/src/index.ts @@ -49,11 +49,8 @@ const encryptToBytes = async (messageString: string) => { const message = toBytes(messageString); console.log(format('Encrypting message ("%s") ...', messageString)); - // TODO: Remove after fixing #506 - const chain = domain === 'lynx' ? 80002 : 80001; - const hasPositiveBalance = new conditions.base.rpc.RpcCondition({ - chain, + chain: 80002, method: 'eth_getBalance', parameters: [':userAddress', 'latest'], returnValueTest: { @@ -97,10 +94,10 @@ const decryptFromBytes = async (encryptedBytes: Uint8Array) => { }; const runExample = async () => { - // Make sure the provider is connected to Mumbai testnet + // Make sure the provider is connected to Polygon Amoy testnet const network = await provider.getNetwork(); - if (network.chainId !== 80001) { - console.error('Please connect to Mumbai testnet'); + if (network.chainId !== 80002) { + console.error('Please connect to Polygon Amoy testnet'); } await initialize(); diff --git a/examples/taco/react/src/App.tsx b/examples/taco/react/src/App.tsx index 97f2155b1..6050685b5 100644 --- a/examples/taco/react/src/App.tsx +++ b/examples/taco/react/src/App.tsx @@ -33,12 +33,12 @@ function App() { const provider = new ethers.providers.Web3Provider(window.ethereum, 'any'); const { chainId } = await provider.getNetwork(); - const mumbaiChainId = 80001; - if (chainId !== mumbaiChainId) { - // Switch to Polygon Mumbai testnet + const amoyChainId = 80002; + if (chainId !== amoyChainId) { + // Switch to Polygon Amoy testnet await window.ethereum.request({ method: 'wallet_switchEthereumChain', - params: [{ chainId: hexlify(mumbaiChainId) }], + params: [{ chainId: hexlify(amoyChainId) }], }); } @@ -61,12 +61,14 @@ function App() { } const encryptMessage = async () => { - if(!provider) return; - setEncrypting(true) + if (!provider) { + return; + } + setEncrypting(true); try { const signer = provider.getSigner(); const hasPositiveBalance = new conditions.base.rpc.RpcCondition({ - chain: 80001, + chain: 80002, method: 'eth_getBalance', parameters: [':userAddress', 'latest'], returnValueTest: { @@ -91,9 +93,11 @@ function App() { } const decryptMessage = async () => { - if(!encryptedText || !provider) return + if (!encryptedText || !provider) { + return; + } try { - setDecrypting(true) + setDecrypting(true); const signer = provider.getSigner(); console.log('Decrypting message...'); diff --git a/examples/taco/webpack-5/src/index.ts b/examples/taco/webpack-5/src/index.ts index 86901c4d0..e7a80ebfa 100644 --- a/examples/taco/webpack-5/src/index.ts +++ b/examples/taco/webpack-5/src/index.ts @@ -25,12 +25,12 @@ const runExample = async () => { const signer = provider.getSigner(); const { chainId } = await provider.getNetwork(); - const mumbaiChainId = 80001; - if (chainId !== mumbaiChainId) { - // Switch to Polygon Mumbai testnet + const amoyChainId = 80002; + if (chainId !== amoyChainId) { + // Switch to Polygon Amoy testnet await window.ethereum!.request!({ method: 'wallet_switchEthereumChain', - params: [{ chainId: hexlify(mumbaiChainId) }], + params: [{ chainId: hexlify(amoyChainId) }], }); } console.log("Signer's address:", await signer.getAddress()); @@ -38,7 +38,7 @@ const runExample = async () => { console.log('Encrypting message...'); const message = toBytes('this is a secret'); const hasPositiveBalance = new conditions.base.rpc.RpcCondition({ - chain: 80001, + chain: 80002, method: 'eth_getBalance', parameters: [':userAddress', 'latest'], returnValueTest: { diff --git a/packages/shared/package.json b/packages/shared/package.json index a4ff18ddd..87de6029e 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -42,7 +42,7 @@ "dependencies": { "@ethersproject/abi": "^5.7.0", "@ethersproject/providers": "^5.7.2", - "@nucypher/nucypher-contracts": "^0.21.0", + "@nucypher/nucypher-contracts": "^0.22.0", "@nucypher/nucypher-core": "*", "axios": "^1.6.8", "deep-equal": "^2.2.3", diff --git a/packages/shared/src/web3.ts b/packages/shared/src/web3.ts index 82c53791d..97655c765 100644 --- a/packages/shared/src/web3.ts +++ b/packages/shared/src/web3.ts @@ -2,7 +2,6 @@ import { fromHexString } from './utils'; export enum ChainId { POLYGON = 137, - MUMBAI = 80001, // TODO(#506): Deprecate MUMBAI AMOY = 80002, SEPOLIA = 11155111, ETHEREUM_MAINNET = 1, diff --git a/packages/taco/src/conditions/const.ts b/packages/taco/src/conditions/const.ts index 4323cb80c..45e0124f1 100644 --- a/packages/taco/src/conditions/const.ts +++ b/packages/taco/src/conditions/const.ts @@ -11,7 +11,6 @@ export const CONTEXT_PARAM_PREFIX = ':'; export const SUPPORTED_CHAIN_IDS = [ ChainId.POLYGON, - ChainId.MUMBAI, // TODO(#506): Deprecate MUMBAI ChainId.AMOY, ChainId.SEPOLIA, ChainId.ETHEREUM_MAINNET, diff --git a/packages/taco/test/conditions/base/condition.test.ts b/packages/taco/test/conditions/base/condition.test.ts index f725e9b5f..75b2d7acc 100644 --- a/packages/taco/test/conditions/base/condition.test.ts +++ b/packages/taco/test/conditions/base/condition.test.ts @@ -42,7 +42,6 @@ describe('validation', () => { chain: { _errors: [ 'Invalid literal value, expected 137', - 'Invalid literal value, expected 80001', // TODO(#506): Deprecate MUMBAI 'Invalid literal value, expected 80002', 'Invalid literal value, expected 11155111', 'Invalid literal value, expected 1', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5abdebb61..9da913ff6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -480,8 +480,8 @@ importers: specifier: ^5.7.2 version: 5.7.2 '@nucypher/nucypher-contracts': - specifier: ^0.21.0 - version: 0.21.0 + specifier: ^0.22.0 + version: 0.22.0 '@nucypher/nucypher-core': specifier: ^0.14.1 version: 0.14.1 @@ -3600,8 +3600,8 @@ packages: '@nodelib/fs.scandir': 2.1.5 fastq: 1.16.0 - /@nucypher/nucypher-contracts@0.21.0: - resolution: {integrity: sha512-2ArdoHKNtPGJiTxhxlhhPrtg0YXPL/rbUy6EvtXVgw4Zwy4iJUw3n5calHcIzijyf4KZLc8wBdsGrCOpX5uC1A==} + /@nucypher/nucypher-contracts@0.22.0: + resolution: {integrity: sha512-poWxFBi2qL5KnPZYsqr4AWn/O26Z2Q6X9EoARjQZIZdcEqYvE6iMHHgiw/RKL036u1jh1/rzo44eZRCt6ErMpA==} dev: false /@nucypher/nucypher-core@0.14.1: