Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick fix - Refine ABI Data Encoding #1821

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions src/content/chainlink-functions/tutorials/abi-decoding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -272,19 +272,8 @@ const complexData = {
// Define the Solidity types for encoding
const types = ["tuple(uint256 id, tuple(string description, bool awesome) metadata)"]

// Data to encode
const data = [
[
complexData.id,
{
description: complexData.metadata.description,
awesome: complexData.metadata.awesome,
},
],
]

// Encoding the data
const encodedData = abiCoder.encode(types, data)
const encodedData = abiCoder.encode(types, [complexData])
```

After encoding the data, it's necessary to format it as a `Uint8Array` array for smart contract interactions and blockchain transactions. In Solidity, the data type for byte arrays data is `bytes`. However, when working in a JavaScript environment, such as when using the `ethers.js` library, the equivalent data structure is a `Uint8Array`.
Expand Down
Loading