react-native-nitro-ark 0.0.93 → 0.0.95
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.
- package/android/src/main/cpp/NitroArkJni.cpp +2 -2
- package/android/src/main/java/com/margelo/nitro/nitroark/NitroArkNative.kt +1 -1
- package/android/src/main/jniLibs/arm64-v8a/libcxxbridge1.a +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libcxxbridge1.a +0 -0
- package/android/src/main/jniLibs/x86_64/libcxxbridge1.a +0 -0
- package/cpp/BarkNotificationSubscription.hpp +179 -0
- package/cpp/NitroArk.hpp +172 -56
- package/cpp/generated/ark_cxx.h +244 -11
- package/lib/module/index.js +51 -5
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +27 -2
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +42 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroArk+autolinking.cmake +1 -0
- package/nitrogen/generated/shared/c++/BarkArkInfo.hpp +14 -2
- package/nitrogen/generated/shared/c++/BarkNotificationEvent.hpp +90 -0
- package/nitrogen/generated/shared/c++/HybridBarkNotificationSubscriptionSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridBarkNotificationSubscriptionSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +7 -2
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +18 -2
- package/nitrogen/generated/shared/c++/MailboxAuthorizationResult.hpp +91 -0
- package/nitrogen/generated/shared/c++/OffchainBalanceResult.hpp +5 -1
- package/package.json +1 -1
- package/src/NitroArk.nitro.ts +39 -3
- package/src/index.tsx +89 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,c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EAAE,MAAM,GACzB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEvE;AAGD,YAAY,EACV,QAAQ,EACR,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,kBAAkB,CAAC"}
|
|
@@ -33,6 +33,7 @@ target_sources(
|
|
|
33
33
|
# Autolinking Setup
|
|
34
34
|
../nitrogen/generated/android/NitroArkOnLoad.cpp
|
|
35
35
|
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridBarkNotificationSubscriptionSpec.cpp
|
|
36
37
|
../nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp
|
|
37
38
|
# Android-specific Nitrogen C++ sources
|
|
38
39
|
|
|
@@ -41,6 +41,7 @@ namespace margelo::nitro::nitroark {
|
|
|
41
41
|
public:
|
|
42
42
|
std::string network SWIFT_PRIVATE;
|
|
43
43
|
std::string server_pubkey SWIFT_PRIVATE;
|
|
44
|
+
std::string mailbox_pubkey SWIFT_PRIVATE;
|
|
44
45
|
double round_interval SWIFT_PRIVATE;
|
|
45
46
|
double nb_round_nonces SWIFT_PRIVATE;
|
|
46
47
|
double vtxo_exit_delta SWIFT_PRIVATE;
|
|
@@ -48,10 +49,12 @@ namespace margelo::nitro::nitroark {
|
|
|
48
49
|
double htlc_send_expiry_delta SWIFT_PRIVATE;
|
|
49
50
|
double max_vtxo_amount SWIFT_PRIVATE;
|
|
50
51
|
double required_board_confirmations SWIFT_PRIVATE;
|
|
52
|
+
double min_board_amount SWIFT_PRIVATE;
|
|
53
|
+
bool ln_receive_anti_dos_required SWIFT_PRIVATE;
|
|
51
54
|
|
|
52
55
|
public:
|
|
53
56
|
BarkArkInfo() = default;
|
|
54
|
-
explicit BarkArkInfo(std::string network, std::string server_pubkey, double round_interval, double nb_round_nonces, double vtxo_exit_delta, double vtxo_expiry_delta, double htlc_send_expiry_delta, double max_vtxo_amount, double required_board_confirmations): network(network), server_pubkey(server_pubkey), round_interval(round_interval), nb_round_nonces(nb_round_nonces), vtxo_exit_delta(vtxo_exit_delta), vtxo_expiry_delta(vtxo_expiry_delta), htlc_send_expiry_delta(htlc_send_expiry_delta), max_vtxo_amount(max_vtxo_amount), required_board_confirmations(required_board_confirmations) {}
|
|
57
|
+
explicit BarkArkInfo(std::string network, std::string server_pubkey, std::string mailbox_pubkey, double round_interval, double nb_round_nonces, double vtxo_exit_delta, double vtxo_expiry_delta, double htlc_send_expiry_delta, double max_vtxo_amount, double required_board_confirmations, double min_board_amount, bool ln_receive_anti_dos_required): network(network), server_pubkey(server_pubkey), mailbox_pubkey(mailbox_pubkey), round_interval(round_interval), nb_round_nonces(nb_round_nonces), vtxo_exit_delta(vtxo_exit_delta), vtxo_expiry_delta(vtxo_expiry_delta), htlc_send_expiry_delta(htlc_send_expiry_delta), max_vtxo_amount(max_vtxo_amount), required_board_confirmations(required_board_confirmations), min_board_amount(min_board_amount), ln_receive_anti_dos_required(ln_receive_anti_dos_required) {}
|
|
55
58
|
|
|
56
59
|
public:
|
|
57
60
|
friend bool operator==(const BarkArkInfo& lhs, const BarkArkInfo& rhs) = default;
|
|
@@ -69,19 +72,23 @@ namespace margelo::nitro {
|
|
|
69
72
|
return margelo::nitro::nitroark::BarkArkInfo(
|
|
70
73
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "network"))),
|
|
71
74
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "server_pubkey"))),
|
|
75
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mailbox_pubkey"))),
|
|
72
76
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "round_interval"))),
|
|
73
77
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "nb_round_nonces"))),
|
|
74
78
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_exit_delta"))),
|
|
75
79
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_expiry_delta"))),
|
|
76
80
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "htlc_send_expiry_delta"))),
|
|
77
81
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "max_vtxo_amount"))),
|
|
78
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "required_board_confirmations")))
|
|
82
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "required_board_confirmations"))),
|
|
83
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "min_board_amount"))),
|
|
84
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ln_receive_anti_dos_required")))
|
|
79
85
|
);
|
|
80
86
|
}
|
|
81
87
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::BarkArkInfo& arg) {
|
|
82
88
|
jsi::Object obj(runtime);
|
|
83
89
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "network"), JSIConverter<std::string>::toJSI(runtime, arg.network));
|
|
84
90
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "server_pubkey"), JSIConverter<std::string>::toJSI(runtime, arg.server_pubkey));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "mailbox_pubkey"), JSIConverter<std::string>::toJSI(runtime, arg.mailbox_pubkey));
|
|
85
92
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "round_interval"), JSIConverter<double>::toJSI(runtime, arg.round_interval));
|
|
86
93
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "nb_round_nonces"), JSIConverter<double>::toJSI(runtime, arg.nb_round_nonces));
|
|
87
94
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "vtxo_exit_delta"), JSIConverter<double>::toJSI(runtime, arg.vtxo_exit_delta));
|
|
@@ -89,6 +96,8 @@ namespace margelo::nitro {
|
|
|
89
96
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "htlc_send_expiry_delta"), JSIConverter<double>::toJSI(runtime, arg.htlc_send_expiry_delta));
|
|
90
97
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "max_vtxo_amount"), JSIConverter<double>::toJSI(runtime, arg.max_vtxo_amount));
|
|
91
98
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "required_board_confirmations"), JSIConverter<double>::toJSI(runtime, arg.required_board_confirmations));
|
|
99
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "min_board_amount"), JSIConverter<double>::toJSI(runtime, arg.min_board_amount));
|
|
100
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "ln_receive_anti_dos_required"), JSIConverter<bool>::toJSI(runtime, arg.ln_receive_anti_dos_required));
|
|
92
101
|
return obj;
|
|
93
102
|
}
|
|
94
103
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -101,6 +110,7 @@ namespace margelo::nitro {
|
|
|
101
110
|
}
|
|
102
111
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "network")))) return false;
|
|
103
112
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "server_pubkey")))) return false;
|
|
113
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mailbox_pubkey")))) return false;
|
|
104
114
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "round_interval")))) return false;
|
|
105
115
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "nb_round_nonces")))) return false;
|
|
106
116
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_exit_delta")))) return false;
|
|
@@ -108,6 +118,8 @@ namespace margelo::nitro {
|
|
|
108
118
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "htlc_send_expiry_delta")))) return false;
|
|
109
119
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "max_vtxo_amount")))) return false;
|
|
110
120
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "required_board_confirmations")))) return false;
|
|
121
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "min_board_amount")))) return false;
|
|
122
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ln_receive_anti_dos_required")))) return false;
|
|
111
123
|
return true;
|
|
112
124
|
}
|
|
113
125
|
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// BarkNotificationEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `BarkMovement` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitroark { struct BarkMovement; }
|
|
33
|
+
|
|
34
|
+
#include <string>
|
|
35
|
+
#include "BarkMovement.hpp"
|
|
36
|
+
#include <optional>
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro::nitroark {
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A struct which can be represented as a JavaScript object (BarkNotificationEvent).
|
|
42
|
+
*/
|
|
43
|
+
struct BarkNotificationEvent final {
|
|
44
|
+
public:
|
|
45
|
+
std::string kind SWIFT_PRIVATE;
|
|
46
|
+
std::optional<BarkMovement> movement SWIFT_PRIVATE;
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
BarkNotificationEvent() = default;
|
|
50
|
+
explicit BarkNotificationEvent(std::string kind, std::optional<BarkMovement> movement): kind(kind), movement(movement) {}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
friend bool operator==(const BarkNotificationEvent& lhs, const BarkNotificationEvent& rhs) = default;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
} // namespace margelo::nitro::nitroark
|
|
57
|
+
|
|
58
|
+
namespace margelo::nitro {
|
|
59
|
+
|
|
60
|
+
// C++ BarkNotificationEvent <> JS BarkNotificationEvent (object)
|
|
61
|
+
template <>
|
|
62
|
+
struct JSIConverter<margelo::nitro::nitroark::BarkNotificationEvent> final {
|
|
63
|
+
static inline margelo::nitro::nitroark::BarkNotificationEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
64
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
65
|
+
return margelo::nitro::nitroark::BarkNotificationEvent(
|
|
66
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "kind"))),
|
|
67
|
+
JSIConverter<std::optional<margelo::nitro::nitroark::BarkMovement>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "movement")))
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::BarkNotificationEvent& arg) {
|
|
71
|
+
jsi::Object obj(runtime);
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "kind"), JSIConverter<std::string>::toJSI(runtime, arg.kind));
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "movement"), JSIConverter<std::optional<margelo::nitro::nitroark::BarkMovement>>::toJSI(runtime, arg.movement));
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
77
|
+
if (!value.isObject()) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
jsi::Object obj = value.getObject(runtime);
|
|
81
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "kind")))) return false;
|
|
85
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroark::BarkMovement>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "movement")))) return false;
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridBarkNotificationSubscriptionSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridBarkNotificationSubscriptionSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitroark {
|
|
11
|
+
|
|
12
|
+
void HybridBarkNotificationSubscriptionSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("stop", &HybridBarkNotificationSubscriptionSpec::stop);
|
|
18
|
+
prototype.registerHybridMethod("isActive", &HybridBarkNotificationSubscriptionSpec::isActive);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace margelo::nitro::nitroark
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridBarkNotificationSubscriptionSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::nitroark {
|
|
21
|
+
|
|
22
|
+
using namespace margelo::nitro;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An abstract base class for `BarkNotificationSubscription`
|
|
26
|
+
* Inherit this class to create instances of `HybridBarkNotificationSubscriptionSpec` in C++.
|
|
27
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
28
|
+
* @example
|
|
29
|
+
* ```cpp
|
|
30
|
+
* class HybridBarkNotificationSubscription: public HybridBarkNotificationSubscriptionSpec {
|
|
31
|
+
* public:
|
|
32
|
+
* HybridBarkNotificationSubscription(...): HybridObject(TAG) { ... }
|
|
33
|
+
* // ...
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
class HybridBarkNotificationSubscriptionSpec: public virtual HybridObject {
|
|
38
|
+
public:
|
|
39
|
+
// Constructor
|
|
40
|
+
explicit HybridBarkNotificationSubscriptionSpec(): HybridObject(TAG) { }
|
|
41
|
+
|
|
42
|
+
// Destructor
|
|
43
|
+
~HybridBarkNotificationSubscriptionSpec() override = default;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
// Properties
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
// Methods
|
|
51
|
+
virtual void stop() = 0;
|
|
52
|
+
virtual bool isActive() = 0;
|
|
53
|
+
|
|
54
|
+
protected:
|
|
55
|
+
// Hybrid Setup
|
|
56
|
+
void loadHybridMethods() override;
|
|
57
|
+
|
|
58
|
+
protected:
|
|
59
|
+
// Tag for logging
|
|
60
|
+
static constexpr auto TAG = "BarkNotificationSubscription";
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
} // namespace margelo::nitro::nitroark
|
|
@@ -32,13 +32,18 @@ namespace margelo::nitro::nitroark {
|
|
|
32
32
|
prototype.registerHybridMethod("getArkInfo", &HybridNitroArkSpec::getArkInfo);
|
|
33
33
|
prototype.registerHybridMethod("offchainBalance", &HybridNitroArkSpec::offchainBalance);
|
|
34
34
|
prototype.registerHybridMethod("deriveStoreNextKeypair", &HybridNitroArkSpec::deriveStoreNextKeypair);
|
|
35
|
-
prototype.registerHybridMethod("
|
|
36
|
-
prototype.registerHybridMethod("
|
|
35
|
+
prototype.registerHybridMethod("peekKeyPair", &HybridNitroArkSpec::peekKeyPair);
|
|
36
|
+
prototype.registerHybridMethod("peekAddress", &HybridNitroArkSpec::peekAddress);
|
|
37
37
|
prototype.registerHybridMethod("newAddress", &HybridNitroArkSpec::newAddress);
|
|
38
38
|
prototype.registerHybridMethod("signMessage", &HybridNitroArkSpec::signMessage);
|
|
39
39
|
prototype.registerHybridMethod("signMesssageWithMnemonic", &HybridNitroArkSpec::signMesssageWithMnemonic);
|
|
40
40
|
prototype.registerHybridMethod("deriveKeypairFromMnemonic", &HybridNitroArkSpec::deriveKeypairFromMnemonic);
|
|
41
41
|
prototype.registerHybridMethod("verifyMessage", &HybridNitroArkSpec::verifyMessage);
|
|
42
|
+
prototype.registerHybridMethod("mailboxKeypair", &HybridNitroArkSpec::mailboxKeypair);
|
|
43
|
+
prototype.registerHybridMethod("mailboxAuthorization", &HybridNitroArkSpec::mailboxAuthorization);
|
|
44
|
+
prototype.registerHybridMethod("subscribeNotifications", &HybridNitroArkSpec::subscribeNotifications);
|
|
45
|
+
prototype.registerHybridMethod("subscribeArkoorAddressMovements", &HybridNitroArkSpec::subscribeArkoorAddressMovements);
|
|
46
|
+
prototype.registerHybridMethod("subscribeLightningPaymentMovements", &HybridNitroArkSpec::subscribeLightningPaymentMovements);
|
|
42
47
|
prototype.registerHybridMethod("history", &HybridNitroArkSpec::history);
|
|
43
48
|
prototype.registerHybridMethod("vtxos", &HybridNitroArkSpec::vtxos);
|
|
44
49
|
prototype.registerHybridMethod("getFirstExpiringVtxoBlockheight", &HybridNitroArkSpec::getFirstExpiringVtxoBlockheight);
|
|
@@ -23,6 +23,12 @@ namespace margelo::nitro::nitroark { struct OffchainBalanceResult; }
|
|
|
23
23
|
namespace margelo::nitro::nitroark { struct KeyPairResult; }
|
|
24
24
|
// Forward declaration of `NewAddressResult` to properly resolve imports.
|
|
25
25
|
namespace margelo::nitro::nitroark { struct NewAddressResult; }
|
|
26
|
+
// Forward declaration of `MailboxAuthorizationResult` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::nitroark { struct MailboxAuthorizationResult; }
|
|
28
|
+
// Forward declaration of `HybridBarkNotificationSubscriptionSpec` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::nitroark { class HybridBarkNotificationSubscriptionSpec; }
|
|
30
|
+
// Forward declaration of `BarkNotificationEvent` to properly resolve imports.
|
|
31
|
+
namespace margelo::nitro::nitroark { struct BarkNotificationEvent; }
|
|
26
32
|
// Forward declaration of `BarkMovement` to properly resolve imports.
|
|
27
33
|
namespace margelo::nitro::nitroark { struct BarkMovement; }
|
|
28
34
|
// Forward declaration of `BarkVtxo` to properly resolve imports.
|
|
@@ -51,6 +57,11 @@ namespace margelo::nitro::nitroark { struct LightningReceive; }
|
|
|
51
57
|
#include "OffchainBalanceResult.hpp"
|
|
52
58
|
#include "KeyPairResult.hpp"
|
|
53
59
|
#include "NewAddressResult.hpp"
|
|
60
|
+
#include "MailboxAuthorizationResult.hpp"
|
|
61
|
+
#include <memory>
|
|
62
|
+
#include "HybridBarkNotificationSubscriptionSpec.hpp"
|
|
63
|
+
#include "BarkNotificationEvent.hpp"
|
|
64
|
+
#include <functional>
|
|
54
65
|
#include "BarkMovement.hpp"
|
|
55
66
|
#include <vector>
|
|
56
67
|
#include "BarkVtxo.hpp"
|
|
@@ -115,13 +126,18 @@ namespace margelo::nitro::nitroark {
|
|
|
115
126
|
virtual std::shared_ptr<Promise<BarkArkInfo>> getArkInfo() = 0;
|
|
116
127
|
virtual std::shared_ptr<Promise<OffchainBalanceResult>> offchainBalance() = 0;
|
|
117
128
|
virtual std::shared_ptr<Promise<KeyPairResult>> deriveStoreNextKeypair() = 0;
|
|
118
|
-
virtual std::shared_ptr<Promise<KeyPairResult>>
|
|
119
|
-
virtual std::shared_ptr<Promise<NewAddressResult>>
|
|
129
|
+
virtual std::shared_ptr<Promise<KeyPairResult>> peekKeyPair(double index) = 0;
|
|
130
|
+
virtual std::shared_ptr<Promise<NewAddressResult>> peekAddress(double index) = 0;
|
|
120
131
|
virtual std::shared_ptr<Promise<NewAddressResult>> newAddress() = 0;
|
|
121
132
|
virtual std::shared_ptr<Promise<std::string>> signMessage(const std::string& message, double index) = 0;
|
|
122
133
|
virtual std::shared_ptr<Promise<std::string>> signMesssageWithMnemonic(const std::string& message, const std::string& mnemonic, const std::string& network, double index) = 0;
|
|
123
134
|
virtual std::shared_ptr<Promise<KeyPairResult>> deriveKeypairFromMnemonic(const std::string& mnemonic, const std::string& network, double index) = 0;
|
|
124
135
|
virtual std::shared_ptr<Promise<bool>> verifyMessage(const std::string& message, const std::string& signature, const std::string& publicKey) = 0;
|
|
136
|
+
virtual std::shared_ptr<Promise<KeyPairResult>> mailboxKeypair() = 0;
|
|
137
|
+
virtual std::shared_ptr<Promise<MailboxAuthorizationResult>> mailboxAuthorization(double authorizationExpiry) = 0;
|
|
138
|
+
virtual std::shared_ptr<HybridBarkNotificationSubscriptionSpec> subscribeNotifications(const std::function<void(const BarkNotificationEvent& /* event */)>& onEvent) = 0;
|
|
139
|
+
virtual std::shared_ptr<HybridBarkNotificationSubscriptionSpec> subscribeArkoorAddressMovements(const std::string& address, const std::function<void(const BarkNotificationEvent& /* event */)>& onEvent) = 0;
|
|
140
|
+
virtual std::shared_ptr<HybridBarkNotificationSubscriptionSpec> subscribeLightningPaymentMovements(const std::string& paymentHash, const std::function<void(const BarkNotificationEvent& /* event */)>& onEvent) = 0;
|
|
125
141
|
virtual std::shared_ptr<Promise<std::vector<BarkMovement>>> history() = 0;
|
|
126
142
|
virtual std::shared_ptr<Promise<std::vector<BarkVtxo>>> vtxos() = 0;
|
|
127
143
|
virtual std::shared_ptr<Promise<std::optional<double>>> getFirstExpiringVtxoBlockheight() = 0;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MailboxAuthorizationResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::nitroark {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (MailboxAuthorizationResult).
|
|
39
|
+
*/
|
|
40
|
+
struct MailboxAuthorizationResult final {
|
|
41
|
+
public:
|
|
42
|
+
std::string mailbox_id SWIFT_PRIVATE;
|
|
43
|
+
double expiry SWIFT_PRIVATE;
|
|
44
|
+
std::string encoded SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
MailboxAuthorizationResult() = default;
|
|
48
|
+
explicit MailboxAuthorizationResult(std::string mailbox_id, double expiry, std::string encoded): mailbox_id(mailbox_id), expiry(expiry), encoded(encoded) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const MailboxAuthorizationResult& lhs, const MailboxAuthorizationResult& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::nitroark
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ MailboxAuthorizationResult <> JS MailboxAuthorizationResult (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::nitroark::MailboxAuthorizationResult> final {
|
|
61
|
+
static inline margelo::nitro::nitroark::MailboxAuthorizationResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::nitroark::MailboxAuthorizationResult(
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mailbox_id"))),
|
|
65
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "expiry"))),
|
|
66
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "encoded")))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::MailboxAuthorizationResult& arg) {
|
|
70
|
+
jsi::Object obj(runtime);
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "mailbox_id"), JSIConverter<std::string>::toJSI(runtime, arg.mailbox_id));
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "expiry"), JSIConverter<double>::toJSI(runtime, arg.expiry));
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "encoded"), JSIConverter<std::string>::toJSI(runtime, arg.encoded));
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
77
|
+
if (!value.isObject()) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
jsi::Object obj = value.getObject(runtime);
|
|
81
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mailbox_id")))) return false;
|
|
85
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "expiry")))) return false;
|
|
86
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "encoded")))) return false;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
} // namespace margelo::nitro
|
|
@@ -41,13 +41,14 @@ namespace margelo::nitro::nitroark {
|
|
|
41
41
|
public:
|
|
42
42
|
double spendable SWIFT_PRIVATE;
|
|
43
43
|
double pending_lightning_send SWIFT_PRIVATE;
|
|
44
|
+
double claimable_lightning_receive SWIFT_PRIVATE;
|
|
44
45
|
double pending_in_round SWIFT_PRIVATE;
|
|
45
46
|
double pending_exit SWIFT_PRIVATE;
|
|
46
47
|
double pending_board SWIFT_PRIVATE;
|
|
47
48
|
|
|
48
49
|
public:
|
|
49
50
|
OffchainBalanceResult() = default;
|
|
50
|
-
explicit OffchainBalanceResult(double spendable, double pending_lightning_send, double pending_in_round, double pending_exit, double pending_board): spendable(spendable), pending_lightning_send(pending_lightning_send), pending_in_round(pending_in_round), pending_exit(pending_exit), pending_board(pending_board) {}
|
|
51
|
+
explicit OffchainBalanceResult(double spendable, double pending_lightning_send, double claimable_lightning_receive, double pending_in_round, double pending_exit, double pending_board): spendable(spendable), pending_lightning_send(pending_lightning_send), claimable_lightning_receive(claimable_lightning_receive), pending_in_round(pending_in_round), pending_exit(pending_exit), pending_board(pending_board) {}
|
|
51
52
|
|
|
52
53
|
public:
|
|
53
54
|
friend bool operator==(const OffchainBalanceResult& lhs, const OffchainBalanceResult& rhs) = default;
|
|
@@ -65,6 +66,7 @@ namespace margelo::nitro {
|
|
|
65
66
|
return margelo::nitro::nitroark::OffchainBalanceResult(
|
|
66
67
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "spendable"))),
|
|
67
68
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pending_lightning_send"))),
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "claimable_lightning_receive"))),
|
|
68
70
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pending_in_round"))),
|
|
69
71
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pending_exit"))),
|
|
70
72
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pending_board")))
|
|
@@ -74,6 +76,7 @@ namespace margelo::nitro {
|
|
|
74
76
|
jsi::Object obj(runtime);
|
|
75
77
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "spendable"), JSIConverter<double>::toJSI(runtime, arg.spendable));
|
|
76
78
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pending_lightning_send"), JSIConverter<double>::toJSI(runtime, arg.pending_lightning_send));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "claimable_lightning_receive"), JSIConverter<double>::toJSI(runtime, arg.claimable_lightning_receive));
|
|
77
80
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pending_in_round"), JSIConverter<double>::toJSI(runtime, arg.pending_in_round));
|
|
78
81
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pending_exit"), JSIConverter<double>::toJSI(runtime, arg.pending_exit));
|
|
79
82
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pending_board"), JSIConverter<double>::toJSI(runtime, arg.pending_board));
|
|
@@ -89,6 +92,7 @@ namespace margelo::nitro {
|
|
|
89
92
|
}
|
|
90
93
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "spendable")))) return false;
|
|
91
94
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pending_lightning_send")))) return false;
|
|
95
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "claimable_lightning_receive")))) return false;
|
|
92
96
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pending_in_round")))) return false;
|
|
93
97
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pending_exit")))) return false;
|
|
94
98
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pending_board")))) return false;
|
package/package.json
CHANGED
package/src/NitroArk.nitro.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface BarkCreateOpts {
|
|
|
30
30
|
export interface BarkArkInfo {
|
|
31
31
|
network: string;
|
|
32
32
|
server_pubkey: string;
|
|
33
|
+
mailbox_pubkey: string;
|
|
33
34
|
round_interval: number; // u64
|
|
34
35
|
nb_round_nonces: number; // u16
|
|
35
36
|
vtxo_exit_delta: number; // u16
|
|
@@ -37,6 +38,8 @@ export interface BarkArkInfo {
|
|
|
37
38
|
htlc_send_expiry_delta: number; // u16
|
|
38
39
|
max_vtxo_amount: number; // u64
|
|
39
40
|
required_board_confirmations: number; // u8
|
|
41
|
+
min_board_amount: number; // u64
|
|
42
|
+
ln_receive_anti_dos_required: boolean;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
// Helper interface for sendManyOnchain
|
|
@@ -90,6 +93,7 @@ export interface OnchainPaymentResult {
|
|
|
90
93
|
export interface OffchainBalanceResult {
|
|
91
94
|
spendable: number; // u64
|
|
92
95
|
pending_lightning_send: number; // u64
|
|
96
|
+
claimable_lightning_receive: number; // u64
|
|
93
97
|
pending_in_round: number; // u64
|
|
94
98
|
pending_exit: number; // u64
|
|
95
99
|
pending_board: number; // u64
|
|
@@ -117,6 +121,12 @@ export interface KeyPairResult {
|
|
|
117
121
|
secret_key: string;
|
|
118
122
|
}
|
|
119
123
|
|
|
124
|
+
export interface MailboxAuthorizationResult {
|
|
125
|
+
mailbox_id: string;
|
|
126
|
+
expiry: number; // i64 unix timestamp
|
|
127
|
+
encoded: string; // hex-encoded full protocol encoding
|
|
128
|
+
}
|
|
129
|
+
|
|
120
130
|
export interface LightningReceive {
|
|
121
131
|
payment_hash: string;
|
|
122
132
|
payment_preimage: string;
|
|
@@ -138,7 +148,7 @@ export interface BarkMovementDestination {
|
|
|
138
148
|
|
|
139
149
|
export interface BarkMovement {
|
|
140
150
|
id: number;
|
|
141
|
-
status: string; // 'pending' | '
|
|
151
|
+
status: string; // 'pending' | 'successful' | 'failed' | 'cancelled'
|
|
142
152
|
subsystem: BarkMovementSubsystem;
|
|
143
153
|
metadata_json: string;
|
|
144
154
|
intended_balance_sat: number;
|
|
@@ -154,6 +164,17 @@ export interface BarkMovement {
|
|
|
154
164
|
completed_at?: string;
|
|
155
165
|
}
|
|
156
166
|
|
|
167
|
+
export interface BarkNotificationEvent {
|
|
168
|
+
kind: string; // 'movementCreated' | 'movementUpdated' | 'channelLagging'
|
|
169
|
+
movement?: BarkMovement;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface BarkNotificationSubscription
|
|
173
|
+
extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
174
|
+
stop(): void;
|
|
175
|
+
isActive(): boolean;
|
|
176
|
+
}
|
|
177
|
+
|
|
157
178
|
// --- Nitro Module Interface ---
|
|
158
179
|
|
|
159
180
|
export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
@@ -178,8 +199,8 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
178
199
|
getArkInfo(): Promise<BarkArkInfo>;
|
|
179
200
|
offchainBalance(): Promise<OffchainBalanceResult>;
|
|
180
201
|
deriveStoreNextKeypair(): Promise<KeyPairResult>;
|
|
181
|
-
|
|
182
|
-
|
|
202
|
+
peekKeyPair(index: number): Promise<KeyPairResult>;
|
|
203
|
+
peekAddress(index: number): Promise<NewAddressResult>;
|
|
183
204
|
newAddress(): Promise<NewAddressResult>;
|
|
184
205
|
signMessage(message: string, index: number): Promise<string>;
|
|
185
206
|
signMesssageWithMnemonic(
|
|
@@ -198,6 +219,21 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
198
219
|
signature: string,
|
|
199
220
|
publicKey: string
|
|
200
221
|
): Promise<boolean>;
|
|
222
|
+
mailboxKeypair(): Promise<KeyPairResult>;
|
|
223
|
+
mailboxAuthorization(
|
|
224
|
+
authorizationExpiry: number
|
|
225
|
+
): Promise<MailboxAuthorizationResult>;
|
|
226
|
+
subscribeNotifications(
|
|
227
|
+
onEvent: (event: BarkNotificationEvent) => void
|
|
228
|
+
): BarkNotificationSubscription;
|
|
229
|
+
subscribeArkoorAddressMovements(
|
|
230
|
+
address: string,
|
|
231
|
+
onEvent: (event: BarkNotificationEvent) => void
|
|
232
|
+
): BarkNotificationSubscription;
|
|
233
|
+
subscribeLightningPaymentMovements(
|
|
234
|
+
paymentHash: string,
|
|
235
|
+
onEvent: (event: BarkNotificationEvent) => void
|
|
236
|
+
): BarkNotificationSubscription;
|
|
201
237
|
history(): Promise<BarkMovement[]>;
|
|
202
238
|
vtxos(): Promise<BarkVtxo[]>;
|
|
203
239
|
getFirstExpiringVtxoBlockheight(): Promise<number | undefined>;
|