How to read a List
from a data source context?
#2025
-
The docs mention the possibility of defining an item of type dataSources:
- kind: ethereum/contract
name: ContractName
network: mainnet
context:
list_example:
type: List
data:
- type: "BigInt"
data: "1"
- type: "BigInt
data: "2"
- type: "BigInt"
data: "3" But there is no guidance provided for how to read that list in an AssemblyScript mapping. I wrote it like this but I'm not sure if it's correct: export function getStringArray(key: string): string[] {
const context = dataSource.context();
const value = context.get("list_example");
return value!.toStringArray();
} Can anyone from Edge & Node please confirm this? |
Beta Was this translation helpful? Give feedback.
Answered by
shiyasmohd
May 29, 2025
Replies: 1 comment 1 reply
-
@PaulRBerg here is an example to use list datasource context
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
PaulRBerg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@PaulRBerg here is an example to use list datasource context