@flashbacktech/flashbackclient 0.0.14 → 0.0.15
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/dist/stellar/consumer.js
CHANGED
|
@@ -47,13 +47,13 @@ const get_consumer_reservations = async (context, wallet_address, consumer_addre
|
|
|
47
47
|
return typedConsumerReservations;
|
|
48
48
|
};
|
|
49
49
|
const executeConsumerTransaction = async (context, wallet_address, consumer_address, method, additionalArgs = []) => {
|
|
50
|
-
const
|
|
50
|
+
const is_owner = wallet_address !== consumer_address;
|
|
51
51
|
const response = await prepareTransaction(context, wallet_address, {
|
|
52
52
|
method,
|
|
53
53
|
args: [
|
|
54
54
|
{ value: consumer_address, type: 'address' },
|
|
55
55
|
...additionalArgs,
|
|
56
|
-
{ value:
|
|
56
|
+
{ value: is_owner, type: 'bool' },
|
|
57
57
|
],
|
|
58
58
|
});
|
|
59
59
|
if (response.isSuccess && !response.isReadOnly) {
|
package/dist/stellar/provider.js
CHANGED
|
@@ -47,13 +47,13 @@ const get_provider_count = async (context, wallet_address) => {
|
|
|
47
47
|
};
|
|
48
48
|
// Helper function to handle write-mode contract calls
|
|
49
49
|
const executeProviderTransaction = async (context, wallet_address, provider_address, method, additionalArgs = []) => {
|
|
50
|
-
const
|
|
50
|
+
const is_owner = wallet_address !== provider_address;
|
|
51
51
|
const response = await prepareTransaction(context, wallet_address, {
|
|
52
52
|
method,
|
|
53
53
|
args: [
|
|
54
54
|
{ value: provider_address, type: 'address' },
|
|
55
55
|
...additionalArgs,
|
|
56
|
-
{ value:
|
|
56
|
+
{ value: is_owner, type: 'bool' },
|
|
57
57
|
],
|
|
58
58
|
});
|
|
59
59
|
if (response.isSuccess && !response.isReadOnly) {
|
|
@@ -18,37 +18,37 @@ const executeReservationTransaction = async (context, wallet_address, method, ad
|
|
|
18
18
|
return defaultValue;
|
|
19
19
|
};
|
|
20
20
|
const create_reservation = async (context, wallet_address, consumer_address, unit_id, reserved_gb) => {
|
|
21
|
-
const
|
|
21
|
+
const is_owner = wallet_address !== consumer_address;
|
|
22
22
|
return executeReservationTransaction(context, wallet_address, 'create_reservation', [
|
|
23
23
|
{ value: consumer_address, type: 'address' },
|
|
24
24
|
{ value: unit_id, type: 'u32' },
|
|
25
25
|
{ value: reserved_gb, type: 'u64' },
|
|
26
|
-
{ value:
|
|
26
|
+
{ value: is_owner, type: 'bool' },
|
|
27
27
|
]);
|
|
28
28
|
};
|
|
29
29
|
const delete_reservation = async (context, wallet_address, consumer_address, reservation_id) => {
|
|
30
|
-
const
|
|
30
|
+
const is_owner = wallet_address !== consumer_address;
|
|
31
31
|
return (executeReservationTransaction(context, wallet_address, 'delete_reservation', [
|
|
32
32
|
{ value: reservation_id, type: 'u32' },
|
|
33
|
-
{ value:
|
|
33
|
+
{ value: is_owner, type: 'bool' },
|
|
34
34
|
]) || 'NotFound');
|
|
35
35
|
};
|
|
36
36
|
const update_inuse_bytes_consumer = async (context, wallet_address, consumer_address, reservation_id, inuse_bytes) => {
|
|
37
|
-
const
|
|
37
|
+
const is_owner = wallet_address !== consumer_address;
|
|
38
38
|
return executeReservationTransaction(context, wallet_address, 'update_inuse_bytes_consumer', [
|
|
39
39
|
{ value: reservation_id, type: 'u32' },
|
|
40
40
|
{ value: consumer_address, type: 'address' },
|
|
41
41
|
{ value: inuse_bytes, type: 'u64' },
|
|
42
|
-
{ value:
|
|
42
|
+
{ value: is_owner, type: 'bool' },
|
|
43
43
|
]);
|
|
44
44
|
};
|
|
45
45
|
const update_inuse_bytes_provider = async (context, wallet_address, provider_address, reservation_id, inuse_bytes) => {
|
|
46
|
-
const
|
|
46
|
+
const is_owner = wallet_address !== provider_address;
|
|
47
47
|
return executeReservationTransaction(context, wallet_address, 'update_inuse_bytes_consumer', [
|
|
48
48
|
{ value: reservation_id, type: 'u32' },
|
|
49
49
|
{ value: provider_address, type: 'address' },
|
|
50
50
|
{ value: inuse_bytes, type: 'u64' },
|
|
51
|
-
{ value:
|
|
51
|
+
{ value: is_owner, type: 'bool' },
|
|
52
52
|
]);
|
|
53
53
|
};
|
|
54
54
|
export { get_reservation, create_reservation, delete_reservation, update_inuse_bytes_consumer, update_inuse_bytes_provider, };
|
package/dist/stellar/unit.js
CHANGED
|
@@ -26,13 +26,13 @@ const get_unit_reservations = async (context, wallet_address, unit_id) => {
|
|
|
26
26
|
return typedUnitReservations;
|
|
27
27
|
};
|
|
28
28
|
const executeUnitTransaction = async (context, wallet_address, provider_address, method, additionalArgs = []) => {
|
|
29
|
-
const
|
|
29
|
+
const is_owner = wallet_address !== provider_address;
|
|
30
30
|
const response = await prepareTransaction(context, wallet_address, {
|
|
31
31
|
method,
|
|
32
32
|
args: [
|
|
33
33
|
{ value: provider_address, type: 'address' },
|
|
34
34
|
...additionalArgs,
|
|
35
|
-
{ value:
|
|
35
|
+
{ value: is_owner, type: 'bool' },
|
|
36
36
|
],
|
|
37
37
|
});
|
|
38
38
|
if (response.isSuccess && !response.isReadOnly) {
|
|
@@ -51,7 +51,7 @@ const delete_unit = async (context, wallet_address, provider_address, unit_id) =
|
|
|
51
51
|
return executeUnitTransaction(context, wallet_address, provider_address, 'delete_unit', [{ value: unit_id, type: 'u32' }]);
|
|
52
52
|
};
|
|
53
53
|
const change_unit_status = async (context, method, wallet_address, provider_address, unit_id, maintenanceStart, maintenanceEnd) => {
|
|
54
|
-
const
|
|
54
|
+
const is_owner = wallet_address !== provider_address;
|
|
55
55
|
const response = await prepareTransaction(context, wallet_address, {
|
|
56
56
|
method: method,
|
|
57
57
|
args: [
|
|
@@ -63,7 +63,7 @@ const change_unit_status = async (context, method, wallet_address, provider_addr
|
|
|
63
63
|
{ value: Math.floor(maintenanceEnd.getTime() / 1000), type: 'u64' },
|
|
64
64
|
]
|
|
65
65
|
: []),
|
|
66
|
-
{ value:
|
|
66
|
+
{ value: is_owner, type: 'bool' },
|
|
67
67
|
],
|
|
68
68
|
});
|
|
69
69
|
if (response.isSuccess && !response.isReadOnly) {
|