@flashbacktech/flashbackclient 0.1.41 → 0.1.42
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.
|
@@ -4,7 +4,17 @@ exports.withSignature = withSignature;
|
|
|
4
4
|
exports.withSignatureProperty = withSignatureProperty;
|
|
5
5
|
function withSignature(method) {
|
|
6
6
|
return async function (...args) {
|
|
7
|
-
|
|
7
|
+
// Try to get context from either getContext method or context property
|
|
8
|
+
let context;
|
|
9
|
+
if (this.getContext) {
|
|
10
|
+
context = this.getContext();
|
|
11
|
+
}
|
|
12
|
+
else if (this.context) {
|
|
13
|
+
context = this.context;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
throw new Error("FlashOnStellarClient: getContext method or context property is required for write operations");
|
|
17
|
+
}
|
|
8
18
|
if (!context.signTransaction) {
|
|
9
19
|
throw new Error("FlashOnStellarClient: signTransaction method is required for write operations");
|
|
10
20
|
}
|
|
@@ -19,7 +29,17 @@ function withSignatureProperty(target, propertyKey) {
|
|
|
19
29
|
enumerable: true,
|
|
20
30
|
get() {
|
|
21
31
|
return async (...args) => {
|
|
22
|
-
|
|
32
|
+
// Try to get context from either getContext method or context property
|
|
33
|
+
let context;
|
|
34
|
+
if (this.getContext) {
|
|
35
|
+
context = this.getContext();
|
|
36
|
+
}
|
|
37
|
+
else if (this.context) {
|
|
38
|
+
context = this.context;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
throw new Error("FlashOnStellarClient: getContext method or context property is required for write operations");
|
|
42
|
+
}
|
|
23
43
|
if (!context.signTransaction) {
|
|
24
44
|
throw new Error("FlashOnStellarClient: signTransaction method is required for write operations");
|
|
25
45
|
}
|