File

File allows users to record contracts on the network or search contracts that are recorded on the chain network.

Contents

NameDescription

This feature allows completed contracts to be written on the chain network as Hash value.

This feature inquires contract information recorded on the chain network using Hash values.

This feature inquires all contract related information recorded on the chain network.

This feature estimates the required gas fee

when running the "createContractFile" transaction.

Parameters required to call API.

1. createContractFile

This function(generate transactions) records contracts on the chain network. * Once a contract is recorded on the chain network, it cannot be further modified so we recommend users to only upload contracts that are complete.

Parameters

NameTypeExample

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

{
  code: 0,
  height: 413187,
  rawLog: ‘[{
            "events": [{
              "type": "message",
              "attributes": [{
                "key":"action",
                "value":"CreateContractFile“
              }]
            }]
          }]’,
  transactionHash: "2856B8B0C6B49CD...78EEB558D86421F",
  gasUsed: 70898,
  gasWanted: 200000
}

2. getContractFile​

This feature allows users to inquire contracts that are recorded on the Users chain using the fileHash value. * All contracts recorded on the chain network are recorded as hash values.

Parameter

NameTypeExample

fileHash

String

"da39330a6dfd90a91563603950f742240fa222580beecf36e141fe6410184e8b1669119707"

Return value

{
  creator: 'firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u',
  fileHash: 'da39330a6dfd90a91563603950f742240fa222580beecf36e141fe6410184e8b',
  timeStamp: '1669106395',
  ownerList: [ 'firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u' ],
  metaDataJsonString: '{"storage":"ipfs",
    "encryptIpfsHash": ["U2FsdGVkX18curk11EhPxYPJtwmE0BffES2vp1h/+p62/VTafy5dsmvaUCkHlXUkBiHXwzBKB8dF3NwI9dfUyw=="]}'
}

3. getContractFileAll

This feature inquires all contracts recorded on the chain network.

Parameter

NameTypeExample

paginationKey

(Not required)

String | Undefined

"ZGEzOTMzMGE2ZGZkOTBhOTE1NjM2MDM5NTBmNzQyMjQwZmEyMjI1ODBiZWVjZjM2ZTE0MWZlNjQxMDE4NGU4YjE2NjkxMDY3MTE="

Return value

{
  [{
    creator: 'firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u',
    fileHash: 'da39330a6dfd90a91563603950f742240fa222580beecf36e141fe6410184e8b1669106610',
    timeStamp: '1669106610',
    ownerList: [Array],
    metaDataJsonString: '{"storage":"ipfs","encryptIpfsHash":["U2FsdGVkX19UsL3m7Cq2bOtTCQArqZTuLgz7mfdRtXM2MnIgm67GM26GtPELsVL8s4+IN2Vj9FbFzpFj3rwfaw=="]}'
  }],
  ...
  pagination: {
    next_key: 'ZGEzOTMzMGE2ZGZkOTBhOTE1NjM2MDM5NTBmNzQyMjQwZmEyMjI1ODBiZWVjZjM2ZTE0MWZlNjQxMDE4NGU4YjE2NjkxMDY3MTE=',
    total: 117
  }
}

4. getGasEstimationCreateContractFile

This feature estimates the gas fee required when executing the createContractFile transaction.

Parameters

NameTypeExample

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

Return value

162019

5. Parameter Description

NameDescription

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.

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.

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.

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.

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.

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