Log

One of the features provided by the Contract module, Log allows users to record any and all events that happen in the process of closing a contract, on the chain network as transactions. Additionally, users can search logs that are recorded on ContractHash.

Contents

Name
Description

This feature allows users to record events, actions or results that happen in the process of writing a contract on the chain network.

This feature inquires logs that are recorded on the chain using the log ID.

This feature checks all logs that are recorded on the chain network.

This feature estimates gas fee required

to execute the addContractLog transaction.

This feature checks all logs that are registered on the hash.

Parameters required to call API.

1. addContractLog

This function allows users to record events, actions and results that happen in the process of closing a contract on the chain network as transactions. When running this function, transactions are created on the chain based on the predesignated parameters of this function. Users can get a visual confirmation of the result of this function on the FirmaChain block explorer by using the “transactionHash” value of the “Return value”.

Parameters

Name
Type
Example

wallet

Object (FirmaWalletService)

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"}]}"

txMisc (Not required)

Object (TxMisc)

{fee:200000,gas:163821,memo:"custom message"}

Return value

{
  code: 0,
  height: 413126,
  rawLog: ‘[{
    "events": [{
      "type": "message",
        "attributes": [{
        "key": "action",
        "value":"CreateContractLog“
      }]
    }]
  }]',
  transactionHash: "F61584DE6B2F...63B1788247FE",
  gasUsed: 73443,
  gasWanted: 200000
}

2. getContractLog

This feature allows users to inquire logs that happen in the process of closing a contract. Inquiries are made using the logId, and users can check the transaction information in the addContractLog. * transactionHash information are not included.

Paramters

Name
Type
Example

logId

String (Number)

"6792"

Return value

{
  creator: "firma1nssuz67a...j3k9l6cx65ux9u",
  id: "68219",
  contractHash: "da39330a6dfd90a...4e8b1669108636",
  timeStamp: "1669108636",
  eventName: "createContract",
  ownerAddress: "firma1nssuz67a...j3k9l6cx65ux9u",
  jsonString: "{}"
}

3. getContractLogAll

This function checks all contract related logs recorded on the chain network. Since this functions goes through all recorded logs on the chain network, using this function might cause serious network delays. Therefore, we do not recommend the universal application of this feature when developing real services. Rather, we recommend developers to apply this feature only to obtain an overall tally of the recorded log data.

Parameters

Name
Type
Example

paginationKey (Not required)

String | Undefined

"AAAAAAAAAGQ="

Return value

{
  [{
    creator: 'firma1p3qk0ednef258lv6vjt6g657d7jh0gh6wez9c4',
    id: '99',
    contractHash: 'test0.9212182198543295',
    timeStamp: '1666933357',
    eventName: 'test0.678718823219671',
    ownerAddress: 'test',
    jsonString: '{}'
  }],
  ...
  pagination: { next_key: 'AAAAAAAAAGQ=', total: 68221 }
}

4. getGasEstimationAddContractLog

This feature calculates the gas fee that is generated when running the function that creates addContractLog transactions. Used as the last parameter of the addContractLog function, we recommend developers to pay the transaction fees using this function.

Parameters

Name
Type
Example

wallet

Object (FirmaWalletService)

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

112706

5. getContractListFromHash

Parameters

Name
Example

contractHash

String

"da39330a6dfd90a91563603950f742240fa222580beecf36e141fe6410184e8b1669119707"

Return value

[
  '68183', '68185', '68187', '68189', '68193', '68195',
  '68199', '68201', '68207', '68209', '68213', '68215'
]

6. Parameter Description

Name
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

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”)

jsonString

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.

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.

logId

This parameter contains the Unique ID value of the addContractLog recorded on the chain network. Developers can search the Log registered under a certain ID.

paginationKey

This parameter fetches all logs when the getContractLogAll is inquired. Once the number of log exceeds 100, this parameter is used to inquire data starting with the 101st data set.

Last updated