Discussions
Dark theme will be added?
Dark theme will be added?
Posted by Foo Barqwqw about 4 hours ago
TypeError: Cannot read properties of undefined (reading 'AlchemyProvider')
Hi, I just want to get the latest block number . I followed the docs, but getting the error
```
const provider = new ethers.providers.AlchemyProvider(
^
TypeError: Cannot read properties of undefined (reading 'AlchemyProvider')
at Object.<anonymous> (D:\BlockChain\Ether JS\readBlockchain.js:5:39)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
```
Here is my code :
```javascript
const { ethers } = require("ethers");
const network = "mainnet";
const demo = api_key;
const provider = new ethers.providers.AlchemyProvider(
network,
demo
);
const querryBlockchain = async () => {
const blockNumber = await provider.getBlockNumber();
console.log(blockNumber);
};
querryBlockchain();
```
Posted by Asir Shahriar Roudra 1 day ago
How can I update/change the email in my Alchemy account?
Often times you might want to update or change the email associated with your Alchemy account. Below are instructions on how to do that
Posted by Elan 2 days ago
websocket stop listening until a new transaction coming
Hi everyone! i have some question about websocket.
I'm using alchemy.ws.on function with filter to listen events on smart contract. It is working well, but at some point the websocket is hang and stop listening to events. But once there is new transaction it's starting to work again. We need the websocket to keep alive.
Is there any way how to solve this issue?
Thanks!
Posted by cod3x.eth 5 days ago
Bundle.js
I am unable to create bundle.js file in my VS Code
Posted by Rituraj 6 days ago
issue in getting the ERC721 token updated metadata
Hi,
I have create a function in the smart contract where we can update the URI of exising minted NFT. but whenever i try to fetch the URI from alchemy API, It is giving me the OLD URI only. But at the same time, using the smart contract functionality of getting token URI, it returns the update one but taking a little more time to return that URI.
Please suggest if there is any option from alchemy APIs to get the update URI.
Network- Polygon
Posted by Shubham Jaiswal 6 days ago
The OPTIMISM network reports an error using the sendTransaction method
This is my code. It's not working.
import { Request, Response } from 'express';
import { Network, Alchemy, Wallet, Utils } from "alchemy-sdk";
const PRIVATE_KEY = "xxxxxx"; //hide
const API_KEY = "xxxx"; //hide
const settings = {
apiKey: API_KEY,
network: Network.OPT_MAINNET,
};
const alchemy = new Alchemy(settings);
let wallet = new Wallet(PRIVATE_KEY);
async function sendTx(req:Request,res:Response): Promise<any> {
try {
const transaction = {
to: "0xe301Caf612F870E3E8E8d60C98877e0E234733fa",
value: Utils.parseEther("0.001"),
gasLimit: "21000",
maxPriorityFeePerGas: Utils.parseUnits("5", "gwei"),
maxFeePerGas: Utils.parseUnits("20", "gwei"),
nonce: await alchemy.core.getTransactionCount(wallet.getAddress()),
type: 2,
chainId: 10, // Corresponds to OPT_MAINNET
};
const rawTransaction = await wallet.signTransaction(transaction);
const tx = await alchemy.transact.sendTransaction(rawTransaction);
res.send(tx);
} catch (error:any) {
res.send(error.message);
}
}
export {
sendTx,
}
----------------
I checked PRIVATE_KEY and API_KEY were fine.
On the ETH main network, sendTransaction works normally, but an error is displayed on the OPTIMISM network.
This is an error message
"message":"processing response error (body = \ "{\ \ \" jsonrpc \ \ \ ": \ \ \" 2.0 \ \ \ ", \ \ \ "id \ \ \" : 44, \ \ \ "the error \ \ \" : {\ \ \ "code \ \ \" : - 32000, \ \ \ "the message \ \ \" : \ \ \ "RLP: expected input list for types.txdata\\\"}}\", error={\"code\":-32000}, requestBody=\"{\\\"method\\\":\\\"eth_sendRawTransaction\\\",\\\"params\\\":[\\\"0x02f8730a0385012a05f2008504a817c800825 20894e301caf612f870e3e8e8d60c98877e0e234733fa87038d7ea4c6800080c080a0e3b6d8058ce1d8897b81137d30fe8801133d4f57d32d173034d 0b62b343df2d4a07d46f9876d71669c6d8f81ed0eeb47ef2aff8b865cec34b962361dcd5a45b64f\\\"],\\\"id\\\":44,\\\"jsonrpc\\\":\\\"2 .0\\\"}\", requestMethod=\"POST\", url=\"https://opt-mainnet.g.alchemy.com/v2/0bP2WTNFGVP74XTNPm-CIUR30xXK5ZQb\", code=SERVER_ERROR, version=web/5.7.1)"
Posted by lucas 6 days ago
Questions about the getTransactionReceipt api
What does mean the "status value" in the receipt of the transaction?
1. Does the Status value returned means result of success in the blockchain?
2. Or does it only mean that the transaction was successfully processed in Alchemy server?
As you know, 1 and 2 are different. Even if 2 is done, 1 may not be done.
I would like to know the exact meaning of the Status value returned from Alchemy.
Posted by Jeong Won Yong 8 days ago
close alchemy account
How to close the alchemy account?
Posted by ed 10 days ago