# Function Parameters

We will give multiple examples here of how you are supposed to pass the function parameters for different parameter types. It will help you figure out how you should format the data you have to provide when calling the smart contract function. The formatting is quite easy and straightforward and as a matter of fact, the first idea that comes up to your mind is probably the correct choice (other than maybe more complex scenarios when encoding structs).

### Example 1: Primitive types as parameters

👉🏻 Example function signatures:

```solidity
// Solidity Contract signatures
function myFunctionWithNoParameters() external view returns (uint256) {}
function myFunctionWithOneParameter(uint256 x) view returns (uint256) {}
function myFunctionWithTwoParameters(uint256 x, string memory y) view returns (uint256) {}
```

⚡️ How you call the functions using the SDK:

```typescript
const contractInstance; // fetched from sdk (explained in section before)

const function1Result = await contractInstance.read(
    'myFunctionWithNoParameters',    // solidity function name
    [ ]                              // empty array because because function accepts 0 parameters
);
const function2Result = await contractInstance.read(
    'myFunctionWithOneParameter',    // solidity function name
    [ 123 ]                              // one number passed as parameter
);
const function3Result = await contractInstance.read(
    'myFunctionWithOneParameter',    // solidity function name
    [ 123, 'test string' ]           // one number and one string passed as parameters
);
```

### Example 2: Arrays as parameters

👉🏻 Example function signature:

```solidity
// Solidity Contract signatures
function myFunction(uint256[] a, uint256[] b) external view returns (uint256) {}
```

⚡️ How you call the functions using the SDK:

```typescript
const contractInstance; // fetched from sdk (explained in section before)

const functionResult = await contractInstance.read(
    'myFunction',    // solidity function name
    [
        [1,2,3],     // first parameter: array of numbers
        [4,5,6]      // second parameter: array of numbers
    ]
);
```

### Example 3: Structs as parameters

👉🏻 Example function signature:

```solidity
// Solidity Contract signatures
struct DataPoint {
    string name;
    uint256 frequency;
    uint256 timestamp;
}
function myFunction(DataPoint memory point) external view returns (uint256) {}
```

⚡️ How you call the functions using the SDK:

```typescript
const contractInstance; // fetched from sdk (explained in section before)

const functionResult = await contractInstance.read(
    'myFunction',
    [
        [ 'random name', 13, 42 ]    // struct is encoded as an array of elements
    ]
);
```

### Example 4: Arrays of structs as parameters&#x20;

Now let's say the function from example above accepts not one but an array of elements of type `DataPoint`.

👉🏻 Example function signature:

```solidity
// Solidity Contract signatures
struct DataPoint {
    string name;
    uint256 frequency;
    uint256 timestamp;
}
function myFunction(DataPoint[] memory data) external view returns (uint256) {}
```

⚡️ How you call the functions using the SDK:

```typescript
const contractInstance; // fetched from sdk (explained in section before)

const functionResult = await contractInstance.read(
    'myFunction',
    [
        [ 'random name 1', 13, 42 ],    // first struct element
        [ 'random name 2', 22, 315 ],   // second struct element
        [ 'random name 3', 0, 1 ]       // third (and final) element in a list
    ]
);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dev3.sh/welcome-to-dev3/sdk/query-contracts/function-parameters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
