我正在努力将 Nethereum 集成到我的 .NET 5 C# API 中,并且可以针对我选择的区块链 (BSC) 进行读取查询,但无法成功执行 SendTransactionAsync 或 SendRequestAsync。我一直遇到以下异常:
Nethereum.JsonRpc.Client.RpcResponseException: 'transaction type not supported: eth_sendRawTransaction'。
以下是我尝试过的代码片段:
// Setup
var account = new Account(privateKey, chainId);
var rpcUrl = "https://data-seed-prebsc-2-s2.binance.org:8545/";
var client = new RpcClient(new Uri(rpcUrl));
var web3 = new Web3(account, client);
var mediaTokenAddress = "0x1E4d1BFDa5d55C2176E9E3e8367BAe720525a8e0";
var mtSvc = new MediaTokenService(web3, mediaTokenAddress);
var mintMsg = new MintNftFunction
{
FromAddress = account.Address,
Recipient = "REDACTED",
MetadataHash = "TestMetaDataHash",
MediaHash = "TestMediaHash",
SeasonId = 1
};
Run Code Online (Sandbox Code Playgroud)
// Attempt #1: …Run Code Online (Sandbox Code Playgroud)