Skip to content

File ​

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

Contents ​

NameDescription
1. createContractFileThis feature allows completed contracts to be written on the chain network as Hash value.
2. getContractFileThis feature inquires contract information recorded on the chain network using Hash values.
3. getContractFileAllThis feature inquires all contract related information recorded on the chain network.
4. getGasEstimationCreateContractFileThis feature estimates the required gas fee
when running the "createContractFile" transaction.
5. Parameter DescriptionParameters required to call API.

1. createContractFile ​

This function(generate transactions) records contracts on the chain network.
&#xNAN;* 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
walletObject (FirmaWalletService)You can check how to use your wallet in the "firma-js of the Github repository".
fileHashString"da39330a6dfd90a91563603950f742240fa222580beecf36e141fe6410184e8b1669119707"
timeStampNumber1669182016039
ownerListArray (String)["firma1epg9kx7nqz32dykj23p6jreqfh5x0wdy5a43qc"]
metaDataJsonStringString (JSON)'{"storage":"ipfs","encryptIpfsHash":["U2FsdGVkX19UsL3m7Cq2bOtTCQArqZTuLgz7mfdRtXM2MnIgm67GM26GtPELsVL8s4+IN2Vj9FbFzpFj3rwfaw=="]}'
txMisc
(Not required)
Object (TxMisc){fee:200000,gas:163821,memo:"custom message"}

Return value ​

json
{
  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.
&#xNAN;* All contracts recorded on the chain network are recorded as hash values.

Parameter ​

NameTypeExample
fileHashString"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
walletObject (FirmaWalletService)You can check how to use your wallet in the "firma-js of the Github repository".
fileHashString"da39330a6dfd90a91563603950f742240fa222580beecf36e141fe6410184e8b1669119707"
timeStampNumber1669182016039
ownerListArray (String)["firma1epg9kx7nqz32dykj23p6jreqfh5x0wdy5a43qc"]
metaDataJsonStringString (JSON)'{"storage":"ipfs","encryptIpfsHash":["U2FsdGVkX19UsL3m7Cq2bOtTCQArqZTuLgz7mfdRtXM2MnIgm67GM26GtPELsVL8s4+IN2Vj9FbFzpFj3rwfaw=="]}'

Return value ​

json5
162019

5. Parameter Description ​

NameDescription
walletUnique wallet parameter created from the user’s Mnemonic.
This parameter can be called by using the Wallet.fromMnemonic function from the FirmaSDK module.
fileHashThis 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.
timeStampThis 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.
ownerListThis 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.
metaDataJsonStringThis 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.
txMiscThis object contains the gas fee that is deducted when a transaction is called upon.
* The default gas fee is set at 0.02fct.
paginationKeyThis 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.