49 Commits

Author SHA1 Message Date
tomFlowee bbe0a4a438 Allow output from parseAddress to be used in subscribe call 2021-04-03 20:35:42 +02:00
tomFlowee 1255aa6ccb Process address subscription in bulk when possible 2021-04-03 17:59:48 +02:00
tomFlowee 21836f1653 Support fetching fees for a transaction directly
Only on a Hub that enabled it, though
2021-03-18 12:32:59 +01:00
tomFlowee 291dedfa30 This adds several features.
* message sending now allows arrays.
The underlying engine allows more than the JS allowed, this has been
fixed.
Specifically we now allow something like:
  message.body[45] = ["first", "second"];

* A new helper method is exposed to JavaScript: parseAddress()
This method allows one to parse Bitcoin addresses and return the
script-hash used elsewhere.
Notice that the second argument is an optional prefix, allowing for
parsing of testnet addresses.
2021-02-26 19:37:16 +01:00
tomFlowee f4fb05cd6b Also cancel any promises open on shutdown. 2021-02-20 11:04:15 +01:00
tomFlowee 48caa5a806 Avoid empty object. 2021-02-19 19:55:51 +01:00
tomFlowee 326a3f4188 Support the new API for chainChanged: blocksRemoved. 2021-02-19 19:18:03 +01:00
tomFlowee 77b917e040 Fix copy/paste bug. 2021-02-19 18:22:53 +01:00
tomFlowee 7fb2ba0c48 Fix memory usage of pools.
This follows a refactor in flowee-libs, we make the reserve amount
mandatory to be called, since its too easy to forget to reserve.
2021-02-18 09:51:31 +01:00
tomFlowee d96c30522c Fixes 2021-02-17 21:41:30 +01:00
tomFlowee 525ef09b64 Warp callbacks in unique_ptrs
The NodeJS APis break expected contracts with regards to the
Napi::ThreadSafeFunction and that makes them not work as a normal
object.
Using new / delete on them works much better and allows the user
to re-assign a callback to a new value.
2021-02-17 21:02:06 +01:00
tomFlowee 2abc367ca3 Fix signed/unsigned issue
When the server sent a negative number we
accidentally converted that to an unsigned long.
2021-02-17 15:34:52 +01:00
tomFlowee 5fa02dae3e Support server option IncludeOutputScriptHash 2021-02-17 15:33:55 +01:00
tomFlowee b63b385a0c Remove debug code 2021-02-16 17:30:38 +01:00
tomFlowee 097a7c6f12 Be consistent in our assigning of properties 2021-02-15 13:35:39 +01:00
tomFlowee 0b3487c2ea Add onChainChanged() callback for new blocks 2021-02-15 12:15:07 +01:00
tomFlowee 665b18cf0b Add 'stop()' to shut down the engine 2021-02-15 10:46:56 +01:00
tomFlowee baf11f749e Split ContextData into two classes.
This separates the JavaScript napi stuff better from the rest.
2021-02-14 19:44:28 +01:00
tomFlowee 7ce891937a Be more silent by default 2021-02-12 21:38:06 +01:00
tomFlowee 67c3572730 Add FindTxInMempool / FindAddressInMempool
This makes available two new jobtypes to JavaScript
2021-02-11 15:52:00 +01:00
tomFlowee ee697e6db0 Print more complete error message 2020-12-16 22:25:40 +01:00
tomFlowee 1691cb19b1 Make testnet4 work much easier.
This adds calls;
    Flowee.testConnectHub()
    Flowee.testConnectIndexer()

And if you want to connect to both:
    Flowee.testConnect()
2020-12-16 22:11:55 +01:00
TomZ d0df3452cb Make connecting to one server work better
This ensures that we also resolve the promise when only one
of the server-types (hub/indexer) is connected to.
2020-07-27 19:26:05 +02:00
TomZ 4e042ce150 fix misuses of hashToString 2020-07-27 11:43:55 +02:00
TomZ 7edbcc6ba3 Enrich addressmonitor callback object
Allow for the possibility that more than one watched address matches
the transaction we notify about and therefore make an array.
Additionally, include the block-height property when mined.
2020-07-27 10:53:06 +02:00
TomZ d695d85ddb Make much complete the sending of messages
This converts more JS values to the proper NetworkManager values
and vice versa for the return message.

