Observed since 20 Oct, 22:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Transaction manager and utilties for the Pocket Network protocol
This package houses the TransactionBuilder, which lets you build a transaction to then send into the network.
Install through your package manager of choice:
pnpm install @pokt-foundation/pocketjs-transaction-builder
import { TransactionBuilder } from '@pokt-foundation/pocketjs-transaction-builder'
// Initializing the TransactionBuilder is simple:
// 1. Instanciate a provider
export const provider = new JsonRpcProvider({
rpcUrl: MAINNET_RPC_URL,
})
// 2. Instanciate a signer
export const signer = await KeyManager.fromPrivateKey(process.env.PRIVATE_KEY)
// 3. Instanciate the TransactionBuilder
export const builder = new TransactionBuilder({
signer,
provider,
});
// Create a new `Send` Message which is used to send funds over the network.
const sendMsg = transactionBuilder.send(
signer.getAddress(),
"07a6fca4dea9f01e4c19f301df0d0afac128561b",
// Amount in uPOKT (1 POKT = 1*10^6 uPOKT)
"1000000"
)
// Send it over the network!
const txresponse = await transactionBuilder.submit({
memo: "POKT Payment",
txMsg: sendMsg,
})
KeyManager
The KeyManager instance that holds the staked app in the blockchain.JsonRpcProvider | IsomorphicProvider
The provider instance with available dispatchers to talk to the network.mainnet | localnet | testnet
ChainID to send the transactions to. The provider endpoint must be connected to that chain ID.Gets the current chain ID this transaction builder has been initialized for.
Returns ChainID: 'mainnet', 'localnet', or 'testnet'.
Sets the chainID to one of the supported networks.
| Param | Type | Description |
|---|---|---|
| id | string | The chain to send transactions to. The provider must be connected to that chain |
Signs and creates a transaction object that can be submitted to the network given the parameters and called upon Msgs.
Returns Promise<RawTxRequest>: The raw transaction request which can be sent over the network.
| Param | Type | Description |
|---|---|---|
| fee | string | The amount to pay as a fee for executing this transaction, in uPOKT (1 POKT = 1*10^6 uPOKT) |
| memo | string | Memo field for this transaction. |
| txMsg | TxMsg | Transaction message generated with one of the available methods. |
Submit receives a valid transaction message, creates a Raw Transaction Request and sends it over the network.
Returns Promise<TransactionResponse: The transaction response from the network, containing the transaction hash.
| Param | Type | Description |
|---|---|---|
| fee | string | The amount to pay as a fee for executing this transaction, in uPOKT (1 POKT = 1*10^6 uPOKT) |
| memo | string | Memo field for this transaction. |
| txMsg | TxMsg | Transaction message generated with one of the available methods. |
Submit receives an already made Raw Transaction Request and sends it over the network.
Returns Promise<TransactionResponse: The transaction response from the network, containing the transaction hash.
| Param | Type | Description |
|---|---|---|
| tx | RawTxRequest | The raw transaction request, created with createTransaction. |
Adds a MsgSend TxMsg for this transaction.
Returns a MsgProtoSend: An unsigned Send transaction message.
| Param | Type | Description |
|---|---|---|
| fromAddress | string | Origin address, which is the address that the signer holds. |
| toAddress | string | Destination address |
| amount | string | Amount of uPOKT to send. |
Adds a MsgAppStake TxMsg for this transaction.
Returns a MsgProtoAppStake: The unsigned App Stake message.
| Param | Type | Description |
|---|---|---|
| appPubKey | string | Application Public Key |
| chains | string[] | Chains that the apps wants access to by staking POKT. Throughput will be equally divided through all chains. |
| amount | string | Amount of uPOKT to stake. |
Adds a MsgProtoAppUnstake TxMsg for this transaction.
Returns MsgProtoAppUnstake: The unsigned app unstake message.
| Param | Type | Description |
|---|---|---|
| address | string | Address of the account. |
Adds a NodeStake TxMsg for this transaction.
Returns a MsgProtoNodeStakeTx: The unsigned node stake message.
| Param | Type | Description |
|---|---|---|
| nodePubKey | string | Node Public Key |
| chains | string[] | Chains that the node wants to service to by staking POKT. |
| amount | string | Amount of uPOKT to stake. |
| serviceURL | URL | Node service URL that will be used to send requests through. |
Adds a MsgProtoNodeUnstake for this transaction.
Returns MsgProtoNodeUnstake: The unsigned node unstake message.
| Param | Type | Description |
|---|---|---|
| address | string | Address of the account. |
Adds a MsgUnjail for this transaction.
Returns a MsgProtoNodeUnstake: The unsigned node unjail message.
| Param | Type | Description |
|---|---|---|
| address | string | Address of the account. |
Download counts and popularity will appear here as the collector receives them.
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:e04432cbb738f7db17d67f1422c86bcee1e51e397e003cdebc23e6b36dc2688d