edge-currency-plugins 2.6.2 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +61 -2
  2. package/android/build.gradle +45 -0
  3. package/android/src/main/AndroidManifest.xml +2 -0
  4. package/android/src/main/assets/edge-currency-plugins/669.chunk.js +1 -0
  5. package/android/src/main/assets/edge-currency-plugins/edge-currency-plugins.js +76 -0
  6. package/android/src/main/java/app/edge/reactnative/currencyplugins/EdgeCurrencyPluginsModule.java +26 -0
  7. package/android/src/main/java/app/edge/reactnative/currencyplugins/EdgeCurrencyPluginsPackage.java +24 -0
  8. package/edge-currency-plugins.d.ts +34 -0
  9. package/edge-currency-plugins.podspec +28 -0
  10. package/ios/EdgeCurrencyPluginsModule.m +4 -0
  11. package/ios/EdgeCurrencyPluginsModule.swift +20 -0
  12. package/ios/edge-currency-plugins.xcodeproj/project.pbxproj +1 -0
  13. package/lib/common/constants.js +1 -2
  14. package/lib/common/plugin/CurrencyPlugin.js +17 -1
  15. package/lib/common/utxobased/db/Models/ProcessorTransaction.js +3 -2
  16. package/lib/common/utxobased/db/Processor.js +5 -0
  17. package/lib/common/utxobased/engine/ServerStates.js +159 -28
  18. package/lib/common/utxobased/engine/UtxoEngine.js +3 -2
  19. package/lib/common/utxobased/engine/UtxoEngineState.js +66 -72
  20. package/lib/common/utxobased/engine/types.js +3 -1
  21. package/lib/common/utxobased/info/bitcoin.js +1 -6
  22. package/lib/common/utxobased/info/bitcoincash.js +1 -6
  23. package/lib/common/utxobased/info/bitcoincashtestnet.js +0 -5
  24. package/lib/common/utxobased/info/bitcoinsv.js +0 -5
  25. package/lib/common/utxobased/info/bitcointestnet.js +0 -5
  26. package/lib/common/utxobased/info/dash.js +1 -1
  27. package/lib/common/utxobased/info/digibyte.js +1 -1
  28. package/lib/common/utxobased/info/feathercoin.js +0 -5
  29. package/lib/common/utxobased/info/groestlcoin.js +1 -1
  30. package/lib/common/utxobased/info/litecoin.js +1 -6
  31. package/lib/common/utxobased/info/zcoin.js +6 -5
  32. package/lib/common/utxobased/keymanager/keymanager.js +1 -1
  33. package/lib/common/utxobased/keymanager/types.js +2 -1
  34. package/lib/common/utxobased/network/Blockbook.js +178 -105
  35. package/lib/common/utxobased/network/BlockbookElectrum.js +216 -0
  36. package/lib/common/utxobased/network/Socket.js +130 -66
  37. package/lib/common/utxobased/network/blockbookApi.js +6 -6
  38. package/lib/common/utxobased/network/electrumApi.js +203 -0
  39. package/lib/{types.js → declare-modules.d.js} +2 -0
  40. package/lib/index.js +7 -3
  41. package/lib/react-native.js +26 -0
  42. package/lib/src/common/constants.d.ts +0 -1
  43. package/lib/src/common/utxobased/db/Processor.d.ts +6 -1
  44. package/lib/src/common/utxobased/engine/ServerStates.d.ts +8 -0
  45. package/lib/src/common/utxobased/engine/UtxoEngineState.d.ts +1 -4
  46. package/lib/src/common/utxobased/keymanager/types.d.ts +3 -3
  47. package/lib/src/common/utxobased/network/Blockbook.d.ts +20 -7
  48. package/lib/src/common/utxobased/network/BlockbookElectrum.d.ts +25 -0
  49. package/lib/src/common/utxobased/network/Socket.d.ts +11 -0
  50. package/lib/src/common/utxobased/network/blockbookApi.d.ts +2 -16
  51. package/lib/src/common/utxobased/network/electrumApi.d.ts +90 -0
  52. package/lib/src/index.d.ts +5 -1
  53. package/lib/src/react-native.d.ts +10 -0
  54. package/lib/test/utils.d.ts +4 -0
  55. package/package.json +24 -11
  56. package/lib/src/types.d.ts +0 -6
