github.com/igggame/nebulas-go@v2.1.0+incompatible/nf/nvm/test/test_blockchain_1.0.5.js (about) 1 // Copyright (C) 2018 go-nebulas authors 2 // 3 // This file is part of the go-nebulas library. 4 // 5 // the go-nebulas library is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // the go-nebulas library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with the go-nebulas library. If not, see <http://www.gnu.org/licenses/>. 17 // 18 19 'use strict'; 20 21 if (typeof _native_blockchain === "undefined") { 22 throw new Error("_native_blockchain is undefined."); 23 } 24 25 var ok = Blockchain.transfer("n1FF1nz6tarkDVwWQkMnnwFPuPKUaQTdptE", "1"); 26 console.log("transfer:" + ok) 27 28 var result = Blockchain.verifyAddress("n1FF1nz6tarkDVwWQkMnnwFPuPKUaQTdptE"); 29 console.log("verifyAddress:" + result) 30 31 try { 32 Blockchain.transfer("n1FF1nz6tarkDVwWQkMnnwFPuPKUaQTdptE", -1); 33 } catch (err) { 34 if (err.message !== "invalid value" ) { 35 throw err; 36 } 37 } 38 try { 39 Blockchain.transfer("n1FF1nz6tarkDVwWQkMnnwFPuPKUaQTdptE", NaN); 40 } catch (err) { 41 if (err.message !== "invalid value" ) { 42 throw err; 43 } 44 } 45 try { 46 Blockchain.transfer("n1FF1nz6tarkDVwWQkMnnwFPuPKUaQTdptE", Infinity); 47 } catch (err) { 48 if (err.message !== "invalid value" ) { 49 throw err; 50 } 51 }