Bulk Insert
This feature is used when two or more addContractLog or createContractLog must be contained in a single transaction during the contract life cycle or when more than one contracts are sent as a bulk transaction.
Contents
This feature receives the addContractLog transaction creation message.
This feature receives the addContractFile transaction creation message.
This feature estimates the gas fee required for lining up transaction messages.
This feature executes multiple transactions at once.
Parameters required to call API.
1. getUnsignedTxAddContractLog
This function generates addContractLog transactions as messages. Events that happen in a contract life cycle are contained in the addContractLog. Once the gas fee for generating a message is calculated, the transaction is created by the function that executes messages. * For a more detailed guide on calculating the gas fee and executing messages, please refer to functions 3 and 4.
Parameters
wallet
Object (FirmaWalletService)
You can check how to use your wallet in the "firma-js of the Github repository".
contractHash
String
"da39330a6dfd90a91563603950f742240fa222580beecf36e141fe6410184e8b1669119707"
timeStamp
Number
1669182016039
eventName
String
"createContract"
ownerAddress
String
"firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u"
jsonString
String (JSON)
"{Encryption:{type:"JWT",alg:"HS256"},contracts:[{target:"contractor1",email:"contractor1@gmail.com"}]}"
Return value
2. getUnsignedTxCreateContractFile
This function generates "createContractLog" transactions as messages. Events that happen in a contract life cycle are contained in the addContractLog. Once the gas fee for generating a message is calculated, the transaction is created by the function that executes messages. * For a more detailed guide on calculating the gas fee and executing messages, please refer to functions 3 and 4.
Parameters
wallet
Object (FirmaWalletService)
You can check how to use your wallet in the "firma-js of the Github repository".
fileHash
String
"da39330a6dfd90a91563603950f742240fa222580beecf36e141fe6410184e8b1669119707"
timeStamp
Number
1669182016039
ownerList
Array (String)
["firma1epg9kx7nqz32dykj23p6jreqfh5x0wdy5a43qc"]
metaDataJsonString
String (JSON)
'{"storage":"ipfs","encryptIpfsHash":["U2FsdGVkX19UsL3m7Cq2bOtTCQArqZTuLgz7mfdRtXM2MnIgm67GM26GtPELsVL8s4+IN2Vj9FbFzpFj3rwfaw=="]}'
txMisc (Not required)
Object (TxMisc)
{fee:200000,gas:163821,memo:"custom message"}
Return value
3. getGasEstimationSignAndBroadcast
This function estimates the gas fee required when generating transactions of the message list created by functions 1 and 2. When using Bulk Insert, there is a high chance where the gas fee could exceed the default gas fee(0.02fct). Therefore, prior to the execution of the transaction, the gas fee must be estimated properly.
Parameters
msgList
msgList (EncodeObject[])
1 or 2 "Return value" Array value.
Return value
Example Run Image
4. signAndBroadcast
This function lists the messages generated from functions 1 and 2 and then generates the message list as transactions.
Parameters
wallet
Object (FirmaWalletService)
You can check how to use your wallet in the "firma-js of the Github repository".
msgList
msgList (EncodeObject[])
1 or 2 "Return value" Array value.
txMisc (Not required)
Object (TxMisc)
{fee:200000,gas:163821,memo:"custom message"}
Return value
Image of the transaction verified in Blockchain Explorer
5. Parameter Description
wallet
Unique wallet parameter created from the user’s Mnemonic. This parameter can be called by using the Wallet.fromMnemonic function from the FirmaSDK module.
contractHash &
fileHash
This parameter contains the mapped information of a file or a text to a predesignated length. This information can be used to track Contract on the network and allows developers to add multiple Logs to a single Contract Hash. Using the FirmaUtil, developers can call the hash value of a file or a text and we recommend developers to use the unique value.
timeStamp
This parameter timestamps a certain event, action or a result. This parameter is displayed as the "Unix time stamp" format and must be written in numbers.
eventName
This parameter contains information related to a certain event, action or a result. For instance, looking at the life cycle of a contract, this parameter can be devided into “Contract Creation”, “Invite Signatories”, “Sign”, “All Signatues Received” and “Contract Complete”.
ownerAddress
For this parameter, please enter your FirmaChain wallet address. The owner of the wallet can be anyone. (e.g. “Service Wallet Address” or “Signatory’s Wallet Address”).
ownerList
This parameter contains the wallet address list of the users related to a contract. This parameter can be added for the same purpose as the ownerAddress parameter.
jsonString & metaDataJsonString
This parameter contains additional information related to a contract. Additional information for instance, includes, public key (encrypted), location of the saved contract, contract download link or the e-mail address of the owner of the contract. Please write this parameter as JSON text format. * There are no set standard so please customize this parameter to suit the purpose of your project.
msgList
This parameter contains the list of messages that is used to execute transactions. * List can contain different transaction messages.
txMisc
This object contains the gas fee that is deducted when a transaction is called upon.
* The default gas fee is set at 0.02fct.
Last updated