이더리움(ethereum) 엔터프라이즈  dApp 개발환경인 truffle 5.0.0 beta가 출시되었다.

덩달아 web3.js의 1.0.0도 같이 나왔다.  

(하지만 2018년에는 아직까지는 비추이다.. 버그 존재)


https://github.com/trufflesuite/truffle/releases  (2018.8월 기준)



가장 큰 변화는 truffle test  시에 에러내역이 출시된다는 것이다. 


베타인 관계로 설치방법이 좀 다른데, 아래와 같이 설치가 가능하다.

npm uninstall -g truffle
npm install -g truffle@beta



그 외에 주요 변화는

1. truffle console에서도 await 이 된다. (async를 알아서 불러줘서, async없이도 await을 막 써도 되는 곳이 몇군데 있고) '

  심지어는 deploy에서도 await이 사용가능하다. 

 

 const One = artifacts.require("One");
 const Two = artifacts.require("Two");

 module.exports = async function(deployer) {
  await deployer.deploy(One);

  const one = await One.deployed();
  const value = await one.value();

  await deployer.deploy(Two, value);
};


2. BigNumber대신에 BN으로 대치되고, BN에서는 포맷설정이 가능하기 때문에 BigNumber도 계속 사용은 가능하다.


web3와 결합한 BN사용방식은 다음과 같다.

const stringBalance = await web3.eth.getBalance('0xabc..'); const bnBalance = web3.utils.toBN(stringBalance);




Posted by yongary
,