Closed jinqiao0423 closed 6 months ago
This issue is not fixed. Same error still occurs even after updating to v1.1.1:
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
at writeFile (node:fs:2108:5)
at go$writeFile (/Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/node_modules/graceful-fs/graceful-fs.js:138:14)
at Object.writeFile (/Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/node_modules/graceful-fs/graceful-fs.js:135:12)
at Object.writeFile (/Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/node_modules/universalify/index.js:5:67)
at /Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/src/services/remixdClient.js:108:24
at new Promise (
And please have a try importing any methods into a library from PowerAPI.sol or MinerAPI.sol, you can get the error upon flattening, i.e.
(int256 exitCode, PowerTypes.MinerRawPowerReturn memory result) = PowerAPI.minerRawPower(minerId);
(int256 exitCode, bool result) = MinerAPI.isControllingAddress(CommonTypes.FilActorId.wrap(minerId), ethAddress2FilAddress(addr));
(int256 exitCode, CommonTypes.BigInt memory result) = PowerAPI.networkRawPower();
@robertagora @bojinovic Please have a check
@jinqiao0423 I cannot recreate the error with your latest code snippet:
pragma solidity ^0.8.19;
import "filecoin-solidity-api/contracts/v0.8/MinerAPI.sol";
import "filecoin-solidity-api/contracts/v0.8/PowerAPI.sol";
library FilecoinAPI{
function foo(uint64 minerId) internal view{
MinerAPI.isControllingAddress(CommonTypes.FilActorId.wrap(minerId), CommonTypes.FilAddress(new bytes(1)));
PowerAPI.networkRawPower();
PowerAPI.minerRawPower(minerId);
}
}
The contract flattens without problems in pure Remix IDE online workspace, and with remixd.
Can you share more info about your complete setup?
Btw, where does ethAddress2FilAddress
(from the previous snippet) come from?
@jinqiao0423 I cannot recreate the error with your latest code snippet:
pragma solidity ^0.8.19; import "filecoin-solidity-api/contracts/v0.8/MinerAPI.sol"; import "filecoin-solidity-api/contracts/v0.8/PowerAPI.sol"; library FilecoinAPI{ function foo(uint64 minerId) internal view{ MinerAPI.isControllingAddress(CommonTypes.FilActorId.wrap(minerId), CommonTypes.FilAddress(new bytes(1))); PowerAPI.networkRawPower(); PowerAPI.minerRawPower(minerId); } }
The contract flattens without problems in pure Remix IDE online workspace, and with remixd.
Can you share more info about your complete setup?
Btw, where does
ethAddress2FilAddress
(from the previous snippet) come from?
After rechecking on my side it works. Actually I mistook the project folders.. Sorry for the inconvenience!
Hey guys! It seems that contract flattening would not work if I import files like filecoin-solidity-api/contracts/v0.8/PowerAPI.sol, or filecoin-solidity-api/contracts/v0.8/MinerAPI.sol
The following error would occur if I import either file above: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined at writeFile (node:fs:2108:5) at go$writeFile (/Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/node_modules/graceful-fs/graceful-fs.js:138:14) at Object.writeFile (/Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/node_modules/graceful-fs/graceful-fs.js:135:12) at Object.writeFile (/Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/node_modules/universalify/index.js:5:67) at /Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/src/services/remixdClient.js:108:24 at new Promise ()
at RemixdClient.set (/Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/src/services/remixdClient.js:91:20)
at Object. (/Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/node_modules/@remixproject/plugin/src/lib/connector.js:67:56)
at Generator.next ()
at /Users/qiaojin/.nvm/versions/node/v16.14.0/lib/node_modules/@remix-project/remixd/node_modules/tslib/tslib.js:114:75 {
code: 'ERR_INVALID_ARG_TYPE'
}
remixd version: 0.6.23 / 0.6.26