Moralis.Net
1.0.8
dotnet add package Moralis.Net --version 1.0.8
NuGet\Install-Package Moralis.Net -Version 1.0.8
<PackageReference Include="Moralis.Net" Version="1.0.8" />
<PackageVersion Include="Moralis.Net" Version="1.0.8" />
<PackageReference Include="Moralis.Net" />
paket add Moralis.Net --version 1.0.8
#r "nuget: Moralis.Net, 1.0.8"
#:package Moralis.Net@1.0.8
#addin nuget:?package=Moralis.Net&version=1.0.8
#tool nuget:?package=Moralis.Net&version=1.0.8
Moralis.Net
Web3 geliştirmeyi en az Web2 kadar kolay hale getiren platformlardan biri olan Moralis'in .NET geliştiricileri için hazırlanmış kütüphanesidir.
Moralis'in herkese açık API dokümanı referans alınarak C# programlama dili ile Moralis üzerinden Web3 uygulama geliştirmek isteyenler için geliştirilmiştir.
Lisans:
MIT License
Özellikleri
- NuGet aracılığıyla yükleyebilme. (Moralis.Net)
- .NET 8 desteği. (Linux/MacOS uyumluluğu)
- RestAPI, Moralis resmi dokümanının büyük çoğunluğunu destekler.
- Aktif olarak yeni özellikler eklenmeye devam edilecek.
Başlangıç
API uç noktalarını kullanabilmek için Moralis hesabı oluşturmanız gerekmektedir.
Eğer hesabınız yok ise buraya tıklayarak Moralis'e kaydolabilirsiniz.
Kurulum
Bu kütüphane NuGet'te mevcuttur, indirmek için çekinmeyin. (https://www.nuget.org/packages/Moralis.Net/1.0.8)
NuGet PM
Install-Package Moralis.Net -Version 1.0.8
dotnet cli
dotnet add package Moralis.Net --version 1.0.8
Örnek Kullanım
Bağımlılık Enjeksiyonu (Dependency Injection):
ASP.NET Core veya Worker Service vb. modern .NET projelerinde AddMoralisNet uzantısı ile (DI container üzerinden) tüm bileşenleri ve performanslı HttpClient yapılandırmasını otomatik olarak entegre edebilirsiniz:
using Microsoft.Extensions.DependencyInjection;
// Servis kayıt aşamasında:
builder.Services.AddMoralisNet();
Klasik Kullanım (Sınıf İçi veya Console App):
using Moralis.Net.Business.Concrete;
// Dependency Injection kullanmıyorsanız direkt instance oluşturabilirsiniz:
var moralisManager = new MoralisManager();
Constructor'da tanımlama (Dependency Injection):
using Moralis.Net.Business.Abstract;
public class Test
{
private readonly IMoralisService _moralisService;
public Test(IMoralisService moralisService)
{
_moralisService = moralisService;
}
}
1. Web3 cüzdanındaki bakiye bilgisini okuma:
var apiKey = "xx_moralis_api_key_xx";
var address = "0xdc54a239B3be06E63b0DecA16c373d4480820498";
var result = await _moralisService.Web3Api.EvmChain.BalanceApi.GetNativeBalanceByWalletAsync(apiKey, address, ct: stoppingToken);
if (result.Success)
{
// ...
}
2. Birden fazla Web3 cüzdanındaki bakiye bilgilerini okuma:
var apiKey = "xx_moralis_api_key_xx";
var addresses = new List<string> { "0xb033417E14d0EF63DBbE4f648286729637c23CA5", "0x8241c3f56F274F45758D6530952392e73951ce55" };
var result = await _moralisService.Web3Api.EvmChain.BalanceApi.GetNativeBalanceForMultipleWalletAsync(apiKey, addresses, EvmChainEnum.BSC, ct: stoppingToken);
if (result.Success)
{
// ...
}
3. Dex borsasından bir tokenın fiyatını ve 24 saatlik yüzdelik değişimini okuma:
var apiKey = "xx_moralis_api_key_xx";
var tokenAddress = "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0";
var result = await _moralisService.Web3Api.EvmChain.TokenApi.GetTokenPriceAsync(apiKey, tokenAddress, ct: stoppingToken);
if (result.Success)
{
// ...
}
4. Belirli bir cüzdan için o cüzdandaki token bilgilerini okuma:
var apiKey = "xx_moralis_api_key_xx";
var address = "0xdc54a239B3be06E63b0DecA16c373d4480820498";
var tokenAddress = new List<string> { "0xb033417E14d0EF63DBbE4f648286729637c23CA5", "0x8241c3f56F274F45758D6530952392e73951ce55" };
var result = await _moralisService.Web3Api.EvmChain.TokenApi.GetTokenBalanceByWalletAsync(apiKey, address, tokenAddress, ct: stoppingToken);
if (result.Success)
{
// ...
}
5. Belirli bir cüzdan için ilk ve son transaction bilgisini okuma:
var apiKey = "xx_moralis_api_key_xx";
var address = "0xdc54a239B3be06E63b0DecA16c373d4480820498";
var result = await _moralisService.Web3Api.EvmChain.WalletApi.GetChainActivityByWalletAsync(apiKey, address, ct: stoppingToken);
if (result.Success)
{
// ...
}
6. Bir ağda gerçekleşen transaction bilgisini okuma:
var apiKey = "xx_moralis_api_key_xx";
var transactionHash = "0xd059d5d0246b286e999933784f2ec2da39ee59ded12dc98467d94487968f7bbc";
var result = await _moralisService.Web3Api.EvmChain.TransactionApi.GetTransactionByHashAsync(apiKey, transactionHash, EvmChainEnum.BSC, ct: stoppingToken);
if (result.Success)
{
// ...
}
7. Belirli bir cüzdana ait NFT'leri görüntüleme:
var apiKey = "xx_moralis_api_key_xx";
var address = "0xdc54a239B3be06E63b0DecA16c373d4480820498";
var tokenAddress = new List<string> { "0xb033417E14d0EF63DBbE4f648286729637c23CA5", "0x8241c3f56F274F45758D6530952392e73951ce55" };
var result = await _moralisService.Web3Api.EvmChain.NftApi.GetNftsByWalletAsync(apiKey, address, tokenAddresses: tokenAddress, ct: stoppingToken);
if (result.Success)
{
// ...
}
8. Belirli bir cüzdana ait tüm NFT koleksiyonlarını görüntüleme:
var apiKey = "xx_moralis_api_key_xx";
var address = "0xdc54a239B3be06E63b0DecA16c373d4480820498";
var result = await _moralisService.Web3Api.EvmChain.NftApi.GetNftCollectionsByWalletAsync(apiKey, address, ct: stoppingToken);
if (result.Success)
{
// ...
}
9. Bir cüzdanın Net Değerini (Net Worth) USD cinsinden hesaplama:
var apiKey = "xx_moralis_api_key_xx";
var address = "0xdc54a239B3be06E63b0DecA16c373d4480820498";
var chains = new List<EvmChainEnum> { EvmChainEnum.ETHEREUM, EvmChainEnum.BSC, EvmChainEnum.POLYGON };
var result = await _moralisService.Web3Api.EvmChain.WalletApi.GetWalletNetWorthAsync(apiKey, address, chains, excludeSpam: true, ct: stoppingToken);
if (result.Success)
{
Console.WriteLine($"Total Net Worth: {result.Data.TotalNetworthUsd} USD");
}
Bağış Yap
Kütüphaneyi kullanıp beğendiyseniz destek olmak amaçlı bağışta bulunabilirsiniz. Aşağıda Bitcoin ve Ethereum için cüzdan adreslerim yer almaktadır.
<img src="https://cdn.worldvectorlogo.com/logos/tether-1.svg" width="24px"> Tether (USDT) - TRC20: TC3ruh9qWbwAnCHGEkschnmcYUNxGumHJS
<img src="https://cdn.worldvectorlogo.com/logos/bitcoin.svg" width="24px"> Bitcoin (BTC) - ERC20: 0x4a656a72fada0ccdef737ad8cc2e39686af5efbe
<img src="https://cdn.worldvectorlogo.com/logos/ethereum-1.svg" width="18px"> Ethereum - ETH: 0x4a656a72fada0ccdef737ad8cc2e39686af5efbe
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Http (>= 10.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- HttpClient soket tüketimi çözüldü ve DI altyapısı kuruldu.
- Cüzdanın usd karşılığını okuyan "Wallet Net Worth" uç noktası eklendi.
- Desteklenen YENİ zincirler (ağlar): OPTIMISM, SEI, BASE_SEPOLIA, LINEA, LINEA_SEPOLIA, RONIN, RONIN_TESTNET, POLYGON_AMOY, MOONBEAM, MOONRIVER, MOONBASE, FLOW, FLOW_TESTNET, LISK, LISK_SEPOLIA, PULSE, SEI_TESTNET, MONAD