Comments (4)
Also, when writing the above-suggested test, make sure the return is as expected. We might have some parsing issues on the receiving end.
from hashgraph-venin-js.
Augmenting test to include a more urgent structure that we need to support:
struct NftBurn {
address collectionAddress;
int64[] serialNumbers;
}
with its reflection function to be tested:
function reflectNftBurns(NftBurn[] memory _nftBurns) public pure returns (NftBurn[] memory) {
return _nftBurns;
}
mapping input param _nftBurns
to JSON:
[
{
"name": "_nftBurns",
"type": "tuple[]",
"indexed": null,
"components": [
{
"name": "collectionAddress",
"type": "address",
"indexed": null,
"components": null,
"arrayLength": null,
"arrayChildren": null,
"baseType": "address",
"_isParamType": true
},
{
"name": "serialNumbers",
"type": "int64[]",
"indexed": null,
"components": null,
"arrayLength": -1,
"arrayChildren": {
"name": null,
"type": "int64",
"indexed": null,
"components": null,
"arrayLength": null,
"arrayChildren": null,
"baseType": "int64",
"_isParamType": true
},
"baseType": "array",
"_isParamType": true
}
],
"arrayLength": -1,
"arrayChildren": {
"name": null,
"type": "tuple",
"indexed": null,
"components": [
{
"name": "collectionAddress",
"type": "address",
"indexed": null,
"components": null,
"arrayLength": null,
"arrayChildren": null,
"baseType": "address",
"_isParamType": true
},
{
"name": "serialNumbers",
"type": "int64[]",
"indexed": null,
"components": null,
"arrayLength": -1,
"arrayChildren": {
"name": null,
"type": "int64",
"indexed": null,
"components": null,
"arrayLength": null,
"arrayChildren": null,
"baseType": "int64",
"_isParamType": true
},
"baseType": "array",
"_isParamType": true
}
],
"arrayLength": null,
"arrayChildren": null,
"baseType": "tuple",
"_isParamType": true
},
"baseType": "array",
"_isParamType": true
}
]
and associated jest test:
it("calling a live-contract function with complex objects that have addresses as leafs should be permitted", async () => {
const { liveContract } = await load("complex_struct_args");
const nftBurns = [{
collectionAddress: "",
serialNumbers: [1, 3, 5, 10],
}];
await expect(liveContract.reflectNftBurns(nftBurns)).resolves.toEqual(
nftBurns
);
});
from hashgraph-venin-js.
Things to pay attention to:
- If input-param is of type 'address' and argument is solidity-addressable, try to use that if it's not solidity-addressable, use the argument as is
- if input-param is of type 'bytes', yet arg is not Uint8Array, try to transform it (via 'arrayify')
- if input-param is of a numeric type that exceeds 64, then try to convert it to BigNumber if it isn't already converted
from hashgraph-venin-js.
Also, when writing the above-suggested test, make sure the return is as expected. We might have some parsing issues on the receiving end.
Will be handled by #96 . This ticket (#73) is only concerned with passing deep-nested object as smart contract method arguments.
from hashgraph-venin-js.
Related Issues (20)
- Bump hashgraph-sdk to version `2.17.1`
- Integrate `EthereumTransaction`'s into `LiveContract`'s HOT 1
- Access `LiveEntities` functionality through general purpose smart contracts integrated with Hedera Precompiled Contracts HOT 1
- `LiveContract` call fails when calling method with more arguments then expected
- Support ethereum typed bindings
- Relative-navigated `import`s don't work in `SolidityCompiler` -- `path` variant HOT 2
- Relative-navigated imports don't work in SolidityCompiler -- `code` fix
- Merge and extend `ApiSession.getLiveContract` and `ApiSession.getLiveJson`
- Update `LiveAccount` and `LiveContract` in accordance with HIP-367
- Update Strato Name HOT 1
- Rename all occurrences of the library name HOT 1
- Token Create fails with `INSUFFICIENT_TX_FEE`
- Fix `DeclarationError: Identifier already declared` HOT 1
- Fix absolute `import` path replacement for windows runtimes HOT 1
- Allow `LiveAccountWithPrivateKey` to generate `ApiSession`'s
- Remove `setMaxNodesPerTransaction` when defining `Client`
- Allow `LiveContract` creation from `FileId`s HOT 1
- Refactor testbase to consume `package.json` rezoluted modules HOT 1
- Make script to re-generate the solos
- Allow returning of deep-nested structures
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hashgraph-venin-js.