> ## Documentation Index
> Fetch the complete documentation index at: https://developers.fireblocks.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://developers.fireblocks.com/feedback

```json
{
  "path": "/api-reference/contract-interactions/call-a-write-function-on-a-deployed-contract",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Call a write function on a deployed contract

> 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



## OpenAPI

````yaml https://docs.fireblocks.com/api/v1/swagger.yaml post /contract_interactions/base_asset_id/{baseAssetId}/contract_address/{contractAddress}/functions/write
openapi: 3.0.0
info:
  title: Fireblocks 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.6.2
  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: []
paths:
  /contract_interactions/base_asset_id/{baseAssetId}/contract_address/{contractAddress}/functions/write:
    post:
      tags:
        - Contract Interactions
      summary: Call a write function on a deployed contract
      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
      operationId: writeCallFunction
      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
          required: true
          in: path
          schema:
            type: string
      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'
      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);
components:
  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
  schemas:
    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
    WriteCallFunctionResponseDto:
      type: object
      properties:
        txId:
          type: string
      required:
        - txId
    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
    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
    ErrorSchema:
      type: object
      properties:
        message:
          type: string
        code:
          type: number
    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
          items:
            $ref: '#/components/schemas/Parameter'
      required:
        - name
        - type
    ParameterWithValue:
      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
          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
    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
    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
    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'
        outputs:
          description: The function outputs
          type: array
          items:
            $ref: '#/components/schemas/ParameterWithValue'
        stateMutability:
          type: string
          enum:
            - view
            - pure
            - nonpayable
            - payable
          example: nonpayable
          description: >-
            The state mutability of the function (e.g., view, pure, nonpayable,
            payable)
      required:
        - 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
  responses:
    Error:
      description: Error Response
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorSchema'
  headers:
    X-Request-ID:
      schema:
        type: string
      description: >-
        Unique ID correlated to the API request. Please provide it in any
        support ticket you create or on Github issues related to Fireblocks SDKs

````