BuyRam

The buyRam method allows accounts to purchase RAM using a specific amount of tokens. It returns an Action instance detailing the RAM purchase. That action can then be signed and executed on-chain using the SessionKit Transact method.

Usage

The buyRam method is available on any Account instance. Here is a basic example detailing how to purchase RAM using a specific amount of tokens:

const action = testAccount.buyRam("1.0000 EOS")

Alternatively, an Antelope Asset instance can be passed:

const action = testAccount.buyRam(Asset.from(1.0, "4,EOS"))

To specify a receiver for the RAM purchase, the receiver option can be used:

const action = testAccount.buyRam("1.0000 EOS", {
  receiver: "wharfkit1112",
})

Arguments

  • amount: The amount of tokens to be used for purchasing RAM – it can be a string or an Asset instance.

Options

The buyRam method accepts an optional object with the following property:

  • receiver: Specifies the name of the Antelope account that should receive the RAM. Defaults to the payer.

Return Value

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