package/README.md CHANGED
@@ -1,3 +1,62 @@
1
- # edge-currency-plugins
1
+ # Edge Currency Plugin for UTXO-Based currencies
2
2
 
3
- > Plugins for edge-core-js to support various cryptocurrencies such as bitcoin, bitcoin cash, and litecoin,
3
+ > Plugins for [edge-core-js](https://github.com/EdgeApp/edge-core-js), to support various cryptocurrencies such as bitcoin, bitcoin cash, and litecoin,
4
+
5
+ ## Installing
6
+
7
+ First, add this library to your project:
8
+
9
+ ```sh
10
+ npm i -s edge-currency-plugins
11
+ ```
12
+
13
+ ### Node.js
14
+
15
+ For Node.js, you should call `addEdgeCorePlugins` to register these plugins with edge-core-js:
16
+
17
+ ```js
18
+ const { addEdgeCorePlugins, lockEdgeCorePlugins } = require("edge-core-js");
19
+ const plugins = require("edge-currency-plugins");
20
+
21
+ addEdgeCorePlugins(plugins);
22
+
23
+ // Once you are done adding plugins, call this:
24
+ lockEdgeCorePlugins();
25
+ ```
26
+
27
+ You can also add plugins individually if you want to be more picky:
28
+
29
+ ```js
30
+ addEdgeCorePlugins({
31
+ bitcoin: plugins.bitcoin,
32
+ });
33
+ ```
34
+
35
+ ### Browser
36
+
37
+ The bundle located in `dist/edge-currency-plugins.js` will automatically register itself with edge-core-js. Just serve the entire `dist` directory along with your app, and then load the script:
38
+
39
+ ```html
40
+ <script src='https://example.com/app/dist/edge-currency-plugins.js'>
41
+ ```
42
+
43
+ If you want to debug this project, run `yarn start` to start a Webpack server,
44
+ and then adjust your script URL to http://localhost:8084/edge-currency-plugins.js.
45
+
46
+ ### React Native
47
+
48
+ The `edge-currency-plugins` package will automatically install itself using React Native autolinking.
49
+ To integrate the plugins with edge-core-js, add its URI to the context component:
50
+
51
+ ```jsx
52
+ import { pluginUri, makePluginIo } from "edge-currency-plugins";
53
+ <MakeEdgeContext
54
+ nativeIo={{
55
+ "edge-currency-plugins": makePluginIo(),
56
+ }}
57
+ pluginUris={[pluginUri]}
58
+ // Plus other props as required...
59
+ />;
60
+ ```
61
+
62
+ To debug this project, run `yarn start` to start a Webpack server, and then use `debugUri` instead of `pluginUri`.
@@ -0,0 +1,45 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ }
6
+
7
+ dependencies {
8
+ classpath 'com.android.tools.build:gradle:3.6.0'
9
+ }
10
+ }
11
+
12
+ apply plugin: 'com.android.library'
13
+
14
+ def safeExtGet(prop, fallback) {
15
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
16
+ }
17
+
18
+ def DEFAULT_COMPILE_SDK_VERSION = 28
19
+ def DEFAULT_BUILD_TOOLS_VERSION = '28.0.2'
20
+ def DEFAULT_MIN_SDK_VERSION = 19
21
+ def DEFAULT_TARGET_SDK_VERSION = 27
22
+
23
+ android {
24
+ namespace "app.edge.reactnative.currencyplugins"
25
+
26
+ compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
27
+ buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
28
+
29
+ defaultConfig {
30
+ minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
31
+ targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
32
+ versionCode 1
33
+ versionName '1.0'
34
+ }
35
+ lintOptions {
36
+ abortOnError false
37
+ }
38
+ }
39
+
40
+ repositories {
41
+ }
42
+
43
+ dependencies {
44
+ implementation 'com.facebook.react:react-native:+'
45
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>