@flashbacktech/flashbackclient 0.0.28 → 0.0.29
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/api/client.js +10 -3
- package/dist/api/index.js +40 -3
- package/dist/api/types.js +9 -6
- package/dist/consumer/file/delete.js +9 -3
- package/dist/consumer/file/getUrl.js +9 -3
- package/dist/consumer/file/index.js +16 -9
- package/dist/consumer/file/types.js +2 -1
- package/dist/consumer/file/upload.js +11 -5
- package/dist/consumer/index.js +17 -1
- package/dist/stellar/client.js +57 -54
- package/dist/stellar/consumer.js +17 -8
- package/dist/stellar/decorator.js +4 -1
- package/dist/stellar/index.js +5 -2
- package/dist/stellar/models.js +2 -1
- package/dist/stellar/provider.js +17 -8
- package/dist/stellar/reservation.js +12 -5
- package/dist/stellar/stats.js +6 -3
- package/dist/stellar/transaction.js +25 -18
- package/dist/stellar/unit.js +18 -8
- package/dist/utils/timing.js +5 -1
- package/package.json +3 -4
package/dist/api/client.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ApiClient = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
class ApiClient {
|
|
3
9
|
constructor(baseURL = 'https://api.flashback.tech') {
|
|
4
10
|
this.setAuthToken = (token) => {
|
|
5
11
|
if (token) {
|
|
@@ -21,7 +27,7 @@ export class ApiClient {
|
|
|
21
27
|
const response = await this.apiClient.post('/unit', data);
|
|
22
28
|
return response.data;
|
|
23
29
|
};
|
|
24
|
-
this.apiClient =
|
|
30
|
+
this.apiClient = axios_1.default.create({
|
|
25
31
|
baseURL: baseURL,
|
|
26
32
|
headers: {
|
|
27
33
|
'Content-Type': 'application/json',
|
|
@@ -29,3 +35,4 @@ export class ApiClient {
|
|
|
29
35
|
});
|
|
30
36
|
}
|
|
31
37
|
}
|
|
38
|
+
exports.ApiClient = ApiClient;
|
package/dist/api/index.js
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ApiTypes = exports.ApiClient = void 0;
|
|
37
|
+
const client_1 = require("./client");
|
|
38
|
+
Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return client_1.ApiClient; } });
|
|
39
|
+
const ApiTypes = __importStar(require("./types"));
|
|
40
|
+
exports.ApiTypes = ApiTypes;
|
package/dist/api/types.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModeType = exports.AccessType = exports.StorageType = void 0;
|
|
4
|
+
var StorageType;
|
|
2
5
|
(function (StorageType) {
|
|
3
6
|
StorageType["S3"] = "S3";
|
|
4
7
|
StorageType["GCS"] = "GCS";
|
|
5
8
|
StorageType["AZURE"] = "AZURE";
|
|
6
|
-
})(StorageType || (StorageType = {}));
|
|
7
|
-
|
|
9
|
+
})(StorageType || (exports.StorageType = StorageType = {}));
|
|
10
|
+
var AccessType;
|
|
8
11
|
(function (AccessType) {
|
|
9
12
|
AccessType["READ"] = "READ";
|
|
10
13
|
AccessType["WRITE"] = "WRITE";
|
|
11
14
|
AccessType["ADMIN"] = "ADMIN";
|
|
12
|
-
})(AccessType || (AccessType = {}));
|
|
13
|
-
|
|
15
|
+
})(AccessType || (exports.AccessType = AccessType = {}));
|
|
16
|
+
var ModeType;
|
|
14
17
|
(function (ModeType) {
|
|
15
18
|
ModeType["NORMAL"] = "NORMAL";
|
|
16
19
|
ModeType["MIRROR"] = "MIRROR";
|
|
17
|
-
})(ModeType || (ModeType = {}));
|
|
20
|
+
})(ModeType || (exports.ModeType = ModeType = {}));
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.deleteFile = deleteFile;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
async function deleteFile(client, params) {
|
|
3
9
|
try {
|
|
4
10
|
const { data } = await client.delete('/file/', {
|
|
5
11
|
params,
|
|
@@ -8,7 +14,7 @@ export async function deleteFile(client, params) {
|
|
|
8
14
|
return data;
|
|
9
15
|
}
|
|
10
16
|
catch (error) {
|
|
11
|
-
if (
|
|
17
|
+
if (axios_1.default.isAxiosError(error) && error.response?.data) {
|
|
12
18
|
const errorData = error.response.data;
|
|
13
19
|
throw new Error(`Delete failed: ${errorData.message}`);
|
|
14
20
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getUrl = getUrl;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
async function getUrl(client, params) {
|
|
3
9
|
try {
|
|
4
10
|
const { data } = await client.get('/file/', { params });
|
|
5
11
|
return data;
|
|
6
12
|
}
|
|
7
13
|
catch (error) {
|
|
8
|
-
if (
|
|
14
|
+
if (axios_1.default.isAxiosError(error) && error.response?.data) {
|
|
9
15
|
const errorData = error.response.data;
|
|
10
16
|
throw new Error(`Get URL failed: ${errorData.message}`);
|
|
11
17
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StorageClient = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const upload_1 = require("./upload");
|
|
9
|
+
const getUrl_1 = require("./getUrl");
|
|
10
|
+
const delete_1 = require("./delete");
|
|
11
|
+
class StorageClient {
|
|
6
12
|
constructor(config) {
|
|
7
13
|
this.config = {
|
|
8
14
|
baseUrl: config.baseUrl.replace(/\/$/, ''),
|
|
@@ -12,7 +18,7 @@ export class StorageClient {
|
|
|
12
18
|
...config.headers,
|
|
13
19
|
},
|
|
14
20
|
};
|
|
15
|
-
this.client =
|
|
21
|
+
this.client = axios_1.default.create({
|
|
16
22
|
baseURL: this.config.baseUrl,
|
|
17
23
|
timeout: this.config.timeout,
|
|
18
24
|
headers: this.config.headers,
|
|
@@ -24,7 +30,7 @@ export class StorageClient {
|
|
|
24
30
|
* @returns Promise with the file URL
|
|
25
31
|
*/
|
|
26
32
|
async upload(params) {
|
|
27
|
-
return upload(this.client, params);
|
|
33
|
+
return (0, upload_1.upload)(this.client, params);
|
|
28
34
|
}
|
|
29
35
|
/**
|
|
30
36
|
* Get the URL for a file
|
|
@@ -32,7 +38,7 @@ export class StorageClient {
|
|
|
32
38
|
* @returns Promise with the file URL
|
|
33
39
|
*/
|
|
34
40
|
async getUrl(params) {
|
|
35
|
-
return getUrl(this.client, params);
|
|
41
|
+
return (0, getUrl_1.getUrl)(this.client, params);
|
|
36
42
|
}
|
|
37
43
|
/**
|
|
38
44
|
* Delete a file from storage
|
|
@@ -40,6 +46,7 @@ export class StorageClient {
|
|
|
40
46
|
* @returns Promise indicating success
|
|
41
47
|
*/
|
|
42
48
|
async delete(params) {
|
|
43
|
-
return deleteFile(this.client, params);
|
|
49
|
+
return (0, delete_1.deleteFile)(this.client, params);
|
|
44
50
|
}
|
|
45
51
|
}
|
|
52
|
+
exports.StorageClient = StorageClient;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.upload = upload;
|
|
1
7
|
/// <reference lib="dom" />
|
|
2
8
|
//import type { Blob } from 'buffer';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
9
|
+
const formdata_node_1 = require("formdata-node");
|
|
10
|
+
const axios_1 = __importDefault(require("axios"));
|
|
11
|
+
async function upload(client, params) {
|
|
6
12
|
try {
|
|
7
13
|
let url = '';
|
|
8
14
|
switch (params.type) {
|
|
9
15
|
case 'multipart': {
|
|
10
|
-
const formData = new FormData();
|
|
16
|
+
const formData = new formdata_node_1.FormData();
|
|
11
17
|
formData.append('type', 'multipart');
|
|
12
18
|
formData.append('folderId', params.folderId);
|
|
13
19
|
formData.append('fileId', params.fileId);
|
|
@@ -60,7 +66,7 @@ export async function upload(client, params) {
|
|
|
60
66
|
return { url };
|
|
61
67
|
}
|
|
62
68
|
catch (error) {
|
|
63
|
-
if (
|
|
69
|
+
if (axios_1.default.isAxiosError(error) && error.response?.data) {
|
|
64
70
|
const errorData = error.response.data;
|
|
65
71
|
throw new Error(`Upload failed: ${errorData.message}`);
|
|
66
72
|
}
|
package/dist/consumer/index.js
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./file"), exports);
|
package/dist/stellar/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -7,13 +8,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FlashOnStellarClient = void 0;
|
|
13
|
+
const provider_js_1 = require("./provider.js");
|
|
14
|
+
const consumer_js_1 = require("./consumer.js");
|
|
15
|
+
const unit_js_1 = require("./unit.js");
|
|
16
|
+
const reservation_js_1 = require("./reservation.js");
|
|
17
|
+
const transaction_js_1 = require("./transaction.js");
|
|
18
|
+
const decorator_js_1 = require("./decorator.js");
|
|
19
|
+
const stats_js_1 = require("./stats.js");
|
|
17
20
|
/**
|
|
18
21
|
* Main client class for interacting with the FlashOnStellar system
|
|
19
22
|
* This client provides methods for managing providers, consumers, units, and reservations
|
|
@@ -38,7 +41,7 @@ class FlashOnStellarClient {
|
|
|
38
41
|
* @returns The corresponding public key
|
|
39
42
|
*/
|
|
40
43
|
this.getPublicKey = (privateKey) => {
|
|
41
|
-
return getPublicKeyFromPrivateKey(privateKey);
|
|
44
|
+
return (0, transaction_js_1.getPublicKeyFromPrivateKey)(privateKey);
|
|
42
45
|
};
|
|
43
46
|
/**
|
|
44
47
|
* Signs a transaction using the provided private key using Stellar SDK
|
|
@@ -48,7 +51,7 @@ class FlashOnStellarClient {
|
|
|
48
51
|
* @returns Promise resolving to the signed XDR string
|
|
49
52
|
*/
|
|
50
53
|
this.signTransactionWithKey = async (xdrToSign, privateKey) => {
|
|
51
|
-
const signedTx = await signTransaction(this.getContext(), xdrToSign, privateKey);
|
|
54
|
+
const signedTx = await (0, transaction_js_1.signTransaction)(this.getContext(), xdrToSign, privateKey);
|
|
52
55
|
return signedTx.toXDR();
|
|
53
56
|
};
|
|
54
57
|
// Stats methods
|
|
@@ -58,7 +61,7 @@ class FlashOnStellarClient {
|
|
|
58
61
|
* @returns Promise resolving to DashboardStats object
|
|
59
62
|
*/
|
|
60
63
|
this.get_stats = (wallet_address) => {
|
|
61
|
-
return get_stats(this.getContext(), wallet_address);
|
|
64
|
+
return (0, stats_js_1.get_stats)(this.getContext(), wallet_address);
|
|
62
65
|
};
|
|
63
66
|
// Provider methods
|
|
64
67
|
/**
|
|
@@ -69,7 +72,7 @@ class FlashOnStellarClient {
|
|
|
69
72
|
* @returns Promise resolving to StorageProvider object
|
|
70
73
|
*/
|
|
71
74
|
this.get_provider = (wallet_address, provider_address, load_units) => {
|
|
72
|
-
return get_provider(this.getContext(), wallet_address, provider_address, load_units);
|
|
75
|
+
return (0, provider_js_1.get_provider)(this.getContext(), wallet_address, provider_address, load_units);
|
|
73
76
|
};
|
|
74
77
|
/**
|
|
75
78
|
* Retrieves all units associated with a provider
|
|
@@ -78,7 +81,7 @@ class FlashOnStellarClient {
|
|
|
78
81
|
* @returns Promise resolving to an array of StorageUnit objects
|
|
79
82
|
*/
|
|
80
83
|
this.get_provider_units = (wallet_address, provider_address) => {
|
|
81
|
-
return get_provider_units(this.getContext(), wallet_address, provider_address);
|
|
84
|
+
return (0, provider_js_1.get_provider_units)(this.getContext(), wallet_address, provider_address);
|
|
82
85
|
};
|
|
83
86
|
/**
|
|
84
87
|
* Retrieves a paginated list of providers
|
|
@@ -88,7 +91,7 @@ class FlashOnStellarClient {
|
|
|
88
91
|
* @returns Promise resolving to an array of StorageProvider objects
|
|
89
92
|
*/
|
|
90
93
|
this.get_providers = (wallet_address, skip = 0, take = 10) => {
|
|
91
|
-
return get_providers(this.getContext(), wallet_address, skip, take);
|
|
94
|
+
return (0, provider_js_1.get_providers)(this.getContext(), wallet_address, skip, take);
|
|
92
95
|
};
|
|
93
96
|
/**
|
|
94
97
|
* Gets the total count of providers in the system
|
|
@@ -96,7 +99,7 @@ class FlashOnStellarClient {
|
|
|
96
99
|
* @returns Promise resolving to the total number of providers
|
|
97
100
|
*/
|
|
98
101
|
this.get_provider_count = (wallet_address) => {
|
|
99
|
-
return get_provider_count(this.getContext(), wallet_address);
|
|
102
|
+
return (0, provider_js_1.get_provider_count)(this.getContext(), wallet_address);
|
|
100
103
|
};
|
|
101
104
|
// Consumer methods
|
|
102
105
|
/**
|
|
@@ -107,7 +110,7 @@ class FlashOnStellarClient {
|
|
|
107
110
|
* @returns Promise resolving to StorageConsumer object
|
|
108
111
|
*/
|
|
109
112
|
this.get_consumer = (wallet_address, consumer_address, load_reservations) => {
|
|
110
|
-
return get_consumer(this.getContext(), wallet_address, consumer_address, load_reservations);
|
|
113
|
+
return (0, consumer_js_1.get_consumer)(this.getContext(), wallet_address, consumer_address, load_reservations);
|
|
111
114
|
};
|
|
112
115
|
/**
|
|
113
116
|
* Retrieves a paginated list of consumers
|
|
@@ -117,7 +120,7 @@ class FlashOnStellarClient {
|
|
|
117
120
|
* @returns Promise resolving to an array of StorageConsumer objects
|
|
118
121
|
*/
|
|
119
122
|
this.get_consumers = (wallet_address, skip = 0, take = 10) => {
|
|
120
|
-
return get_consumers(this.getContext(), wallet_address, skip, take);
|
|
123
|
+
return (0, consumer_js_1.get_consumers)(this.getContext(), wallet_address, skip, take);
|
|
121
124
|
};
|
|
122
125
|
/**
|
|
123
126
|
* Gets the total count of consumers in the system
|
|
@@ -125,7 +128,7 @@ class FlashOnStellarClient {
|
|
|
125
128
|
* @returns Promise resolving to the total number of consumers
|
|
126
129
|
*/
|
|
127
130
|
this.get_consumer_count = (wallet_address) => {
|
|
128
|
-
return get_consumer_count(this.getContext(), wallet_address);
|
|
131
|
+
return (0, consumer_js_1.get_consumer_count)(this.getContext(), wallet_address);
|
|
129
132
|
};
|
|
130
133
|
/**
|
|
131
134
|
* Retrieves all reservations associated with a consumer
|
|
@@ -134,7 +137,7 @@ class FlashOnStellarClient {
|
|
|
134
137
|
* @returns Promise resolving to an array of StorageReservation objects
|
|
135
138
|
*/
|
|
136
139
|
this.get_consumer_reservations = (wallet_address, consumer_address) => {
|
|
137
|
-
return get_consumer_reservations(this.getContext(), wallet_address, consumer_address);
|
|
140
|
+
return (0, consumer_js_1.get_consumer_reservations)(this.getContext(), wallet_address, consumer_address);
|
|
138
141
|
};
|
|
139
142
|
/**
|
|
140
143
|
* Retrieves storage unit information
|
|
@@ -144,7 +147,7 @@ class FlashOnStellarClient {
|
|
|
144
147
|
* @returns Promise resolving to StorageUnit object
|
|
145
148
|
*/
|
|
146
149
|
this.get_unit = (wallet_address, unit_id, load_reservations) => {
|
|
147
|
-
return get_unit(this.getContext(), wallet_address, unit_id, load_reservations);
|
|
150
|
+
return (0, unit_js_1.get_unit)(this.getContext(), wallet_address, unit_id, load_reservations);
|
|
148
151
|
};
|
|
149
152
|
/**
|
|
150
153
|
* Retrieves all reservations for a specific storage unit
|
|
@@ -153,7 +156,7 @@ class FlashOnStellarClient {
|
|
|
153
156
|
* @returns Promise resolving to an array of StorageReservation objects
|
|
154
157
|
*/
|
|
155
158
|
this.get_unit_reservations = (wallet_address, unit_id) => {
|
|
156
|
-
return get_unit_reservations(this.getContext(), wallet_address, unit_id);
|
|
159
|
+
return (0, unit_js_1.get_unit_reservations)(this.getContext(), wallet_address, unit_id);
|
|
157
160
|
};
|
|
158
161
|
// Reservation methods
|
|
159
162
|
/**
|
|
@@ -163,7 +166,7 @@ class FlashOnStellarClient {
|
|
|
163
166
|
* @returns Promise resolving to StorageReservation object
|
|
164
167
|
*/
|
|
165
168
|
this.get_reservation = (wallet_address, reservation_id) => {
|
|
166
|
-
return get_reservation(this.getContext(), wallet_address, reservation_id);
|
|
169
|
+
return (0, reservation_js_1.get_reservation)(this.getContext(), wallet_address, reservation_id);
|
|
167
170
|
};
|
|
168
171
|
this.signTransaction = config.signTransaction;
|
|
169
172
|
this.contractAddress = config.contractAddress;
|
|
@@ -179,7 +182,7 @@ class FlashOnStellarClient {
|
|
|
179
182
|
* @throws Will throw if provider address is already registered
|
|
180
183
|
*/
|
|
181
184
|
register_provider(wallet_address, provider_address, provider_description) {
|
|
182
|
-
return register_provider(this.getContext(), wallet_address, provider_address, provider_description);
|
|
185
|
+
return (0, provider_js_1.register_provider)(this.getContext(), wallet_address, provider_address, provider_description);
|
|
183
186
|
}
|
|
184
187
|
/**
|
|
185
188
|
* Deletes a provider from the system
|
|
@@ -189,7 +192,7 @@ class FlashOnStellarClient {
|
|
|
189
192
|
* @requires Signature - This method requires a transaction signature
|
|
190
193
|
*/
|
|
191
194
|
delete_provider(wallet_address, provider_address) {
|
|
192
|
-
return delete_provider(this.getContext(), wallet_address, provider_address);
|
|
195
|
+
return (0, provider_js_1.delete_provider)(this.getContext(), wallet_address, provider_address);
|
|
193
196
|
}
|
|
194
197
|
/**
|
|
195
198
|
* Updates provider information
|
|
@@ -200,7 +203,7 @@ class FlashOnStellarClient {
|
|
|
200
203
|
* @requires Signature - This method requires a transaction signature
|
|
201
204
|
*/
|
|
202
205
|
update_provider(wallet_address, provider_address, provider_description) {
|
|
203
|
-
return update_provider(this.getContext(), wallet_address, provider_address, provider_description);
|
|
206
|
+
return (0, provider_js_1.update_provider)(this.getContext(), wallet_address, provider_address, provider_description);
|
|
204
207
|
}
|
|
205
208
|
/**
|
|
206
209
|
* Registers a new consumer in the system
|
|
@@ -211,13 +214,13 @@ class FlashOnStellarClient {
|
|
|
211
214
|
* @requires Signature - This method requires a transaction signature
|
|
212
215
|
*/
|
|
213
216
|
register_consumer(wallet_address, consumer_address, consumer_description) {
|
|
214
|
-
return register_consumer(this.getContext(), wallet_address, consumer_address, consumer_description);
|
|
217
|
+
return (0, consumer_js_1.register_consumer)(this.getContext(), wallet_address, consumer_address, consumer_description);
|
|
215
218
|
}
|
|
216
219
|
delete_consumer(wallet_address, consumer_address) {
|
|
217
|
-
return delete_consumer(this.getContext(), wallet_address, consumer_address);
|
|
220
|
+
return (0, consumer_js_1.delete_consumer)(this.getContext(), wallet_address, consumer_address);
|
|
218
221
|
}
|
|
219
222
|
update_consumer(wallet_address, consumer_address, consumer_description) {
|
|
220
|
-
return update_consumer(this.getContext(), wallet_address, consumer_address, consumer_description);
|
|
223
|
+
return (0, consumer_js_1.update_consumer)(this.getContext(), wallet_address, consumer_address, consumer_description);
|
|
221
224
|
}
|
|
222
225
|
// Unit methods
|
|
223
226
|
/**
|
|
@@ -230,7 +233,7 @@ class FlashOnStellarClient {
|
|
|
230
233
|
* @requires Signature - This method requires a transaction signature
|
|
231
234
|
*/
|
|
232
235
|
register_unit(wallet_address, provider_address, capacity, endpoint) {
|
|
233
|
-
return register_unit(this.getContext(), wallet_address, provider_address, capacity, endpoint);
|
|
236
|
+
return (0, unit_js_1.register_unit)(this.getContext(), wallet_address, provider_address, capacity, endpoint);
|
|
234
237
|
}
|
|
235
238
|
/**
|
|
236
239
|
* Deletes a storage unit from the system
|
|
@@ -242,7 +245,7 @@ class FlashOnStellarClient {
|
|
|
242
245
|
* @throws Will throw if unit has active reservations
|
|
243
246
|
*/
|
|
244
247
|
delete_unit(wallet_address, provider_address, unit_id) {
|
|
245
|
-
return delete_unit(this.getContext(), wallet_address, provider_address, unit_id);
|
|
248
|
+
return (0, unit_js_1.delete_unit)(this.getContext(), wallet_address, provider_address, unit_id);
|
|
246
249
|
}
|
|
247
250
|
/**
|
|
248
251
|
* Places a storage unit into maintenance mode
|
|
@@ -256,7 +259,7 @@ class FlashOnStellarClient {
|
|
|
256
259
|
* @throws Will throw if unit has active reservations that conflict with the maintenance window
|
|
257
260
|
*/
|
|
258
261
|
enter_maintenance(wallet_address, provider_address, unit_id, maintenance_start, maintenance_end) {
|
|
259
|
-
return enter_maintenance(this.getContext(), wallet_address, provider_address, unit_id, maintenance_start, maintenance_end);
|
|
262
|
+
return (0, unit_js_1.enter_maintenance)(this.getContext(), wallet_address, provider_address, unit_id, maintenance_start, maintenance_end);
|
|
260
263
|
}
|
|
261
264
|
/**
|
|
262
265
|
* Exits maintenance mode for a storage unit
|
|
@@ -268,7 +271,7 @@ class FlashOnStellarClient {
|
|
|
268
271
|
* @throws Will throw if unit is not in maintenance mode
|
|
269
272
|
*/
|
|
270
273
|
exit_maintenance(wallet_address, provider_address, unit_id) {
|
|
271
|
-
return exit_maintenance(this.getContext(), wallet_address, provider_address, unit_id);
|
|
274
|
+
return (0, unit_js_1.exit_maintenance)(this.getContext(), wallet_address, provider_address, unit_id);
|
|
272
275
|
}
|
|
273
276
|
/**
|
|
274
277
|
* Places a storage unit into decommissioning mode
|
|
@@ -281,7 +284,7 @@ class FlashOnStellarClient {
|
|
|
281
284
|
* @throws Will throw if unit has active reservations
|
|
282
285
|
*/
|
|
283
286
|
enter_decommissioning(wallet_address, provider_address, unit_id) {
|
|
284
|
-
return enter_decommissioning(this.getContext(), wallet_address, provider_address, unit_id);
|
|
287
|
+
return (0, unit_js_1.enter_decommissioning)(this.getContext(), wallet_address, provider_address, unit_id);
|
|
285
288
|
}
|
|
286
289
|
/**
|
|
287
290
|
* Exits decommissioning mode for a storage unit
|
|
@@ -294,7 +297,7 @@ class FlashOnStellarClient {
|
|
|
294
297
|
* @throws Will throw if unit is not in decommissioning mode
|
|
295
298
|
*/
|
|
296
299
|
exit_decommissioning(wallet_address, provider_address, unit_id) {
|
|
297
|
-
return exit_decommissioning(this.getContext(), wallet_address, provider_address, unit_id);
|
|
300
|
+
return (0, unit_js_1.exit_decommissioning)(this.getContext(), wallet_address, provider_address, unit_id);
|
|
298
301
|
}
|
|
299
302
|
/**
|
|
300
303
|
* Creates a new storage reservation
|
|
@@ -308,7 +311,7 @@ class FlashOnStellarClient {
|
|
|
308
311
|
* @throws Will throw if unit is in maintenance or decommissioning mode
|
|
309
312
|
*/
|
|
310
313
|
reserve_unit(wallet_address, consumer_address, unit_id, reserved_gb) {
|
|
311
|
-
return create_reservation(this.getContext(), wallet_address, consumer_address, unit_id, reserved_gb);
|
|
314
|
+
return (0, reservation_js_1.create_reservation)(this.getContext(), wallet_address, consumer_address, unit_id, reserved_gb);
|
|
312
315
|
}
|
|
313
316
|
/**
|
|
314
317
|
* Deletes an existing reservation
|
|
@@ -320,7 +323,7 @@ class FlashOnStellarClient {
|
|
|
320
323
|
* @throws Will throw if reservation has non-zero inuse_bytes
|
|
321
324
|
*/
|
|
322
325
|
delete_reservation(wallet_address, consumer_address, reservation_id) {
|
|
323
|
-
return delete_reservation(this.getContext(), wallet_address, consumer_address, reservation_id);
|
|
326
|
+
return (0, reservation_js_1.delete_reservation)(this.getContext(), wallet_address, consumer_address, reservation_id);
|
|
324
327
|
}
|
|
325
328
|
/**
|
|
326
329
|
* Updates the amount of storage currently in use by a consumer
|
|
@@ -333,7 +336,7 @@ class FlashOnStellarClient {
|
|
|
333
336
|
* @throws Will throw if inuse_bytes exceeds reserved amount
|
|
334
337
|
*/
|
|
335
338
|
update_inuse_bytes_consumer(wallet_address, consumer_address, reservation_id, inuse_bytes) {
|
|
336
|
-
return update_inuse_bytes_consumer(this.getContext(), wallet_address, consumer_address, reservation_id, inuse_bytes);
|
|
339
|
+
return (0, reservation_js_1.update_inuse_bytes_consumer)(this.getContext(), wallet_address, consumer_address, reservation_id, inuse_bytes);
|
|
337
340
|
}
|
|
338
341
|
/**
|
|
339
342
|
* Updates the amount of storage currently in use, reported by provider
|
|
@@ -347,104 +350,104 @@ class FlashOnStellarClient {
|
|
|
347
350
|
* @throws Will throw if provider's report differs significantly from consumer's report
|
|
348
351
|
*/
|
|
349
352
|
update_inuse_bytes_provider(wallet_address, provider_address, reservation_id, inuse_bytes) {
|
|
350
|
-
return update_inuse_bytes_provider(this.getContext(), wallet_address, provider_address, reservation_id, inuse_bytes);
|
|
353
|
+
return (0, reservation_js_1.update_inuse_bytes_provider)(this.getContext(), wallet_address, provider_address, reservation_id, inuse_bytes);
|
|
351
354
|
}
|
|
352
355
|
}
|
|
356
|
+
exports.FlashOnStellarClient = FlashOnStellarClient;
|
|
353
357
|
__decorate([
|
|
354
|
-
requiresSignature,
|
|
358
|
+
decorator_js_1.requiresSignature,
|
|
355
359
|
__metadata("design:type", Function),
|
|
356
360
|
__metadata("design:paramtypes", [String, String, String]),
|
|
357
361
|
__metadata("design:returntype", void 0)
|
|
358
362
|
], FlashOnStellarClient.prototype, "register_provider", null);
|
|
359
363
|
__decorate([
|
|
360
|
-
requiresSignature,
|
|
364
|
+
decorator_js_1.requiresSignature,
|
|
361
365
|
__metadata("design:type", Function),
|
|
362
366
|
__metadata("design:paramtypes", [String, String]),
|
|
363
367
|
__metadata("design:returntype", void 0)
|
|
364
368
|
], FlashOnStellarClient.prototype, "delete_provider", null);
|
|
365
369
|
__decorate([
|
|
366
|
-
requiresSignature,
|
|
370
|
+
decorator_js_1.requiresSignature,
|
|
367
371
|
__metadata("design:type", Function),
|
|
368
372
|
__metadata("design:paramtypes", [String, String, String]),
|
|
369
373
|
__metadata("design:returntype", void 0)
|
|
370
374
|
], FlashOnStellarClient.prototype, "update_provider", null);
|
|
371
375
|
__decorate([
|
|
372
|
-
requiresSignature,
|
|
376
|
+
decorator_js_1.requiresSignature,
|
|
373
377
|
__metadata("design:type", Function),
|
|
374
378
|
__metadata("design:paramtypes", [String, String, String]),
|
|
375
379
|
__metadata("design:returntype", void 0)
|
|
376
380
|
], FlashOnStellarClient.prototype, "register_consumer", null);
|
|
377
381
|
__decorate([
|
|
378
|
-
requiresSignature,
|
|
382
|
+
decorator_js_1.requiresSignature,
|
|
379
383
|
__metadata("design:type", Function),
|
|
380
384
|
__metadata("design:paramtypes", [String, String]),
|
|
381
385
|
__metadata("design:returntype", void 0)
|
|
382
386
|
], FlashOnStellarClient.prototype, "delete_consumer", null);
|
|
383
387
|
__decorate([
|
|
384
|
-
requiresSignature,
|
|
388
|
+
decorator_js_1.requiresSignature,
|
|
385
389
|
__metadata("design:type", Function),
|
|
386
390
|
__metadata("design:paramtypes", [String, String, String]),
|
|
387
391
|
__metadata("design:returntype", void 0)
|
|
388
392
|
], FlashOnStellarClient.prototype, "update_consumer", null);
|
|
389
393
|
__decorate([
|
|
390
|
-
requiresSignature,
|
|
394
|
+
decorator_js_1.requiresSignature,
|
|
391
395
|
__metadata("design:type", Function),
|
|
392
396
|
__metadata("design:paramtypes", [String, String, Number, String]),
|
|
393
397
|
__metadata("design:returntype", void 0)
|
|
394
398
|
], FlashOnStellarClient.prototype, "register_unit", null);
|
|
395
399
|
__decorate([
|
|
396
|
-
requiresSignature,
|
|
400
|
+
decorator_js_1.requiresSignature,
|
|
397
401
|
__metadata("design:type", Function),
|
|
398
402
|
__metadata("design:paramtypes", [String, String, Number]),
|
|
399
403
|
__metadata("design:returntype", void 0)
|
|
400
404
|
], FlashOnStellarClient.prototype, "delete_unit", null);
|
|
401
405
|
__decorate([
|
|
402
|
-
requiresSignature,
|
|
406
|
+
decorator_js_1.requiresSignature,
|
|
403
407
|
__metadata("design:type", Function),
|
|
404
408
|
__metadata("design:paramtypes", [String, String, Number, Date,
|
|
405
409
|
Date]),
|
|
406
410
|
__metadata("design:returntype", void 0)
|
|
407
411
|
], FlashOnStellarClient.prototype, "enter_maintenance", null);
|
|
408
412
|
__decorate([
|
|
409
|
-
requiresSignature,
|
|
413
|
+
decorator_js_1.requiresSignature,
|
|
410
414
|
__metadata("design:type", Function),
|
|
411
415
|
__metadata("design:paramtypes", [String, String, Number]),
|
|
412
416
|
__metadata("design:returntype", void 0)
|
|
413
417
|
], FlashOnStellarClient.prototype, "exit_maintenance", null);
|
|
414
418
|
__decorate([
|
|
415
|
-
requiresSignature,
|
|
419
|
+
decorator_js_1.requiresSignature,
|
|
416
420
|
__metadata("design:type", Function),
|
|
417
421
|
__metadata("design:paramtypes", [String, String, Number]),
|
|
418
422
|
__metadata("design:returntype", void 0)
|
|
419
423
|
], FlashOnStellarClient.prototype, "enter_decommissioning", null);
|
|
420
424
|
__decorate([
|
|
421
|
-
requiresSignature,
|
|
425
|
+
decorator_js_1.requiresSignature,
|
|
422
426
|
__metadata("design:type", Function),
|
|
423
427
|
__metadata("design:paramtypes", [String, String, Number]),
|
|
424
428
|
__metadata("design:returntype", void 0)
|
|
425
429
|
], FlashOnStellarClient.prototype, "exit_decommissioning", null);
|
|
426
430
|
__decorate([
|
|
427
|
-
requiresSignature,
|
|
431
|
+
decorator_js_1.requiresSignature,
|
|
428
432
|
__metadata("design:type", Function),
|
|
429
433
|
__metadata("design:paramtypes", [String, String, Number, Number]),
|
|
430
434
|
__metadata("design:returntype", void 0)
|
|
431
435
|
], FlashOnStellarClient.prototype, "reserve_unit", null);
|
|
432
436
|
__decorate([
|
|
433
|
-
requiresSignature,
|
|
437
|
+
decorator_js_1.requiresSignature,
|
|
434
438
|
__metadata("design:type", Function),
|
|
435
439
|
__metadata("design:paramtypes", [String, String, Number]),
|
|
436
440
|
__metadata("design:returntype", void 0)
|
|
437
441
|
], FlashOnStellarClient.prototype, "delete_reservation", null);
|
|
438
442
|
__decorate([
|
|
439
|
-
requiresSignature,
|
|
443
|
+
decorator_js_1.requiresSignature,
|
|
440
444
|
__metadata("design:type", Function),
|
|
441
445
|
__metadata("design:paramtypes", [String, String, Number, Number]),
|
|
442
446
|
__metadata("design:returntype", void 0)
|
|
443
447
|
], FlashOnStellarClient.prototype, "update_inuse_bytes_consumer", null);
|
|
444
448
|
__decorate([
|
|
445
|
-
requiresSignature,
|
|
449
|
+
decorator_js_1.requiresSignature,
|
|
446
450
|
__metadata("design:type", Function),
|
|
447
451
|
__metadata("design:paramtypes", [String, String, Number, Number]),
|
|
448
452
|
__metadata("design:returntype", void 0)
|
|
449
453
|
], FlashOnStellarClient.prototype, "update_inuse_bytes_provider", null);
|
|
450
|
-
export { FlashOnStellarClient };
|
package/dist/stellar/consumer.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update_consumer = exports.delete_consumer = exports.register_consumer = exports.get_consumer_reservations = exports.get_consumer_count = exports.get_consumers = exports.get_consumer = void 0;
|
|
4
|
+
const transaction_js_1 = require("./transaction.js");
|
|
2
5
|
const get_consumer = async (context, wallet_address, consumer_address, load_reservations = false) => {
|
|
3
6
|
const [consumer, reservations] = await Promise.all([
|
|
4
|
-
prepareTransaction(context, wallet_address, {
|
|
7
|
+
(0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
5
8
|
method: 'get_consumer',
|
|
6
9
|
args: [{ value: consumer_address, type: 'address' }],
|
|
7
10
|
}),
|
|
@@ -15,8 +18,9 @@ const get_consumer = async (context, wallet_address, consumer_address, load_rese
|
|
|
15
18
|
}
|
|
16
19
|
return typedConsumerData;
|
|
17
20
|
};
|
|
21
|
+
exports.get_consumer = get_consumer;
|
|
18
22
|
const get_consumers = async (context, wallet_address, skip = 0, take = 10) => {
|
|
19
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
23
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
20
24
|
method: 'get_consumers',
|
|
21
25
|
args: [
|
|
22
26
|
{ value: skip, type: 'u32' },
|
|
@@ -30,14 +34,16 @@ const get_consumers = async (context, wallet_address, skip = 0, take = 10) => {
|
|
|
30
34
|
const consumersObj = response.result;
|
|
31
35
|
return new Map(Object.entries(consumersObj));
|
|
32
36
|
};
|
|
37
|
+
exports.get_consumers = get_consumers;
|
|
33
38
|
const get_consumer_count = async (context, wallet_address) => {
|
|
34
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
39
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
35
40
|
method: 'get_consumer_count',
|
|
36
41
|
});
|
|
37
42
|
return response.isSuccess ? response.result : 0;
|
|
38
43
|
};
|
|
44
|
+
exports.get_consumer_count = get_consumer_count;
|
|
39
45
|
const get_consumer_reservations = async (context, wallet_address, consumer_address) => {
|
|
40
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
46
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
41
47
|
method: 'get_consumer_reservations',
|
|
42
48
|
args: [{ value: consumer_address, type: 'address' }],
|
|
43
49
|
});
|
|
@@ -46,9 +52,10 @@ const get_consumer_reservations = async (context, wallet_address, consumer_addre
|
|
|
46
52
|
: new Map();
|
|
47
53
|
return typedConsumerReservations;
|
|
48
54
|
};
|
|
55
|
+
exports.get_consumer_reservations = get_consumer_reservations;
|
|
49
56
|
const executeConsumerTransaction = async (context, wallet_address, consumer_address, method, additionalArgs = []) => {
|
|
50
57
|
const is_owner = wallet_address !== consumer_address;
|
|
51
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
58
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
52
59
|
method,
|
|
53
60
|
args: [
|
|
54
61
|
{ value: consumer_address, type: 'address' },
|
|
@@ -58,7 +65,7 @@ const executeConsumerTransaction = async (context, wallet_address, consumer_addr
|
|
|
58
65
|
});
|
|
59
66
|
if (response.isSuccess && !response.isReadOnly) {
|
|
60
67
|
const signedTxXDR = await context.signTransaction(response.result);
|
|
61
|
-
await sendTransaction(context, signedTxXDR);
|
|
68
|
+
await (0, transaction_js_1.sendTransaction)(context, signedTxXDR);
|
|
62
69
|
}
|
|
63
70
|
};
|
|
64
71
|
const register_consumer = async (context, wallet_address, consumer_address, consumer_description) => {
|
|
@@ -66,12 +73,14 @@ const register_consumer = async (context, wallet_address, consumer_address, cons
|
|
|
66
73
|
{ value: consumer_description, type: 'string' },
|
|
67
74
|
]);
|
|
68
75
|
};
|
|
76
|
+
exports.register_consumer = register_consumer;
|
|
69
77
|
const delete_consumer = async (context, wallet_address, consumer_address) => {
|
|
70
78
|
await executeConsumerTransaction(context, wallet_address, consumer_address, 'delete_consumer');
|
|
71
79
|
};
|
|
80
|
+
exports.delete_consumer = delete_consumer;
|
|
72
81
|
const update_consumer = async (context, wallet_address, consumer_address, consumer_description) => {
|
|
73
82
|
await executeConsumerTransaction(context, wallet_address, consumer_address, 'update_consumer', [
|
|
74
83
|
{ value: consumer_description, type: 'string' },
|
|
75
84
|
]);
|
|
76
85
|
};
|
|
77
|
-
|
|
86
|
+
exports.update_consumer = update_consumer;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requiresSignature = requiresSignature;
|
|
4
|
+
function requiresSignature(target, propertyKey, descriptor) {
|
|
2
5
|
if (descriptor) {
|
|
3
6
|
// Method decorator
|
|
4
7
|
const originalMethod = descriptor.value;
|
package/dist/stellar/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlashOnStellarClient = void 0;
|
|
4
|
+
const client_js_1 = require("./client.js");
|
|
5
|
+
Object.defineProperty(exports, "FlashOnStellarClient", { enumerable: true, get: function () { return client_js_1.FlashOnStellarClient; } });
|
package/dist/stellar/models.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/stellar/provider.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update_provider = exports.delete_provider = exports.register_provider = exports.get_provider_count = exports.get_providers = exports.get_provider_units = exports.get_provider = void 0;
|
|
4
|
+
const transaction_js_1 = require("./transaction.js");
|
|
2
5
|
const get_provider = async (context, wallet_address, provider_address, load_units = false) => {
|
|
3
6
|
const [provider, units] = await Promise.all([
|
|
4
|
-
prepareTransaction(context, wallet_address, {
|
|
7
|
+
(0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
5
8
|
method: 'get_provider',
|
|
6
9
|
args: [{ value: provider_address, type: 'address' }],
|
|
7
10
|
}),
|
|
@@ -15,8 +18,9 @@ const get_provider = async (context, wallet_address, provider_address, load_unit
|
|
|
15
18
|
}
|
|
16
19
|
return typedProviderData;
|
|
17
20
|
};
|
|
21
|
+
exports.get_provider = get_provider;
|
|
18
22
|
const get_provider_units = async (context, wallet_address, provider_address) => {
|
|
19
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
23
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
20
24
|
method: 'get_provider_units',
|
|
21
25
|
args: [{ value: provider_address, type: 'address' }],
|
|
22
26
|
});
|
|
@@ -25,8 +29,9 @@ const get_provider_units = async (context, wallet_address, provider_address) =>
|
|
|
25
29
|
: new Map();
|
|
26
30
|
return typedProviderUnits;
|
|
27
31
|
};
|
|
32
|
+
exports.get_provider_units = get_provider_units;
|
|
28
33
|
const get_providers = async (context, wallet_address, skip = 0, take = 10) => {
|
|
29
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
34
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
30
35
|
method: 'get_providers',
|
|
31
36
|
args: [
|
|
32
37
|
{ value: skip, type: 'u32' },
|
|
@@ -39,16 +44,18 @@ const get_providers = async (context, wallet_address, skip = 0, take = 10) => {
|
|
|
39
44
|
const providersObj = response.result;
|
|
40
45
|
return new Map(Object.entries(providersObj));
|
|
41
46
|
};
|
|
47
|
+
exports.get_providers = get_providers;
|
|
42
48
|
const get_provider_count = async (context, wallet_address) => {
|
|
43
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
49
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
44
50
|
method: 'get_provider_count',
|
|
45
51
|
});
|
|
46
52
|
return response.isSuccess ? response.result : 0;
|
|
47
53
|
};
|
|
54
|
+
exports.get_provider_count = get_provider_count;
|
|
48
55
|
// Helper function to handle write-mode contract calls
|
|
49
56
|
const executeProviderTransaction = async (context, wallet_address, provider_address, method, additionalArgs = []) => {
|
|
50
57
|
const is_owner = wallet_address !== provider_address;
|
|
51
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
58
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
52
59
|
method,
|
|
53
60
|
args: [
|
|
54
61
|
{ value: provider_address, type: 'address' },
|
|
@@ -58,7 +65,7 @@ const executeProviderTransaction = async (context, wallet_address, provider_addr
|
|
|
58
65
|
});
|
|
59
66
|
if (response.isSuccess && !response.isReadOnly) {
|
|
60
67
|
const signedTxXDR = await context.signTransaction(response.result);
|
|
61
|
-
await sendTransaction(context, signedTxXDR);
|
|
68
|
+
await (0, transaction_js_1.sendTransaction)(context, signedTxXDR);
|
|
62
69
|
}
|
|
63
70
|
};
|
|
64
71
|
const register_provider = async (context, wallet_address, provider_address, provider_description) => {
|
|
@@ -66,12 +73,14 @@ const register_provider = async (context, wallet_address, provider_address, prov
|
|
|
66
73
|
{ value: provider_description, type: 'string' },
|
|
67
74
|
]);
|
|
68
75
|
};
|
|
76
|
+
exports.register_provider = register_provider;
|
|
69
77
|
const delete_provider = async (context, wallet_address, provider_address) => {
|
|
70
78
|
await executeProviderTransaction(context, wallet_address, provider_address, 'delete_provider');
|
|
71
79
|
};
|
|
80
|
+
exports.delete_provider = delete_provider;
|
|
72
81
|
const update_provider = async (context, wallet_address, provider_address, provider_description) => {
|
|
73
82
|
await executeProviderTransaction(context, wallet_address, provider_address, 'update_provider', [
|
|
74
83
|
{ value: provider_description, type: 'string' },
|
|
75
84
|
]);
|
|
76
85
|
};
|
|
77
|
-
|
|
86
|
+
exports.update_provider = update_provider;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update_inuse_bytes_provider = exports.update_inuse_bytes_consumer = exports.delete_reservation = exports.create_reservation = exports.get_reservation = void 0;
|
|
4
|
+
const transaction_js_1 = require("./transaction.js");
|
|
2
5
|
const get_reservation = async (context, wallet_address, reservation_id) => {
|
|
3
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
6
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
4
7
|
method: 'get_reservation',
|
|
5
8
|
args: [{ value: reservation_id, type: 'u32' }],
|
|
6
9
|
});
|
|
7
10
|
return response.isSuccess ? response.result : null;
|
|
8
11
|
};
|
|
12
|
+
exports.get_reservation = get_reservation;
|
|
9
13
|
const executeReservationTransaction = async (context, wallet_address, method, additionalArgs = [], defaultValue) => {
|
|
10
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
14
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
11
15
|
method,
|
|
12
16
|
args: additionalArgs,
|
|
13
17
|
});
|
|
14
18
|
if (response.isSuccess && !response.isReadOnly) {
|
|
15
19
|
const signedTxXDR = await context.signTransaction(response.result);
|
|
16
|
-
return sendTransaction(context, signedTxXDR);
|
|
20
|
+
return (0, transaction_js_1.sendTransaction)(context, signedTxXDR);
|
|
17
21
|
}
|
|
18
22
|
return defaultValue;
|
|
19
23
|
};
|
|
@@ -26,6 +30,7 @@ const create_reservation = async (context, wallet_address, consumer_address, uni
|
|
|
26
30
|
{ value: is_owner, type: 'bool' },
|
|
27
31
|
]);
|
|
28
32
|
};
|
|
33
|
+
exports.create_reservation = create_reservation;
|
|
29
34
|
const delete_reservation = async (context, wallet_address, consumer_address, reservation_id) => {
|
|
30
35
|
const is_owner = wallet_address !== consumer_address;
|
|
31
36
|
return (executeReservationTransaction(context, wallet_address, 'delete_reservation', [
|
|
@@ -33,6 +38,7 @@ const delete_reservation = async (context, wallet_address, consumer_address, res
|
|
|
33
38
|
{ value: is_owner, type: 'bool' },
|
|
34
39
|
]) || 'NotFound');
|
|
35
40
|
};
|
|
41
|
+
exports.delete_reservation = delete_reservation;
|
|
36
42
|
const update_inuse_bytes_consumer = async (context, wallet_address, consumer_address, reservation_id, inuse_bytes) => {
|
|
37
43
|
const is_owner = wallet_address !== consumer_address;
|
|
38
44
|
return executeReservationTransaction(context, wallet_address, 'update_inuse_bytes_consumer', [
|
|
@@ -42,6 +48,7 @@ const update_inuse_bytes_consumer = async (context, wallet_address, consumer_add
|
|
|
42
48
|
{ value: is_owner, type: 'bool' },
|
|
43
49
|
]);
|
|
44
50
|
};
|
|
51
|
+
exports.update_inuse_bytes_consumer = update_inuse_bytes_consumer;
|
|
45
52
|
const update_inuse_bytes_provider = async (context, wallet_address, provider_address, reservation_id, inuse_bytes) => {
|
|
46
53
|
const is_owner = wallet_address !== provider_address;
|
|
47
54
|
return executeReservationTransaction(context, wallet_address, 'update_inuse_bytes_consumer', [
|
|
@@ -51,4 +58,4 @@ const update_inuse_bytes_provider = async (context, wallet_address, provider_add
|
|
|
51
58
|
{ value: is_owner, type: 'bool' },
|
|
52
59
|
]);
|
|
53
60
|
};
|
|
54
|
-
|
|
61
|
+
exports.update_inuse_bytes_provider = update_inuse_bytes_provider;
|
package/dist/stellar/stats.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get_stats = void 0;
|
|
4
|
+
const transaction_js_1 = require("./transaction.js");
|
|
2
5
|
const get_stats = async (context, wallet_address) => {
|
|
3
|
-
const stats = await prepareTransaction(context, wallet_address, {
|
|
6
|
+
const stats = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
4
7
|
method: 'get_stats',
|
|
5
8
|
args: [],
|
|
6
9
|
});
|
|
7
10
|
return stats.isSuccess ? stats.result : null;
|
|
8
11
|
};
|
|
9
|
-
|
|
12
|
+
exports.get_stats = get_stats;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPublicKeyFromPrivateKey = exports.getNetwork = exports.signTransaction = exports.sendTransaction = exports.prepareTransaction = void 0;
|
|
4
|
+
const timing_js_1 = require("../utils/timing.js");
|
|
2
5
|
// Polyfill for BigInt JSON serialization
|
|
3
6
|
BigInt.prototype.toJSON = function () {
|
|
4
7
|
return this.toString();
|
|
5
8
|
};
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
const stellar_sdk_1 = require("@stellar/stellar-sdk");
|
|
10
|
+
const stellar_sdk_2 = require("@stellar/stellar-sdk");
|
|
8
11
|
const getNetwork = (network) => {
|
|
9
12
|
let networkPassphrase = '';
|
|
10
13
|
switch (network) {
|
|
@@ -17,10 +20,12 @@ const getNetwork = (network) => {
|
|
|
17
20
|
}
|
|
18
21
|
return { network, networkPassphrase };
|
|
19
22
|
};
|
|
23
|
+
exports.getNetwork = getNetwork;
|
|
20
24
|
const getPublicKeyFromPrivateKey = (privateKey) => {
|
|
21
|
-
const keypair = Keypair.fromSecret(privateKey);
|
|
25
|
+
const keypair = stellar_sdk_1.Keypair.fromSecret(privateKey);
|
|
22
26
|
return keypair.publicKey();
|
|
23
27
|
};
|
|
28
|
+
exports.getPublicKeyFromPrivateKey = getPublicKeyFromPrivateKey;
|
|
24
29
|
const getServer = (network) => {
|
|
25
30
|
let serverUrl = '';
|
|
26
31
|
switch (network.network) {
|
|
@@ -31,13 +36,13 @@ const getServer = (network) => {
|
|
|
31
36
|
serverUrl = 'https://rpc.stellar.org:443';
|
|
32
37
|
break;
|
|
33
38
|
}
|
|
34
|
-
const server = new rpc.Server(serverUrl);
|
|
39
|
+
const server = new stellar_sdk_2.rpc.Server(serverUrl);
|
|
35
40
|
return server;
|
|
36
41
|
};
|
|
37
42
|
const TIMEOUT_TRANSACTION = 60;
|
|
38
43
|
const prepareTransaction = async (context, address, contractCall) => {
|
|
39
44
|
const contractAddress = context.contractAddress;
|
|
40
|
-
const contract = new Contract(contractAddress);
|
|
45
|
+
const contract = new stellar_sdk_1.Contract(contractAddress);
|
|
41
46
|
const server = getServer(context.network);
|
|
42
47
|
const sourceAccount = await server.getAccount(address);
|
|
43
48
|
const response = {
|
|
@@ -46,19 +51,19 @@ const prepareTransaction = async (context, address, contractCall) => {
|
|
|
46
51
|
result: '',
|
|
47
52
|
};
|
|
48
53
|
// Convert raw values to ScVal
|
|
49
|
-
const convertedArgs = contractCall.args?.map((arg) => nativeToScVal(arg.value, { type: arg.type })) || [];
|
|
50
|
-
const builtTransaction = new TransactionBuilder(sourceAccount, {
|
|
51
|
-
fee: BASE_FEE,
|
|
54
|
+
const convertedArgs = contractCall.args?.map((arg) => (0, stellar_sdk_1.nativeToScVal)(arg.value, { type: arg.type })) || [];
|
|
55
|
+
const builtTransaction = new stellar_sdk_1.TransactionBuilder(sourceAccount, {
|
|
56
|
+
fee: stellar_sdk_1.BASE_FEE,
|
|
52
57
|
networkPassphrase: context.network.networkPassphrase,
|
|
53
58
|
})
|
|
54
59
|
.addOperation(contract.call(contractCall.method, ...convertedArgs))
|
|
55
60
|
.setTimeout(TIMEOUT_TRANSACTION)
|
|
56
61
|
.build();
|
|
57
62
|
const sim = await server.simulateTransaction(builtTransaction);
|
|
58
|
-
if (rpc.Api.isSimulationSuccess(sim)) {
|
|
63
|
+
if (stellar_sdk_2.rpc.Api.isSimulationSuccess(sim)) {
|
|
59
64
|
response.isSuccess = true;
|
|
60
65
|
//console.log('Simulation success:', JSON.stringify(sim));
|
|
61
|
-
const result = sim.result && sim.result.retval ? scValToNative(sim.result.retval) : undefined;
|
|
66
|
+
const result = sim.result && sim.result.retval ? (0, stellar_sdk_1.scValToNative)(sim.result.retval) : undefined;
|
|
62
67
|
const footprint = sim.transactionData.getFootprint();
|
|
63
68
|
const isReadOnly = footprint.readOnly().length > 0 && footprint.readWrite().length === 0;
|
|
64
69
|
if (isReadOnly) {
|
|
@@ -72,21 +77,23 @@ const prepareTransaction = async (context, address, contractCall) => {
|
|
|
72
77
|
return response;
|
|
73
78
|
}
|
|
74
79
|
else {
|
|
75
|
-
if (rpc.Api.isSimulationError(sim)) {
|
|
80
|
+
if (stellar_sdk_2.rpc.Api.isSimulationError(sim)) {
|
|
76
81
|
throw new Error(`Tansaction simulation error: ${JSON.stringify(sim.error)}`);
|
|
77
82
|
}
|
|
78
83
|
throw new Error('Transaction simulation failed');
|
|
79
84
|
}
|
|
80
85
|
};
|
|
86
|
+
exports.prepareTransaction = prepareTransaction;
|
|
81
87
|
const signTransaction = async (context, xdrToSign, privateKey) => {
|
|
82
|
-
const preparedTransaction = TransactionBuilder.fromXDR(xdrToSign, context.network.networkPassphrase);
|
|
83
|
-
const sourceKeypair = Keypair.fromSecret(privateKey);
|
|
88
|
+
const preparedTransaction = stellar_sdk_1.TransactionBuilder.fromXDR(xdrToSign, context.network.networkPassphrase);
|
|
89
|
+
const sourceKeypair = stellar_sdk_1.Keypair.fromSecret(privateKey);
|
|
84
90
|
preparedTransaction.sign(sourceKeypair);
|
|
85
91
|
return preparedTransaction;
|
|
86
92
|
};
|
|
93
|
+
exports.signTransaction = signTransaction;
|
|
87
94
|
const sendTransaction = async (context, signedTransactionXDR) => {
|
|
88
95
|
const server = getServer(context.network);
|
|
89
|
-
const signedTransaction = TransactionBuilder.fromXDR(signedTransactionXDR, context.network.networkPassphrase);
|
|
96
|
+
const signedTransaction = stellar_sdk_1.TransactionBuilder.fromXDR(signedTransactionXDR, context.network.networkPassphrase);
|
|
90
97
|
// Submit the transaction to the Stellar-RPC server. The RPC server will
|
|
91
98
|
// then submit the transaction into the network for us. Then we will have to
|
|
92
99
|
// wait, polling `getTransaction` until the transaction completes.
|
|
@@ -99,7 +106,7 @@ const sendTransaction = async (context, signedTransactionXDR) => {
|
|
|
99
106
|
// See if the transaction is complete
|
|
100
107
|
getResponse = await server.getTransaction(sendResponse.hash);
|
|
101
108
|
// Wait one second
|
|
102
|
-
await sleep(1000);
|
|
109
|
+
await (0, timing_js_1.sleep)(1000);
|
|
103
110
|
}
|
|
104
111
|
//console.log(`getTransaction response: ${JSON.stringify(getResponse)}`);
|
|
105
112
|
if (getResponse.status === 'SUCCESS') {
|
|
@@ -111,7 +118,7 @@ const sendTransaction = async (context, signedTransactionXDR) => {
|
|
|
111
118
|
const transactionMeta = getResponse.resultMetaXdr;
|
|
112
119
|
const returnValue = transactionMeta.v3().sorobanMeta()?.returnValue();
|
|
113
120
|
if (returnValue) {
|
|
114
|
-
return scValToNative(returnValue);
|
|
121
|
+
return (0, stellar_sdk_1.scValToNative)(returnValue);
|
|
115
122
|
}
|
|
116
123
|
}
|
|
117
124
|
else {
|
|
@@ -127,4 +134,4 @@ const sendTransaction = async (context, signedTransactionXDR) => {
|
|
|
127
134
|
throw new Error(`Transaction sending error: ${JSON.stringify(err)}`);
|
|
128
135
|
}
|
|
129
136
|
};
|
|
130
|
-
|
|
137
|
+
exports.sendTransaction = sendTransaction;
|
package/dist/stellar/unit.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exit_decommissioning = exports.enter_decommissioning = exports.exit_maintenance = exports.enter_maintenance = exports.delete_unit = exports.register_unit = exports.get_unit_reservations = exports.get_unit = void 0;
|
|
4
|
+
const transaction_js_1 = require("./transaction.js");
|
|
2
5
|
const get_unit = async (context, wallet_address, unit_id, load_reservations = false) => {
|
|
3
6
|
const [unit, reservations] = await Promise.all([
|
|
4
|
-
prepareTransaction(context, wallet_address, {
|
|
7
|
+
(0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
5
8
|
method: 'get_unit',
|
|
6
9
|
args: [{ value: unit_id, type: 'u32' }],
|
|
7
10
|
}),
|
|
@@ -15,8 +18,9 @@ const get_unit = async (context, wallet_address, unit_id, load_reservations = fa
|
|
|
15
18
|
}
|
|
16
19
|
return typedUnitData;
|
|
17
20
|
};
|
|
21
|
+
exports.get_unit = get_unit;
|
|
18
22
|
const get_unit_reservations = async (context, wallet_address, unit_id) => {
|
|
19
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
23
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
20
24
|
method: 'get_unit_reservations',
|
|
21
25
|
args: [{ value: unit_id, type: 'u32' }],
|
|
22
26
|
});
|
|
@@ -25,9 +29,10 @@ const get_unit_reservations = async (context, wallet_address, unit_id) => {
|
|
|
25
29
|
: new Map();
|
|
26
30
|
return typedUnitReservations;
|
|
27
31
|
};
|
|
32
|
+
exports.get_unit_reservations = get_unit_reservations;
|
|
28
33
|
const executeUnitTransaction = async (context, wallet_address, provider_address, method, additionalArgs = []) => {
|
|
29
34
|
const is_owner = wallet_address !== provider_address;
|
|
30
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
35
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
31
36
|
method,
|
|
32
37
|
args: [
|
|
33
38
|
{ value: provider_address, type: 'address' },
|
|
@@ -37,7 +42,7 @@ const executeUnitTransaction = async (context, wallet_address, provider_address,
|
|
|
37
42
|
});
|
|
38
43
|
if (response.isSuccess && !response.isReadOnly) {
|
|
39
44
|
const signedTxXDR = await context.signTransaction(response.result);
|
|
40
|
-
return sendTransaction(context, signedTxXDR);
|
|
45
|
+
return (0, transaction_js_1.sendTransaction)(context, signedTxXDR);
|
|
41
46
|
}
|
|
42
47
|
return null;
|
|
43
48
|
};
|
|
@@ -47,12 +52,14 @@ const register_unit = async (context, wallet_address, provider_address, capacity
|
|
|
47
52
|
{ value: endpoint, type: 'string' },
|
|
48
53
|
]);
|
|
49
54
|
};
|
|
55
|
+
exports.register_unit = register_unit;
|
|
50
56
|
const delete_unit = async (context, wallet_address, provider_address, unit_id) => {
|
|
51
57
|
return executeUnitTransaction(context, wallet_address, provider_address, 'delete_unit', [{ value: unit_id, type: 'u32' }]);
|
|
52
58
|
};
|
|
59
|
+
exports.delete_unit = delete_unit;
|
|
53
60
|
const change_unit_status = async (context, method, wallet_address, provider_address, unit_id, maintenanceStart, maintenanceEnd) => {
|
|
54
61
|
const is_owner = wallet_address !== provider_address;
|
|
55
|
-
const response = await prepareTransaction(context, wallet_address, {
|
|
62
|
+
const response = await (0, transaction_js_1.prepareTransaction)(context, wallet_address, {
|
|
56
63
|
method: method,
|
|
57
64
|
args: [
|
|
58
65
|
{ value: provider_address, type: 'address' },
|
|
@@ -68,7 +75,7 @@ const change_unit_status = async (context, method, wallet_address, provider_addr
|
|
|
68
75
|
});
|
|
69
76
|
if (response.isSuccess && !response.isReadOnly) {
|
|
70
77
|
const signedTxXDR = await context.signTransaction(response.result);
|
|
71
|
-
const responseSend = (await sendTransaction(context, signedTxXDR));
|
|
78
|
+
const responseSend = (await (0, transaction_js_1.sendTransaction)(context, signedTxXDR));
|
|
72
79
|
return responseSend;
|
|
73
80
|
}
|
|
74
81
|
return null;
|
|
@@ -84,7 +91,10 @@ const createUnitStatusChanger = (method) => {
|
|
|
84
91
|
};
|
|
85
92
|
};
|
|
86
93
|
const enter_maintenance = createUnitMaintenanceChanger('enter_maintenance');
|
|
94
|
+
exports.enter_maintenance = enter_maintenance;
|
|
87
95
|
const exit_maintenance = createUnitStatusChanger('exit_maintenance');
|
|
96
|
+
exports.exit_maintenance = exit_maintenance;
|
|
88
97
|
const enter_decommissioning = createUnitStatusChanger('enter_decommissioning');
|
|
98
|
+
exports.enter_decommissioning = enter_decommissioning;
|
|
89
99
|
const exit_decommissioning = createUnitStatusChanger('exit_decommissioning');
|
|
90
|
-
|
|
100
|
+
exports.exit_decommissioning = exit_decommissioning;
|
package/dist/utils/timing.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sleep = void 0;
|
|
1
4
|
const getGlobalThis = () => {
|
|
2
5
|
if (typeof globalThis !== 'undefined')
|
|
3
6
|
return globalThis;
|
|
@@ -9,7 +12,8 @@ const getGlobalThis = () => {
|
|
|
9
12
|
return global;
|
|
10
13
|
throw new Error('Unable to locate global object');
|
|
11
14
|
};
|
|
12
|
-
|
|
15
|
+
const sleep = (ms) => {
|
|
13
16
|
const globalScope = getGlobalThis();
|
|
14
17
|
return new Promise((resolve) => globalScope.setTimeout(resolve, ms));
|
|
15
18
|
};
|
|
19
|
+
exports.sleep = sleep;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flashbacktech/flashbackclient",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"exports": {
|
|
34
34
|
"./stellar": {
|
|
35
35
|
"types": "./dist/stellar/index.d.ts",
|
|
36
|
-
"
|
|
36
|
+
"require": "./dist/stellar/index.js",
|
|
37
37
|
"default": "./dist/stellar/index.js"
|
|
38
38
|
},
|
|
39
39
|
"./api": {
|
|
40
40
|
"types": "./dist/api/index.d.ts",
|
|
41
|
-
"
|
|
41
|
+
"require": "./dist/api/index.js",
|
|
42
42
|
"default": "./dist/api/index.js"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"ts-node-dev": "^2.0.0",
|
|
64
64
|
"typescript": "^5.7.2"
|
|
65
65
|
},
|
|
66
|
-
"type": "module",
|
|
67
66
|
"typesVersions": {
|
|
68
67
|
"*": {
|
|
69
68
|
"stellar": [
|