fireblocks Contract Interactions API

The Contract Interactions API from fireblocks — 4 operation(s) for contract interactions.

OpenAPI Specification

fireblocks-contract-interactions-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Fireblocks Blockchains and Assets Approval Requests Contract Interactions API
  description: 'Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain.


    - Visit our website for more information: [Fireblocks Website](https://fireblocks.com)

    - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)

    '
  version: 1.8.0
  contact:
    email: developers@fireblocks.com
servers:
- url: https://api.fireblocks.io/v1
  description: Fireblocks Production Environment Base URL
- url: https://sandbox-api.fireblocks.io/v1
  description: Fireblocks Sandbox Environment Base URL
security: []
tags:
- name: Contract Interactions
paths:
  /contract_interactions/base_asset_id/{baseAssetId}/contract_address/{contractAddress}/functions:
    get:
      operationId: getDeployedContractAbi
      summary: Return deployed contract's ABI
      description: 'Return deployed contract''s ABI by blockchain native asset id and contract address.

        </br>Endpoint Permission: Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, and Viewer.'
      parameters:
      - $ref: '#/components/parameters/X-Idempotency-Key'
      - name: contractAddress
        required: true
        in: path
        description: The contract's onchain address
        example: '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
        schema:
          type: string
      - name: baseAssetId
        description: The blockchain base assetId
        required: true
        in: path
        example: ETH
        schema:
          type: string
      x-readme:
        code-samples:
        - language: javascript
          code: const deployedContractAbi = await fireblocks.getContractAbi(baseAssetId, contractAddress);
          name: Fireblocks SDK Javascript example
        - language: typescript
          code: 'const response: Promise<FireblocksResponse<ContractAbiResponseDto>> = fireblocks.contractInteractions.getDeployedContractAbi(contractInteractionsApiGetDeployedContractAbiRequest);'
          name: Fireblocks SDK TypeScript example
        - language: java
          code: CompletableFuture<ApiResponse<ContractAbiResponseDto>> response = fireblocks.contractInteractions().getDeployedContractAbi(contractAddress, baseAssetId, idempotencyKey);
          name: Fireblocks SDK Java example
        - language: python
          code: response = fireblocks.contract_interactions.get_deployed_contract_abi(contract_address, base_asset_id, idempotency_key);
          name: Fireblocks SDK Python example
      responses:
        '200':
          description: Contract ABI response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractAbiResponseDto'
        default:
          $ref: '#/components/responses/Error'
      tags:
      - Contract Interactions
      x-codeSamples:
      - lang: TypeScript
        source: 'const response: Promise<FireblocksResponse<ContractAbiResponseDto>> = fireblocks.contractInteractions.getDeployedContractAbi(contractInteractionsApiGetDeployedContractAbiRequest);'
      - lang: Java
        source: CompletableFuture<ApiResponse<ContractAbiResponseDto>> response = fireblocks.contractInteractions().getDeployedContractAbi(contractAddress, baseAssetId, idempotencyKey);
      - lang: Python
        source: response = fireblocks.contract_interactions.get_deployed_contract_abi(contract_address, base_asset_id, idempotency_key);
  /contract_interactions/base_asset_id/{baseAssetId}/contract_address/{contractAddress}/functions/read:
    post:
      operationId: readCallFunction
      summary: Call a read function
      description: 'Call a read function on a deployed contract by blockchain native asset id and contract address.

        </br>Endpoint Permission: Endpoint Permission: Owner, Admin, Non-Signing Admin, Signer, and Editor.'
      parameters:
      - $ref: '#/components/parameters/X-Idempotency-Key'
      - name: contractAddress
        required: true
        in: path
        description: The contract's onchain address
        example: '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
        schema:
          type: string
      - name: baseAssetId
        description: The blockchain base assetId
        required: true
        in: path
        example: ETH
        schema:
          type: string
      x-readme:
        code-samples:
        - language: javascript
          code: const readResponse= await fireblocks.readContractCallFunction(baseAssetId, contractAddress, payload);
          name: Fireblocks SDK Javascript example
        - language: typescript
          code: 'const response: Promise<FireblocksResponse<ParameterWithValueList>> = fireblocks.contractInteractions.readCallFunction(contractInteractionsApiReadCallFunctionRequest);'
          name: Fireblocks SDK TypeScript example
        - language: java
          code: CompletableFuture<ApiResponse<List<ParameterWithValue>>> response = fireblocks.contractInteractions().readCallFunction(readCallFunctionDto, contractAddress, baseAssetId, idempotencyKey);
          name: Fireblocks SDK Java example
        - language: python
          code: response = fireblocks.contract_interactions.read_call_function(read_call_function_dto, contract_address, base_asset_id, idempotency_key);
          name: Fireblocks SDK Python example
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReadCallFunctionDto'
      responses:
        '200':
          description: Read Call Retrieved Successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParameterWithValueList'
        default:
          $ref: '#/components/responses/Error'
      tags:
      - Contract Interactions
      x-codeSamples:
      - lang: TypeScript
        source: 'const response: Promise<FireblocksResponse<ParameterWithValueList>> = fireblocks.contractInteractions.readCallFunction(contractInteractionsApiReadCallFunctionRequest);'
      - lang: Java
        source: CompletableFuture<ApiResponse<List<ParameterWithValue>>> response = fireblocks.contractInteractions().readCallFunction(readCallFunctionDto, contractAddress, baseAssetId, idempotencyKey);
      - lang: Python
        source: response = fireblocks.contract_interactions.read_call_function(read_call_function_dto, contract_address, base_asset_id, idempotency_key);
  /contract_interactions/base_asset_id/{baseAssetId}/contract_address/{contractAddress}/functions/write:
    post:
      operationId: writeCallFunction
      summary: Call a write function
      description: 'Call a write function on a deployed contract by blockchain native asset id and contract address. This creates an onchain transaction, thus it is an async operation. It returns a transaction id that can be polled for status check.


        </br>Endpoint Permission: Owner, Admin, Non-Signing Admin, Signer, and Editor.'
      parameters:
      - $ref: '#/components/parameters/X-Idempotency-Key'
      - name: contractAddress
        required: true
        in: path
        description: The contract's onchain address
        example: '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
        schema:
          type: string
      - name: baseAssetId
        description: The blockchain base assetId
        required: true
        in: path
        example: ETH
        schema:
          type: string
      x-readme:
        code-samples:
        - language: javascript
          code: const writeFunctionResponse = await fireblocks.writeContractCallFunction(baseAssetId, contractAddress, payload);
          name: Fireblocks SDK Javascript example
        - language: typescript
          code: 'const response: Promise<FireblocksResponse<WriteCallFunctionResponseDto>> = fireblocks.contractInteractions.writeCallFunction(contractInteractionsApiWriteCallFunctionRequest);'
          name: Fireblocks SDK TypeScript example
        - language: java
          code: CompletableFuture<ApiResponse<WriteCallFunctionResponseDto>> response = fireblocks.contractInteractions().writeCallFunction(writeCallFunctionDto, contractAddress, baseAssetId, idempotencyKey);
          name: Fireblocks SDK Java example
        - language: python
          code: response = fireblocks.contract_interactions.write_call_function(write_call_function_dto, contract_address, base_asset_id, idempotency_key);
          name: Fireblocks SDK Python example
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WriteCallFunctionDto'
      responses:
        '202':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WriteCallFunctionResponseDto'
        default:
          $ref: '#/components/responses/Error'
      tags:
      - Contract Interactions
      x-codeSamples:
      - lang: TypeScript
        source: 'const response: Promise<FireblocksResponse<WriteCallFunctionResponseDto>> = fireblocks.contractInteractions.writeCallFunction(contractInteractionsApiWriteCallFunctionRequest);'
      - lang: Java
        source: CompletableFuture<ApiResponse<WriteCallFunctionResponseDto>> response = fireblocks.contractInteractions().writeCallFunction(writeCallFunctionDto, contractAddress, baseAssetId, idempotencyKey);
      - lang: Python
        source: response = fireblocks.contract_interactions.write_call_function(write_call_function_dto, contract_address, base_asset_id, idempotency_key);
  /contract_interactions/base_asset_id/{baseAssetId}/tx_hash/{txHash}/receipt:
    get:
      operationId: getTransactionReceipt
      summary: Get transaction receipt
      description: 'Retrieve the transaction receipt by blockchain native asset ID and transaction hash


        </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, and Viewer.'
      parameters:
      - name: baseAssetId
        required: true
        in: path
        description: The blockchain base assetId
        example: ETH_TEST6
        schema:
          type: string
      - name: txHash
        required: true
        in: path
        description: The transaction hash
        example: '0x3b015ca0518c55d7bff4e3f5aa5d0431705771553ba8a95cf20e34cb597f57f6'
        schema:
          type: string
      x-readme:
        code-samples:
        - language: javascript
          code: const transactionReceipt = await fireblocks.getTransactionReceipt(baseAssetId, txHash);
          name: Fireblocks SDK Javascript example
        - language: typescript
          code: 'const response: Promise<FireblocksResponse<TransactionReceiptResponse>> = fireblocks.contractInteractions.getTransactionReceipt(contractInteractionsApiGetTransactionReceiptRequest);'
          name: Fireblocks SDK TypeScript example
        - language: java
          code: CompletableFuture<ApiResponse<TransactionReceiptResponse>> response = fireblocks.contractInteractions().getTransactionReceipt(baseAssetId, txHash);
          name: Fireblocks SDK Java example
        - language: python
          code: response = fireblocks.contract_interactions.get_transaction_receipt(base_asset_id, tx_hash);
          name: Fireblocks SDK Python example
      responses:
        '200':
          description: Retrieved The Transaction Receipt Successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionReceiptResponse'
        default:
          $ref: '#/components/responses/Error'
      tags:
      - Contract Interactions
      x-codeSamples:
      - lang: TypeScript
        source: 'const response: Promise<FireblocksResponse<TransactionReceiptResponse>> = fireblocks.contractInteractions.getTransactionReceipt(contractInteractionsApiGetTransactionReceiptRequest);'
      - lang: Java
        source: CompletableFuture<ApiResponse<TransactionReceiptResponse>> response = fireblocks.contractInteractions().getTransactionReceipt(baseAssetId, txHash);
      - lang: Python
        source: response = fireblocks.contract_interactions.get_transaction_receipt(base_asset_id, tx_hash);
