diff --git a/docs.wrm/api/utils/abi/coder.wrm b/docs.wrm/api/utils/abi/coder.wrm index 6863f71d57..02c37bb582 100644 --- a/docs.wrm/api/utils/abi/coder.wrm +++ b/docs.wrm/api/utils/abi/coder.wrm @@ -42,7 +42,39 @@ _property: abiCoder.encode(types, values) => string<[[DataHexString]]> @ + +// Encoding with single variables and values +ethers.utils.defaultAbiCoder.encode(['uint256','string'], ['2345675643', 'Hello!%']); + +// Encoding with a custom struct and values +structExample = { + propertyOne: 42, + propertyTwo: 56, +} + +ethers.utils.defaultAbiCoder.encode( + [ + 'uint256', + { + type: "tuple[]", + name: "structExample", + components: [ + { name: "propertyOne", type: 'uint256' }, + { name: "propertyTwo", type: 'uint256' }, + ] + }, + ], + + [ + '2345675643', + [structExample] + ] + +); + + _property: abiCoder.decode(types, data) => [[Result]] @ @SRC Decode the //data// according to the array of //types//, each of which may be a -string or [[ParamType]]. +string or [[ParamType]]. \ No newline at end of file