Skip to content

Commit

Permalink
Merge pull request #114 from axieinfinity/feature/wallet-config
Browse files Browse the repository at this point in the history
feat(WalletConfig): remove reading 1Password in script
  • Loading branch information
TuDo1403 authored Mar 1, 2024
2 parents c00b68e + 83c18e0 commit 3ea3b21
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions script/configs/WalletConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -151,28 +151,18 @@ abstract contract WalletConfig is CommonBase, IWalletConfig {
_envSender = vm.rememberKey(_loadENVPrivateKey(envLabel));
}

function _loadENVPrivateKey(string memory envLabel) private returns (uint256) {
function _loadENVPrivateKey(string memory envLabel) private view returns (uint256) {
try vm.envUint(envLabel) returns (uint256 pk) {
return pk;
} catch {
string[] memory commandInput = new string[](3);

try vm.envString(envLabel) returns (string memory data) {
commandInput[2] = data;
} catch {
revert(
string.concat(
"\nGeneralConfig: Error finding env address!\n- Please make `.env` file and create field `",
envLabel,
"=",
"{op_secret_reference_or_your_private_key}`"
)
);
}
commandInput[0] = "op";
commandInput[1] = "read";

return vm.parseUint(vm.toString(vm.ffi(commandInput)));
revert(
string.concat(
"\nGeneralConfig: Error finding env address!\n- Please make `.env` file and create field `",
envLabel,
"=",
"{op_secret_reference_or_your_private_key}`"
)
);
}
}
}

0 comments on commit 3ea3b21

Please sign in to comment.