components:
  schemas:
    ReadCallFunctionDto:
      type: object
      properties:
        abiFunction:
          example:
            inputs: []
            stateMutability: view
            type: function
            name: decimals
            outputs:
            - name: ''
              type: uint8
              internalType: uint8
          description: The abi of the read function you wish to call
          type: object
          $ref: '#/components/schemas/ReadAbiFunction'
      required:
      - abiFunction
    ContractAbiResponseDto:
      type: object
      properties:
        abi:
          example:
          - inputs:
            - internalType: address
              name: implementation
              type: address
            - internalType: bytes
              name: _data
              type: bytes
            stateMutability: nonpayable
            type: constructor
          description: The abi of the contract
          type: array
          items:
            $ref: '#/components/schemas/AbiFunction'
        implementationAbi:
          example:
          - inputs:
            - internalType: address
              name: to
              type: address
            - internalType: uint256
              name: amount
              type: uint256
            stateMutability: nonpayable
            type: function
            name: mint
          description: The abi of the implementation contract if exists. Relevant only for proxy patterns
          type: array
          items:
            $ref: '#/components/schemas/AbiFunction'
      required:
      - abi
    TransactionReceiptResponse:
      type: object
      properties:
        blockHash:
          type: string
          description: The block hash
          example: '0x6e3c92a3d96f96e46b7f39c30244edb6e8e0f4b65d3846c9f8287f9dd5d1a3d2'
        blockNumber:
          type: integer
          description: The block number
          example: 123456
        contractAddress:
          type: string
          description: The address of deployed contract
          example: '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
          nullable: true
        cumulativeGasUsed:
          type: integer
          description: The cumulative gas used in the transaction
          example: 21000
        effectiveGasPrice:
          type: integer
          description: The effective gas price
          example: 1000000000
        from:
          type: string
          description: Sender address
          example: '0xa7D9ddBE1f17865597Fbd27ec712455208B6b76D'
        gasUsed:
          type: integer
          description: Gas used by the transaction
          example: 21000
        logs:
          type: array
          items:
            $ref: '#/components/schemas/TxLog'
          description: Array of transaction logs
        logsBloom:
          type: string
          description: Logs bloom filter
          example: '0x0000000000000000000000000000000000000000000000000000000000000000'
        status:
          type: integer
          description: Transaction status (1 for success, 0 for failure)
          example: 1
        to:
          type: string
          description: Recipient address
          example: '0x1eC4a8bB9bB9Afa24f79cC2e1423cD00B6cFf50'
          nullable: true
        transactionHash:
          type: string
          description: The transaction hash
          example: '0x5a3b7f4b2c9e4a0b1f8a12c8e5f1d0e2a6b4c9d1f7e2b1a2b3c4d5e6f7a8b9c'
        transactionIndex:
          type: integer
          description: Transaction index in the block
          example: 3
        type:
          type: string
          description: Type of transaction
          example: '0x2'
      required:
      - blockHash
      - blockNumber
      - cumulativeGasUsed
      - effectiveGasPrice
      - from
      - gasUsed
      - logs
      - logsBloom
      - status
      - transactionHash
      - transactionIndex
      - type
    ParameterWithValue:
      type: object
      properties:
        name:
          type: string
          example: Some Name
          description: The name of the parameter as it appears in the ABI
        description:
          type: string
          example: The name of the token
          description: A description of the parameter, fetched from the devdoc of this contract
        internalType:
          type: string
          example: string
          description: The  internal type of the parameter as it appears in the ABI
        type:
          type: string
          example: string
          description: The type of the parameter as it appears in the ABI
        components:
          type: array
          items:
            $ref: '#/components/schemas/Parameter'
        value:
          example: 'true'
          description: The value of the parameter. can also be ParameterWithValue
          type: string
        functionValue:
          description: The function value of this param (if has one). If this is set, the `value` shouldn`t be. Used for proxies
          allOf:
          - $ref: '#/components/schemas/LeanAbiFunction'
      required:
      - name
      - type
    WriteAbiFunction:
      type: object
      properties:
        stateMutability:
          type: string
          enum:
          - payable
          - nonpayable
          example: nonpayable
        outputs:
          type: array
          items:
            $ref: '#/components/schemas/Parameter'
        type:
          type: string
          enum:
          - function
        name:
          type: string
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/ParameterWithValue'
        description:
          type: string
      required:
      - stateMutability
      - type
      - inputs
    ParameterWithValueList:
      type: array
      items:
        $ref: '#/components/schemas/ParameterWithValue'
    SolParameterWithValue:
      type: object
      properties:
        value:
          type: string
          description: The value of the parameter
          example: '1000000'
        name:
          type: string
          description: The name of the parameter
          example: mint
        type:
          $ref: '#/components/schemas/IdlType'
      required:
      - name
      - type
      - value
    SolanaInstructionWithValue:
      type: object
      properties:
        name:
          type: string
          description: The name of the instruction
          example: approve
        discriminator:
          type: array
          items:
            type: number
          description: The discriminator for the instruction. Acts as a function selector
          example:
          - 13
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/SOLAccountWithValue'
        args:
          type: array
          description: The arguments of the instruction
          items:
            $ref: '#/components/schemas/SolParameterWithValue'
      required:
      - name
      - discriminator
      - accounts
      - args
    SOLAccountWithValue:
      type: object
      properties:
        name:
          type: string
          description: The name of the account
          example: mint
        signer:
          type: boolean
          description: Indicates if the account needs to sign the instruction. If true a signature for this account must be provided
          example: false
        writable:
          type: boolean
          description: Indicates if the account's data can be changed by the instruction.
          example: true
        address:
          type: string
          description: The address of the account
          example: 4PVcDXAkAgQkVx4puiSXdZ5H8BrTqUzstJBKKWFy3XsH
      required:
      - name
      - address
    ReadAbiFunction:
      type: object
      properties:
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/ParameterWithValue'
        stateMutability:
          type: string
          enum:
          - pure
          - view
        type:
          type: string
        name:
          type: string
        outputs:
          type: array
          items:
            $ref: '#/components/schemas/Parameter'
        description:
          type: string
      required:
      - stateMutability
      - type
      - inputs
    WriteCallFunctionDto:
      type: object
      properties:
        vaultAccountId:
          type: string
          example: '0'
          description: The vault account id this contract was deploy from
        abiFunction:
          oneOf:
          - $ref: '#/components/schemas/WriteAbiFunction'
          - $ref: '#/components/schemas/SolanaInstructionWithValue'
        amount:
          type: string
          description: Amount in base asset. Being used in payable functions
          example: '12.345'
        feeLevel:
          enum:
          - LOW
          - MEDIUM
          - HIGH
          type: string
          description: Fee level for the write function transaction. interchangeable with the 'fee' field
          example: MEDIUM
        fee:
          type: string
          description: Max fee amount for the write function transaction. interchangeable with the 'feeLevel' field
          example: '2000'
        note:
          type: string
          description: Custom note, not sent to the blockchain, that describes the transaction at your Fireblocks workspace
        useGasless:
          type: boolean
          example: false
          description: Indicates whether the token should be created in a gasless manner, utilizing the ERC-2771 standard. When set to true, the transaction will be relayed by a designated relayer. The workspace must be configured to use Fireblocks gasless relay.
        externalId:
          type: string
          description: External id that can be used to identify the transaction in your system. The unique identifier of the transaction outside of Fireblocks with max length of 255 characters
          example: 0192e4f5-924e-7bb9-8e5b-c748270feb38
      required:
      - vaultAccountId
      - abiFunction
    Parameter:
      type: object
      properties:
        name:
          type: string
          example: _name
          description: The name of the parameter as it appears in the ABI
        description:
          type: string
          example: The name of the token
          description: A description of the parameter, fetched from the devdoc of this contract
        internalType:
          type: string
          example: string
          description: The internal type of the parameter as it appears in the ABI
        type:
          type: string
          example: string
          description: The type of the parameter as it appears in the ABI
        components:
          type: array
          description: In case it’s a struct, it will hold the struct data
      required:
      - name
      - type
    AbiFunction:
      type: object
      properties:
        name:
          type: string
          example: mint
          description: The name of the contract function as it appears in the ABI
        stateMutability:
          type: string
          example: pure
          enum:
          - pure
          - view
          - nonpayable
          - payable
          description: The state mutability of the contract function as it appears in the ABI
        type:
          type: string
          example: constructor
          description: The type if the function
          enum:
          - function
          - constructor
        inputs:
          description: The parameters that this function/constructor posses
          items:
            $ref: '#/components/schemas/Parameter'
          type: array
        outputs:
          description: The parameters that this 'read' function returns
          items:
            $ref: '#/components/schemas/Parameter'
          type: array
        description:
          type: string
          description: The documentation of this function (if has any)
      required:
      - type
      - inputs
    IdlType:
      type: string
      enum:
      - bool
      - u8
      - i8
      - u16
      - i16
      - u32
      - i32
      - f32
      - u64
      - i64
      - f64
      - u128
      - i128
      - u256
      - i256
      - bytes
      - string
      - pubkey
      description: The type of the parameter
      example: u8
    LeanAbiFunction:
      type: object
      properties:
        name:
          type: string
          example: initialize
          description: The function name
        inputs:
          description: The function inputs
          type: array
          items:
            $ref: '#/components/schemas/ParameterWithValue'
      required:
      - inputs
    WriteCallFunctionResponseDto:
      type: object
      properties:
        txId:
          type: string
          example: b70701f4-d7b1-4795-a8ee-b09cdb5b850d
          description: The Fireblocks transaction id of the function call
      required:
      - txId
    TxLog:
      type: object
      properties:
        address:
          type: string
          description: The log address
          example: '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
        topics:
          type: array
          items:
            type: string
          description: Array of log topics
          example:
          - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
          - '0x000000000000000000000000a7d9ddbe1f17865597fbd27ec712455208b6b76d'
          - '0x000000000000000000000000c2c4e1db41f0bb97996d0ed0542d2170d146fb66'
        data:
          type: string
          description: The log data
          example: '0x000000000000000000000000000000000000000000000000000000000000000a'
        blockNumber:
          type: integer
          description: Block number where the log occurred
          example: 123456
        transactionHash:
          type: string
          description: Transaction hash associated with the log
          example: '0x5a3b7f4b2c9e4a0b1f8a12c8e5f1d0e2a6b4c9d1f7e2b1a2b3c4d5e6f7a8b9c'
        transactionIndex:
          type: integer
          description: Transaction index in the block
          example: 2
        blockHash:
          type: string
          description: The hash of the block
          example: '0x6e3c92a3d96f96e46b7f39c30244edb6e8e0f4b65d3846c9f8287f9dd5d1a3d2'
        logIndex:
          type: integer
          description: Log index in the block
          example: 1
        removed:
          type: boolean
          description: Indicates if the log was removed
          example: false
      required:
      - address
      - topics
      - data
      - blockNumber
      - transactionHash
      - transactionIndex
      - blockHash
      - logIndex
      - removed
  responses:
    Error:
      description: Error Response
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorSchema'
  parameters:
    X-Idempotency-Key:
      name: Idempotency-Key
      in: header
      description: A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours.
      required: false
      schema:
        type: string
        example: some-unique-id
  securitySchemes:
    bearerTokenAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key