@orb-labs/orby-core 0.0.4 → 0.0.6
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/actions/account_cluster.d.ts +1 -1
- package/dist/actions/account_cluster.js +316 -158
- package/dist/actions/admin.js +115 -46
- package/dist/actions/application.js +68 -20
- package/dist/actions/instance.js +237 -113
- package/dist/actions/operation.js +242 -110
- package/dist/actions/token.js +107 -41
- package/dist/constants.js +92 -97
- package/dist/entities/account.js +26 -28
- package/dist/entities/financial/account_balance.js +22 -24
- package/dist/entities/financial/asset.js +15 -17
- package/dist/entities/financial/currency.js +37 -25
- package/dist/entities/financial/currency_amount.js +79 -64
- package/dist/entities/financial/fungible_token.js +49 -34
- package/dist/entities/financial/fungible_token_amount.js +85 -70
- package/dist/entities/financial/non_fungible_token.js +45 -30
- package/dist/entities/financial/semi_fungible_token.js +45 -30
- package/dist/entities/library_request.js +19 -24
- package/dist/entities/state.js +67 -60
- package/dist/enums.js +34 -37
- package/dist/index.js +27 -43
- package/dist/interfaces/account_cluster.d.ts +1 -1
- package/dist/interfaces/account_cluster.js +1 -2
- package/dist/interfaces/admin.js +1 -2
- package/dist/interfaces/application.js +1 -2
- package/dist/interfaces/instance.js +1 -2
- package/dist/interfaces/operation.js +1 -2
- package/dist/interfaces/orby.js +1 -2
- package/dist/interfaces/token.js +1 -2
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.js +1 -2
- package/dist/utils/action_helpers.js +99 -109
- package/dist/utils/utils.js +24 -32
- package/dist/utils/validateAndParseAddress.js +7 -11
- package/package.json +1 -1
package/dist/actions/admin.js
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
-
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
2
16
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
17
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
18
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,53 +22,108 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
22
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
23
|
});
|
10
24
|
};
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
27
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
29
|
+
function step(op) {
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
34
|
+
switch (op[0]) {
|
35
|
+
case 0: case 1: t = op; break;
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
39
|
+
default:
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
44
|
+
if (t[2]) _.ops.pop();
|
45
|
+
_.trys.pop(); continue;
|
25
46
|
}
|
26
|
-
|
27
|
-
});
|
47
|
+
op = body.call(thisArg, _);
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
28
50
|
}
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
return result;
|
37
|
-
});
|
51
|
+
};
|
52
|
+
import { extractGasSpendForInstances, extractGasSponsorshipData, } from "../utils/action_helpers";
|
53
|
+
import { LibraryRequest } from "../entities/library_request";
|
54
|
+
var AdminActions = /** @class */ (function (_super) {
|
55
|
+
__extends(AdminActions, _super);
|
56
|
+
function AdminActions(library, client, provider) {
|
57
|
+
return _super.call(this, library, client, provider) || this;
|
38
58
|
}
|
39
|
-
|
40
|
-
return __awaiter(this, void 0, void 0, function
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
59
|
+
AdminActions.prototype.createInstance = function (name) {
|
60
|
+
return __awaiter(this, void 0, void 0, function () {
|
61
|
+
var result;
|
62
|
+
return __generator(this, function (_a) {
|
63
|
+
switch (_a.label) {
|
64
|
+
case 0: return [4 /*yield*/, this.sendRequest("orby_createInstance", [{ name: name }])];
|
65
|
+
case 1:
|
66
|
+
result = _a.sent();
|
67
|
+
if (result.code && result.message) {
|
68
|
+
console.error("[createInstance]", result.code, result.message);
|
69
|
+
return [2 /*return*/, undefined];
|
70
|
+
}
|
71
|
+
return [2 /*return*/, result];
|
72
|
+
}
|
73
|
+
});
|
47
74
|
});
|
48
|
-
}
|
49
|
-
|
50
|
-
return __awaiter(this, void 0, void 0, function
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
75
|
+
};
|
76
|
+
AdminActions.prototype.getInstanceUrls = function (name) {
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
78
|
+
var result;
|
79
|
+
return __generator(this, function (_a) {
|
80
|
+
switch (_a.label) {
|
81
|
+
case 0: return [4 /*yield*/, this.sendRequest("orby_getInstanceUrls", [{ name: name }])];
|
82
|
+
case 1:
|
83
|
+
result = _a.sent();
|
84
|
+
if (result.code && result.message) {
|
85
|
+
console.error("[getInstanceUrls]", result.code, result.message);
|
86
|
+
return [2 /*return*/, undefined];
|
87
|
+
}
|
88
|
+
return [2 /*return*/, result];
|
89
|
+
}
|
90
|
+
});
|
57
91
|
});
|
58
|
-
}
|
59
|
-
|
60
|
-
|
92
|
+
};
|
93
|
+
AdminActions.prototype.getGasSpentForCustomer = function (month, year) {
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
95
|
+
var _a, totalGasSpentForCustomer, code, message;
|
96
|
+
return __generator(this, function (_b) {
|
97
|
+
switch (_b.label) {
|
98
|
+
case 0: return [4 /*yield*/, this.sendRequest("orby_getGasSpentForCustomer", [{ month: month, year: year }])];
|
99
|
+
case 1:
|
100
|
+
_a = _b.sent(), totalGasSpentForCustomer = _a.totalGasSpentForCustomer, code = _a.code, message = _a.message;
|
101
|
+
if (code && message) {
|
102
|
+
console.error("[getGasSpentForCustomer]", code, message);
|
103
|
+
return [2 /*return*/, undefined];
|
104
|
+
}
|
105
|
+
return [2 /*return*/, extractGasSponsorshipData(totalGasSpentForCustomer)];
|
106
|
+
}
|
107
|
+
});
|
108
|
+
});
|
109
|
+
};
|
110
|
+
AdminActions.prototype.getGasSpentForInstances = function (month, year, instanceNames) {
|
111
|
+
return __awaiter(this, void 0, void 0, function () {
|
112
|
+
var _a, totalGasSpendForInstances, code, message;
|
113
|
+
return __generator(this, function (_b) {
|
114
|
+
switch (_b.label) {
|
115
|
+
case 0: return [4 /*yield*/, this.sendRequest("orby_getGasSpentForInstances", [{ month: month, year: year, instanceNames: instanceNames }])];
|
116
|
+
case 1:
|
117
|
+
_a = _b.sent(), totalGasSpendForInstances = _a.totalGasSpendForInstances, code = _a.code, message = _a.message;
|
118
|
+
if (code && message) {
|
119
|
+
console.error("[getGasSpentForInstances]", code, message);
|
120
|
+
return [2 /*return*/, undefined];
|
121
|
+
}
|
122
|
+
return [2 /*return*/, extractGasSpendForInstances(totalGasSpendForInstances)];
|
123
|
+
}
|
124
|
+
});
|
125
|
+
});
|
126
|
+
};
|
127
|
+
return AdminActions;
|
128
|
+
}(LibraryRequest));
|
129
|
+
export { AdminActions };
|
@@ -1,4 +1,18 @@
|
|
1
|
-
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
2
16
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
17
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
18
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,24 +22,58 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
22
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
23
|
});
|
10
24
|
};
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
27
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
29
|
+
function step(op) {
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
34
|
+
switch (op[0]) {
|
35
|
+
case 0: case 1: t = op; break;
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
39
|
+
default:
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
44
|
+
if (t[2]) _.ops.pop();
|
45
|
+
_.trys.pop(); continue;
|
26
46
|
}
|
27
|
-
|
28
|
-
});
|
47
|
+
op = body.call(thisArg, _);
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
29
50
|
}
|
30
|
-
}
|
31
|
-
|
51
|
+
};
|
52
|
+
import { LibraryRequest } from "../entities/library_request";
|
53
|
+
var ApplicationActions = /** @class */ (function (_super) {
|
54
|
+
__extends(ApplicationActions, _super);
|
55
|
+
function ApplicationActions(library, client, provider) {
|
56
|
+
return _super.call(this, library, client, provider) || this;
|
57
|
+
}
|
58
|
+
ApplicationActions.prototype.isChainAbstractionCompatible = function (appDomainUrl) {
|
59
|
+
return __awaiter(this, void 0, void 0, function () {
|
60
|
+
var _a, isChainAbstractionCompatible, code, message;
|
61
|
+
return __generator(this, function (_b) {
|
62
|
+
switch (_b.label) {
|
63
|
+
case 0: return [4 /*yield*/, this.sendRequest("orby_isChainAbstractionCompatible", [
|
64
|
+
{ appDomainUrl: appDomainUrl },
|
65
|
+
])];
|
66
|
+
case 1:
|
67
|
+
_a = _b.sent(), isChainAbstractionCompatible = _a.isChainAbstractionCompatible, code = _a.code, message = _a.message;
|
68
|
+
if (code && message) {
|
69
|
+
console.error("[isChainAbstractionCompatible]", code, message);
|
70
|
+
return [2 /*return*/, undefined];
|
71
|
+
}
|
72
|
+
return [2 /*return*/, isChainAbstractionCompatible];
|
73
|
+
}
|
74
|
+
});
|
75
|
+
});
|
76
|
+
};
|
77
|
+
return ApplicationActions;
|
78
|
+
}(LibraryRequest));
|
79
|
+
export { ApplicationActions };
|