Smart contract
constructor
Params
Name
Type
Required
Description
client
Client
Conditional required
RPC client that will be used to interact with KardiaChain
provider
string
Conditional required
RPC endpoint. Either client
or provider
must be provided to initialize a smart contract instance
bytecodes
string
abi
object[]
Return
Return a KardiaContract
instance.
Methods
updateAbi
Update instance's ABI
Params
Name
Type
Required
Description
abi
object[]
Required
New ABI
Return
None
updateByteCode
Update instance's byte code
Params
Name
Type
Required
Description
bytecodes
string
Required
New byte code
Return
None
info
Get instance's info
Params
None
Return
Instance's info, containing
Name
Type
Description
byteCode
string
Smart contract instance's byte code
abi
object[]
Smart contract instance's ABI
deploy
Create a pre-deploy object that will be used to deploy smart contract to KardiaChain
Params
Name
Type
Required
Description
obj
object
Required
Smart contract's deploy params
obj.gasLimit
number
Gas limit for deploy transaction
obj.gasPrice
number
Gas price for deploy transaction
obj.params
any[]
Required
Smart contract's constructor params
Return
A pre-deploy object containing
Name
Type
Description
txData
Function
Function to get deploy transaction's data
getDefaultTxPayload
Function
Function to get default payload that will be use for deploy transaction
estimateGas
Function
Function to estimate gas for deploy transaction. Can be used with custom payload
send
Function
invokeContract
Invoke a deployed smart contract function.
Params
Name
Type
Required
Description
name
string
Required
Function to invoke's name
params
any[]
Required
Invoke params
Return
A invocation object containing
Name
Type
Description
txData
Function
Function to get deploy transaction's data
getTxObject
Function
Function to get transaction payload that will be use for invoke transaction
estimateGas
Function
Function to estimate gas for deploy transaction. Can be used with custom payload
send
Function
call
Function
parseEvent
Parse smart contract's event
Params
Name
Type
Required
Description
txHash
string
Required
Transaction hash to parse events
Return
List of parsed events
This function will use the instance's ABI to parse event.
Last updated