Delegate

The delegate method is used to stake tokens for NET and CPU resources on Antelope blockchains. By staking, an account can allocate resources either for its own benefit or for another account. The method returns an Action instance detailing the resource delegation. That action can then be signed and executed on-chain using the SessionKit Transact method.

Usage

The delegate method is available on any Account instance. Here is a basic example of how to use it:

const action = testAccount.delegate({
  cpu: "1.0000 EOS",
  net: "0.5000 EOS",
})

A single resource can also be specified:

// Staking only for CPU
const cpuAction = testAccount.delegate({ cpu: "1.0000 EOS" })
// Staking only for bandwidth (net)
const netAction = testAccount.delegate({ net: "1.0000 EOS" })

To delegate resources to another account:

const action = testAccount.delegate({
  cpu: "1.0000 EOS",
  net: "0.5000 EOS",
  receiver: "wharfkit1112",
})

To delegate resources to another account and transfer the ownership of the staked tokens:

const action = testAccount.delegate({
  cpu: "1.0000 EOS",
  net: "0.5000 EOS",
  receiver: "wharfkit1112",
  transfer: true,
})

Arguments

  • cpu: Amount of tokens to stake for CPU resources.
  • net: Amount of tokens to stake for bandwidth (NET) resources.

Options

  • receiver: Specifies the account name of the Antelope account that should receive the RAM. Defaults to the payer.
  • transfer: A boolean indicating if the staked tokens’ ownership should be transferred to the receiver. Defaults to false.

Return Value

The delegate method returns an Action instance. This action can then be passed to the SessionKit Transact method for execution.