Skip to content

pwrlabs/pwrcsharp

Repository files navigation

PWR

PWR is a C# library for interacting with the PWR network. It provides an easy interface for wallet management and sending transactions on PWR.

🌐 Documentation

How to Guides 🔜 & API 💻

Play with Code Examples 🎮

Installation

PWR is available on The NuGet Gallery. Add this dependency to your .csproj file:

dotnet add package PWR

💫 Getting Started

Import the library:

using PWR;
using PWR.Models;

Set your RPC node:

var rpc = new RPC("https://pwrrpc.pwrlabs.io/");

Generate a new random wallet:

var wallet = new Wallet(12); 

Import wallet by Seed Phrase:

string seedPhrase = "your seed phrase here";
var wallet = new Wallet(seedPhrase); 

Get wallet address:

string address = await wallet.GetAddress();

Get wallet balance:

ulong balance = await wallet.GetBalance();

Transfer PWR tokens:

var response = await wallet.TransferPWR("recipientAddress", amount); 

Sending a transcation to the PWR Chain returns a Response object, which specified if the transaction was a success, and returns relevant data. If the transaction was a success, you can retrieive the transaction hash, if it failed, you can fetch the error.

WalletResponse response = await wallet.TransferPWR("recipientAddress", amount);

if(response.Success) {
   	Console.WriteLine("Transcation Hash: " + response.Hash);
} else {
	Console.WriteLine("Error: " + response.Error);
}

Send data to a VIDA:

uint vidaId = 123;
byte[] data = Encoding.UTF8.GetBytes("Hello, World!");
var response = await wallet.SendVidaData(vidaId, data);

if(response.Success) {
   	Console.WriteLine("Transcation Hash: " + response.Hash);
} else {
	Console.WriteLine("Error: " + response.Error);
}

Other Static Calls

Get RPC Node Url:

Returns currently set RPC node URL.

var url = rpc.GetRpcNodeUrl()

Get Fee Per Byte:

Gets the latest fee-per-byte rate.

ulong fee = await rpc.GetFeePerByte();

Get Balance Of Address:

Gets the balance of a specific address.

ulong balance = await rpc.GetBalanceOfAddress("0x...");

Get Nonce Of Address:

Gets the nonce/transaction count of a specific address.

uint nonce = await rpc.GetNonceOfAddress("0x..."); 

✏️ Contributing

If you consider to contribute to this project please read CONTRIBUTING.md first.

You can also join our dedicated channel for developers on the PWR Chain Discord

📜 License

Copyright (c) 2025 PWR Labs

Licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages