View atomic.swap.txt
---
Cryptocoins — Atomic Swap
Built by traders, for traders.
Só para avisar que essa é a primeira parte desse artigo onde eu apenas farei analogias para o melhor entendimento da mesma, na parte 2 eu abordarei APENAS a parte técnica envolvida nessa tecnologia.
Primeira Exchange, que EU conheço, que irá trabalhar com essa tecnologia é:
Altcoin.io - Decentralized Cyptocurrency Exchange
Altcoin.io Exchange referral program. Earn commission for each person who signs up through your link!www.altcoin.io
O que que vcs acham dessa exchange? 
Acredito que vai dar boa hein!
View cotacoes.altcoins.js
const axios = require( 'axios' )
const COIN = process.argv.reverse()[0].toUpperCase()
console.log('------------------------------------');
console.log(COIN);
console.log('------------------------------------');
const EXCHANGE_URL = 'https://www.mercadobitcoin.net/api/BTC/ticker/'
const COINMARKETCAP_URL = `https://api.coinmarketcap.com/v1/ticker/bitcoin/${COIN}`
const DOLLAR_URL = 'http://api.promasters.net.br/cotacao/v1/valores?moedas=USD&alt=json'
View getTicker.mercadobitcoin.js
const axios = require( 'axios' )
const EXCHANGE_URL = 'https://www.mercadobitcoin.net/api/BTC/ticker/'
const COINMARKETCAP_URL = 'https://api.coinmarketcap.com/v1/ticker/bitcoin/'
const DOLLAR_URL = 'http://api.promasters.net.br/cotacao/v1/valores?moedas=USD&alt=json'
const transformMoney = ( dollar ) => ( reais ) =>
Number( reais / dollar )
const getURL = ( url ) => axios.get( url )
View $.07.js
const $$ = ( selector, context = document ) =>
( selector[ 0 ] === '#' ) // OU COM REGEX?
? document.getElementById( selector )
: context.querySelectorAll( selector )
$$( '#myjQuery' ).innerHTML = $$( 'div' ).length
$( '#jQuery' ).innerHTML = $( 'div' ).length
View $.05.sem.regex.id.js
const $$ = ( selector, context = document ) => {
const elements = context.querySelectorAll( selector )
( selector[ 0 ] === '#' ) // OU COM REGEX?
? elements[ 0 ]
: elements
}
$$( '#myjQuery' ).innerHTML = $$( 'div' ).length
$( '#jQuery' ).innerHTML = $( 'div' ).length
View $.05.sem.regex.js
const $$ = ( selector, context = document ) => {
const elements = context.querySelectorAll( selector )
return ( selector[ 0 ] === '#' )
? elements[ 0 ]
: elements
}
$$( '#myjQuery' ).innerHTML = $$( 'div' ).length
$( '#jQuery' ).innerHTML = $( 'div' ).length
View $.parte01.js
const $$ = ( selector, context = document ) => {
const regex = /^#/g
const elements = [ ...context.querySelectorAll( selector ) ]
return ( regex.test( selector ) )
? elements[ 0 ]
: elements
}
View split.spread.string.js
const $$ = ( selector, context = document ) =>
Array.prototype.slice.call( context.querySelectorAll( selector ) )
$$( '.myjQuery' )[ 0 ].innerHTML = [ ...'suissa' ]
$( '.jQuery' )[ 0 ].innerHTML = 'suissa'.split( '' )
View list.Array.prototype.slice.call.js
function list() {
return Array.prototype.slice.call(arguments)
}
list( 1, 2, 3 ) // [1, 2, 3]
View Array.call.js
const $$ = ( selector, context = document ) =>
Array.prototype.slice.call( context.querySelectorAll( selector ) )
$$( '.myjQuery' )[ 0 ].innerHTML = $$( 'div' ).length