Fractal
  • Overview
  • Basics
    • Architecture
  • Key Concepts
    • Fractal Confluence: The EVM Layer
    • The Confluence Bridge
    • Fractal Spring: The UTXO Layer
      • Concepts
      • Technical Specifications
    • Staking
      • Overview
      • EVM Staking
        • UTXO Staking and EVM Staking
      • Consensus
      • Rewards
      • Penalties
  • Developers
    • Acquire Testnet FRA
    • EVM Tools & Tutorials
      • Contract Deployment
        • Ganache
        • Hardhat
        • Remix
        • Truffle
        • Waffle
      • The Graph
    • Developer SDKs
      • UTXO Native Chain SDK
        • Fractal Spring (UTXO Layer) SDK Installation
        • Developer Tools
          • Fractal CLI Tool
        • UTXO API Reference
          • Account
          • Keypair
          • Network
          • Asset
          • Staking
          • Transaction
          • Helpers
      • The Confluence Bridge SDK
    • EVM References
      • Metamask
      • Local Development Network Setup
      • EVM API Reference
      • Precompiled Contracts
  • Network Settings
    • Contract Addresses
    • Network Settings
  • User Guides
    • Fractal Wallet Guides
      • MetaMask
        • Download
        • Configure (Auto)
        • Configure (Manual)
      • Fractal Wallet
        • Download
        • New Wallet
        • Transfer Tokens in the Fractal Wallet
        • The Confluence Bridge
        • Adding Custom Assets to the Fractal Wallet
        • Manage Assets
      • Ledger Hardware Wallet
    • Acquire FRA
    • Explore Testnet
    • Acquire FRA (Testnet)
    • Stake FRA
    • How to Use Block Explorers
    • Bridging Tokens to Fractal
  • Validator Materials
    • Validator Setup Guides
      • System Requirements
      • Acquire a Server
      • Validator Toolbox Setup
        • New Build
        • Existing Build
        • Additional Info
      • Manual Setup
      • Automated Setup (Deprecated)
    • Upgrade Guides
      • Node Upgrade (Toolbox)
      • Node Upgrade (Manual)
      • fn CLI Upgrade (Wallet)
    • Operational Guides
      • Emergency Recovery
      • Data Backup
      • CLI Staking
Powered by GitBook
On this page
  1. Developers
  2. Developer SDKs
  3. UTXO Native Chain SDK
  4. UTXO API Reference

Staking

PreviousAssetNextTransaction

Last updated 1 year ago

claim

- Claim FRA Token Rewards This function enables users to claim rewards earned from staking FRA tokens.

Parameters:

  • <WalletKeypar> - Wallet keypair

  • <string> - the amout of rewards which users wants to claim

Results:

  • Promise<TransactionBuilder> - TransactionBuilder which should be used in Transaction.submitTransaction.

Example:

const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);

// First, we create a transaction builder
const assetBuilder = await Asset.defineAsset(walletInfo, assetCode);

// Then, we submit a transaction
const handle = await Transaction.submitTransaction(assetBuilder);

delegate

- Delegates FRA tokens This function allows users to delegate FRA tokens to a validator. This functionality is nearly identical to Transaction.sendToAddress except it adds one additional operation (i.e. add_operation_delegate) to the transaction builder.

Parameters:

  • <WalletKeypar> - Wallet keypair

  • <string> - Target address for delegation

  • <string> - delegation amout

  • <string> - Asset Code

  • <string> - Target validator Address

  • <AssetBlindRules> - (optional) Confidential options for blind rule

  • Promise<TransactionBuilder> - TransactionBuilder which should be used in Transaction.submitTransaction.

const ledger = await getLedger();

// This is the address funds are sent to.
// Actual `transfer to validator` process would be handled via added `add_operation_delegate` operation

const delegationTargetPublicKey = Ledger.get_delegation_target_address();
const delegationTargetAddress = await Keypair.getAddressByPublicKey(
  delegationTargetPublicKey
);

const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);

const assetCode = await Asset.getFraAssetCode();

const assetBlindRules: Asset.AssetBlindRules = {
  isTypeBlind: false,
  isAmountBlind: false,
};

const transactionBuilder = await StakingApi.delegate(
  walletInfo,
  delegationTargetAddress,
  amount,
  assetCode,
  validatorAddress,
  assetBlindRules
);

const resultHandle = await Transaction.submitTransaction(transactionBuilder);

- Get the delegation information This method is used to get the delegation information

  • <string> - wallet address

  • Promise<DelegateInfoResponse> - An instance of DelegateInfoDataResult containing the response and error..

const address = "fra123sxde";

// Get the delegation information
const delegateInfo = await StakingApi.getDelegateInfo(address);

- Get validator list This method is used to get the list of validators.

  • Promise<validatorListResponse> - An instance of validatorListResponse containing the response and error..

// Get validator list
const validatorList = await StakingApi.getValidatorList();

- Unstake FRA tokens This function allows users to unstake (aka unbond) FRA tokens.

  • <WalletKeypar> - Wallet keypair

  • <string> - the amount users wants to unstake

  • <string> - validator's address

  • <boolean> - fully unstake option. Default is false

  • Promise<TransactionBuilder> - TransactionBuilder which should be used in Transaction.submitTransaction.

const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);

// Define whether or not user desires to unstake all the tokens, or only part of the staked amount
const isFullUnstake = false;

const transactionBuilder = await StakingApi.unStake(
  walletInfo,
  amount,
  validator,
  isFullUnstake
);

const resultHandle = await Transaction.submitTransaction(transactionBuilder);y

Results:

Example:

getDelegateInfo

Parameters:

Results:

Example:

getValidatorList

Results:

Example:

unStake

Parameters:

Results:

Example:

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​