This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const last = require('it-last') | |
const crypto = require('libp2p-crypto') | |
const { BITBOX } = require('bitbox-sdk') | |
const bitbox = new BITBOX() | |
const PeerId = require('peer-id') | |
const CID = require('cids') | |
//Recipient should convert a scriptSig of the UTXO sent to their address | |
function blockchainIpnsFetch(ipfs, scriptSig) { | |
//Extract public key from script signature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/libp2p/js-libp2p/blob/707bd7843c5b05a70916055015e3f483cc385759/src/circuit/circuit/stream-handler.js | |
import StreamHandler from "./stream-handler.js"; | |
//https://github.com/libp2p/js-libp2p/blob/707bd7843c5b05a70916055015e3f483cc385759/src/circuit/protocol/index.proto | |
import CircuitPB from "./circuit-pb.js"; | |
import PeerId from "peer-id"; | |
import { Multiaddr } from "multiaddr"; | |
import toConnection from "libp2p-utils/src/stream-to-ma-conn.js"; | |
const PROTOCOL = "/libp2p/circuit/relay/0.1.0"; | |
export default async function getCircuitRelay( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Usage | |
const client = websocketOverLibp2p("/ip4/xxx.xx/tcp/xxx/ws", "/x/electrum") | |
const getBlocks = () => { | |
client.send( | |
JSON.stringify({ | |
method: "blockchain.scripthash.listunspent", | |
params: [ | |
"60e518016f265ca054e7044b818b3438d2886138c15cc7563f24bbe29e0cca91", | |
], | |
id: 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.config(function($stateProvider) { | |
$stateProvider.decorator('views', function(state, parent) { | |
return state.mapStateToResolve ? mapStateToResolve(parent(state)) : parent(state); | |
}); | |
//Update resolves with mapStateToResolve resolvers, will return from reduxHelper | |
//TODO: If resolve already exists, use it as initial state? | |
function mapStateToResolve(views) { | |