Interacting with a pool using NodeJS

Initialization

To interact with the pool, set up a new pool instance and insert an arweave instance, your key file, and the pool id.
1
import { Pool } from "@kyve/contract-lib"
2
3
const pool = new Pool(arweave, keyfile, poolID);
Copied!

Deposit

Depositing allows you to transfer tokens into a pool.
1
// deposit 100 tokens into the pool
2
const txID = pool.deposit(100)
Copied!

Withdraw

Withdraw allows you to transfer tokens out of a pool.
1
// withdraw 100 tokens into the pool
2
const txID = pool.withdraw(100)
Copied!

Fund

Funding increases the pools balance. Tokens will be reduced from the funding on every payout. Requires that you have deposited tokens into the pool first.
1
// fund 100 tokens into the pool
2
const txID = pool.fund(100)
Copied!

Unfund

Unfunding reduces the pool's balance. Requires that you have funded tokens into the pool first.
1
// unfund 100 tokens from the pool
2
const txID = pool.unfund(100)
Copied!

Stake

Tokens will be staked. Requires that you have deposited tokens into the pool first. Staking is handled automatically when starting a node.
1
// stake 100 tokens into the pool
2
const txID = pool.stake(100)
Copied!

Unstake

Tokens will be removed from the stake. Unstaking is handled automatically when starting a node.
1
// remove 100 staked tokens from the pool
2
const txID = pool.unstake(100)
Copied!
Last modified 3mo ago