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

Plugin parameters

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