Plugin

FCT Plugin is a class, that builds a call / node for FCT Core Library.

Example with ERC20 Transfer plugin

const transfer = new ERC20.actions.Transfer({
    chainId: "1",
})

Plugin constructor

Name
Type
Required?
Description

chainId

ChainId

Chain ID of the network on which the plugins will run.

initParams

Plugin Parameters

Parameters of the plugin. If passed, those values will be set on parameters.

Plugin parameters

Name
Plugin Type
Description

to

FctAddress

Contract address. (Receiver address if Utility SendETH plugin used)

methodParams

Plugin Method Parameters

value

FctValue

Value of the call. Only required for plugins, where value is required.

methodParams always differ for every Plugin. methodParams are the parameters of plugin function/method

How to set parameters

There are 3 ways to add parameters to plugin.

1. Adding parameters in the plugin's class constructor

If parameters of the plugin are known beforehand - parameters can be added inside plugin's class constructor under initParams parameter

const transfer = new ERC20.actions.Transfer({
  chainId: "1",
  initParams: {
     to: "0xB1191F691A355b43542Bea9B8847bc73e7Abb137" // KIRO Address
     methodParams: {
       recipient: "0x...",
       amount: "100000000"
     }
  }
})

2. Adding parameters by calling input set function

const transfer = new ERC20.actions.Transfer({
   chainId: "1",
})

transfer.input.set({
   to: "0xB1191F691A355b43542Bea9B8847bc73e7Abb137" // KIRO Address
   methodParams: {
     recipient: "0x...",
     amount: "100000000"
   }
})

3. Adding parameters by calling each parameter separately

const transfer = new ERC20.actions.Transfer({
   chainId: "1",
})

transfer.input.to.set({ value: "0xB1191F691A355b43542Bea9B8847bc73e7Abb137" })

transfer.input.methodParams.amount.set({ value: "100000000" })

Last updated