Return messages now have the following structure;

{
  serviceId: 1,
  messageId: 1,
  '67': 'main',
  '68': 644459,
  header: {},
  body: [
    { key: '67', value: 'main' },
    { key: '68', value: 644459 },
  ]
}

The keys in CMF are all intergers, and the 67 and 68 here are examples.
The body is now an array of properties.

For convenience each item is also set on the main return message.
Be aware, though, that for properties that are repeated only the last
one will be present on the return-message.

This commit also implements several blockchain service methods and
adds an example.

Last point is that for byte-arrays (like hashes) we produce a property
like this:
{
  key: '70',
  value: [Uint8Array],
  string: '000000000000000001613440a154e4c35c6467f65dafd70605d5578ec00b0192'
}

Again, as convenience, we add the string version of hashes. This is also
present on the return-message as '70str' next to the '70' bytearray.
2020-07-18 14:42:50 +02:00
TomZ e3e3eb90d0 Make sendMessage call return the msg to JS 2020-07-17 23:21:06 +02:00
TomZ 04e4a9cac2 Make an actual C++ message to be sent
This takes the JavaScript 'message' object and converts it into
a message that the NetworkManager uses.
2020-07-17 23:21:05 +02:00
TomZ 30108aba48 Combine with native JavaScript lib
This starts a native JS lib, taking inspiration for the basics
from the Flowee-JS-pure repo.
Additionally this exposes sending of CMF messages from JS over
the connection already set up in C++.
2020-07-17 23:20:23 +02:00
TomZ 5e82bef884 Actually include the imported data in the git repo. 2020-05-20 12:11:23 +02:00
TomZ 6590d39b3b List the indexer status 2020-05-20 12:06:21 +02:00
TomZ d7dc95dac4 Add support for the AddressMonitor service 2019-12-30 18:49:53 +01:00
TomZ 9a4e015d96 Fix typo
Make the connectHub/connectIndexer methods work again.
2019-12-27 22:25:49 +01:00
TomZ 18037f09f1 Add Flowee.sendTransaction() JavaScript call. 2019-12-27 22:25:49 +01:00
TomZ 4acb75ffe5 Fix property-name. It had a trailing space. 2019-12-23 15:02:13 +01:00
TomZ 23f61912f3 Last minute API review; IncludeTxId -> IncludeTxid 2019-12-23 15:01:52 +01:00
TomZ 95e3390509 Fixlet due to api review. 2019-12-19 01:26:20 +01:00
TomZ a7bca1a5b0 Port Search to use the Flowee wrappers of callbacks
Those are safer.
2019-12-09 15:10:27 +01:00
TomZ 7539772be0 Re-do the connect() family of methods.
Working around lots of NodeJS stupidities.
2019-12-09 15:10:27 +01:00
TomZ 51e1adf740 Make connect return a Promise
this allows us to only do stuff when the connections have been made.
2019-12-01 23:03:56 +01:00
TomZ 122672211c Make most of search work. 2019-11-30 20:07:39 +01:00
TomZ 8a1f6cbdf9 Make search object actually find stuff 2019-11-29 20:12:16 +01:00
TomZ 7a29d404ae Work on a search option for FloweeJS 2019-11-28 23:58:56 +01:00
TomZ 05699c6bc8 cleanup example.js 2019-11-13 17:52:17 +01:00
TomZ f2b95d5151 Change build system, make work for npm registry
In Flowee the main repo I removed the Qt dependency for the stuff
we use and in this repo I stopped linking to the externally built
flowee libraries.

This introduces an import.sh which copies the flowee sources we use
in this plugin to sure there being minimumal external dependencies.
2019-11-13 14:56:21 +01:00
TomZ 99d16e38a7 Fixlet of comment 2019-11-12 12:41:41 +01:00
TomZ 1d2fbaee23 Actually hook up the javascript to the Flowee code
This discovers the joys of NodeJS' threadsafe-functions
and makes the callbacks work so we can see that we actually
connected to the hub & indexer
2019-11-09 22:31:54 +01:00
TomZ bd795729c2 Port to the C++ api 2019-11-09 19:10:11 +01:00
TomZ 03ede89c36 Refactor; move code around 2019-11-09 18:18:56 +01:00