0.12.8 • Published 5 months ago

@pwrjs/core v0.12.8

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

PWRJS

PWRJS is a JavaScript library for interacting with the PWR blobkchain. It provides an interface for wallet management and sending transactions on PWR.

Pull Requests welcome

Installation

install the package according to your environment. (nodejs or browser)

# latest official release (main branch)
$ npm install @pwrjs/core

# for latest pre-release version (develop branch)
$ npm install @pwrjs/core@next

# for latest beta release version (beta branch)
$ npm install @pwrjs/core@beta

🌐 Documentation

How to Guides 🔜 & API 💻

Play with Code Examples 🎮

💫 Getting Started

Import the library:

import PWRJS from "@pwrjs/core";
import Wallet from "@pwrjs/core/wallet";

// or
const PWRJS = require('@pwrjs/core');
const Wallet = require('@pwrjs/core/wallet');

Create a new instance

const pwrjs = new PWRJS('https://pwrrpc.pwrlabs.io');

Generate a new random wallet:

const wallet = Wallet.newRandom(12);

Import wallet by Seed Phrase:

const seedPhrase = "your seed phrase here";
const wallet = Wallet.fromSeedPhrase(seedPhrase);

Get wallet address:

const address = wallet.getAddress();

Get wallet seed phrase:

const seedPhrase = wallet.getSeedPhrase();

Get wallet balance:

const balance = await wallet.getBalance();

Transfer PWR tokens:

const recipientAddress = '0x...';
const pwrAmount = '1000000000'; // 1 PWR = 10^9
await wallet.transferPWR(recipientAddress, BigInt(pwrAmount));

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.

try {
    const response = await wallet.transferPWR(recipientAddress, BigInt(pwrAmount));

    if (response.sucess) {
        console.log('Transcation Hash: ' + response.hash);
    }
} catch (e) {
    console.log(e);
}

Send data to a vida:

const vidaId = BigInt('123');
const data = new TextEncoder().encode('Hello world');

try {
    const response = await wallet.sendVidaData(vidaId, data);
    if (response.sucess) {
        console.log('Transcation Hash: ' + response.hash);
    }
} catch (e) {
    console.log(e);
}

Other Static Calls

Get RPC Node Url:

Returns currently set RPC node URL.

const url = await pwrjs.getRpcNodeUrl();

Get Fee Per Byte:

Gets the latest fee-per-byte rate.

const fee = await pwrjs.getFeePerByte();

Get Balance Of Address:

Gets the balance of a specific address.

const balance = await pwrjs.getBalanceOfAddress('0x...');

Get Nonce Of Address:

Gets the nonce/transaction count of a specific address.

const nonce = await pwrjs.getNonceOfAddress('0x...');

Broadcast Txn:

Broadcasts a signed transaction to the network.

const signedTransaction = '...';
const broadcast = await pwrjs.broadcastTxn(signedTransaction);

✏️ Contributing

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

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

📜 License

Copyright (c) 2025 PWR Labs

Licensed under the MIT license.

0.11.0

5 months ago

0.11.1

5 months ago

0.11.5

5 months ago

0.11.6

5 months ago

0.11.7

5 months ago

0.11.2-alpha.0

5 months ago

0.11.4-alpha.0

5 months ago

0.7.0

8 months ago

0.12.7

5 months ago

0.12.8

5 months ago

0.10.1

5 months ago

0.12.0

5 months ago

0.10.2

5 months ago

0.12.1

5 months ago

0.12.2

5 months ago

0.10.4

5 months ago

0.12.3

5 months ago

0.12.4

5 months ago

0.10.6

5 months ago

0.12.5

5 months ago

0.10.7

5 months ago

0.12.6

5 months ago

0.10.8

5 months ago

0.11.5-alpha2

5 months ago

0.11.5-alpha1

5 months ago

0.6.3

8 months ago

0.6.2

9 months ago

0.11.5-alpha.0

5 months ago

0.11.3-alpha.0

5 months ago

0.6.1

9 months ago

0.6.0

9 months ago

0.5.7

1 year ago

0.5.6

1 year ago

0.5.5

1 year ago

0.4.9

1 year ago

0.4.8

1 year ago

0.4.10

1 year ago

0.4.11

1 year ago

0.4.12

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.4.7

1 year ago

0.4.6

1 year ago

0.4.4

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.4.1

1 year ago

0.3.9

2 years ago

0.3.10

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago