From a1ebf75717e85aed9cf7c114b100a19e514a0fba Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 5 Mar 2014 16:18:44 -0300 Subject: [PATCH] migrate examples to soop --- README.md | 30 ++++++++++++++---------------- examples/Address.js | 2 +- examples/PeerManager.js | 7 +++---- examples/Rpc.js | 2 +- examples/SendTx.js | 13 ++++++------- examples/example.html | 2 +- 6 files changed, 26 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 351da25..09cd6f2 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ Bitcore runs on [node](http://nodejs.org/), and can be installed via [npm](https npm install bitcore ``` -It is a collection of objects useful to bitcoin applications; class-like idioms are enabled via [Classtool](https://github.com/gasteve/classtool). In most cases, a developer will require the object's class directly: +It is a collection of objects useful to bitcoin applications; class-like idioms are enabled via [Soop](https://github.com/gasteve/soop). In most cases, a developer will require the object's class directly: ``` -var Address = require('bitcore/Address').class(); +var Address = require('bitcore/Address'); ``` #Examples @@ -29,7 +29,7 @@ Some examples are provided at the [examples](/examples) path. Here are some snip ## Validating an address Validating a Bitcoin address: ```js -var Address = require('bitcore/Address').class(); +var Address = require('bitcore/Address'); var addrStrings = [ "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", @@ -57,10 +57,9 @@ For this example you need a running bitcoind instance with RPC enabled. ```js var util = require('util'); var networks = require('bitcore/networks'); -var Peer = require('bitcore/Peer').class(); -var PeerManager = require('bitcore/PeerManager').createClass({ - network: networks.testnet -}); +var Peer = require('bitcore/Peer'); +var PeerManager = require('soop').load('bitcore/PeerManager', + {network: networks.testnet}); var handleBlock = function(info) { @@ -109,14 +108,13 @@ PeerManager will emit the following events: 'version', 'verack', 'addr', 'getadd For this example you need a running bitcoind instance with RPC enabled. ```js var networks = require('bitcore/networks'); -var Peer = require('bitcore/Peer').class(); -var Transaction = require('bitcore/Transaction').class(); -var Address = require('bitcore/Address').class(); -var Script = require('bitcore/Script').class(); +var Peer = require('bitcore/Peer'); +var Transaction = require('bitcore/Transaction'); +var Address = require('bitcore/Address'); +var Script = require('bitcore/Script'); var coinUtil = require('bitcore/util/util'); -var PeerManager = require('bitcore/PeerManager').createClass({ - network: networks.testnet -}); +var PeerManager = require('soop').load('bitcore/PeerManager', + {network: networks.testnet}); var createTx = function() { @@ -185,7 +183,7 @@ peerman.start(); For this example you need a running bitcoind instance with RPC enabled. ```js var util = require('util'); -var RpcClient = require('bitcore/RpcClient').class(); +var RpcClient = require('bitcore/RpcClient'); var hash = process.argv[2] || '0000000000b6288775bbd326bedf324ca8717a15191da58391535408205aada4'; var config = { @@ -217,7 +215,7 @@ Check the list of all supported RPC call at [RpcClient.js](RpcClient.js) Gets an address strings from a ScriptPubKey Buffer ``` - var Address = require('bitcore/Address').class(); + var Address = require('bitcore/Address'); var coinUtil= require('bitcore/util/util'); var getAddrStr = function(s) { diff --git a/examples/Address.js b/examples/Address.js index f9679df..1cc0573 100644 --- a/examples/Address.js +++ b/examples/Address.js @@ -2,7 +2,7 @@ // Replace '..' with 'bitcore' if you plan on using this code elsewhere. -var Address = require('../Address').class(); +var Address = require('../Address'); var addrStrings = [ "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", diff --git a/examples/PeerManager.js b/examples/PeerManager.js index b089095..f3fc20c 100644 --- a/examples/PeerManager.js +++ b/examples/PeerManager.js @@ -4,10 +4,9 @@ var util = require('util'); var networks = require('../networks'); -var Peer = require('../Peer').class(); -var PeerManager = require('../PeerManager').createClass({ - network: networks.testnet -}); +var Peer = require('../Peer'); +var PeerManager = require('soop').load('../PeerManager', + {network: networks.testnet}); var handleBlock = function(info) { diff --git a/examples/Rpc.js b/examples/Rpc.js index e074991..ca4e12e 100644 --- a/examples/Rpc.js +++ b/examples/Rpc.js @@ -3,7 +3,7 @@ // Replace '..' with 'bitcore' if you plan on using this code elsewhere. var util = require('util'); -var RpcClient = require('../RpcClient').class(); +var RpcClient = require('../RpcClient'); var hash = process.argv[2] || '0000000000b6288775bbd326bedf324ca8717a15191da58391535408205aada4'; var config = { diff --git a/examples/SendTx.js b/examples/SendTx.js index c645673..da7e7bd 100644 --- a/examples/SendTx.js +++ b/examples/SendTx.js @@ -2,14 +2,13 @@ // Replace '..' with 'bitcore' if you plan on using this code elsewhere. var networks = require('../networks'); -var Peer = require('../Peer').class(); -var Transaction = require('../Transaction').class(); -var Address = require('../Address').class(); -var Script = require('../Script').class(); +var Peer = require('../Peer'); +var Transaction = require('../Transaction'); +var Address = require('../Address'); +var Script = require('../Script'); var coinUtil = require('../util/util'); -var PeerManager = require('../PeerManager').createClass({ - network: networks.testnet -}); +var PeerManager = require('soop').load('../PeerManager', + {network: networks.testnet}); var createTx = function() { diff --git a/examples/example.html b/examples/example.html index 21d7441..79438ee 100644 --- a/examples/example.html +++ b/examples/example.html @@ -16,7 +16,7 @@ div.innerHTML += s + '
'; }; - var Address = bitcore.Address.class(); + var Address = bitcore.Address; var addrStrings = [ "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",