@orb-labs/orby-core 0.0.3 → 0.0.5

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.
Files changed (43) hide show
  1. package/README.md +42 -1
  2. package/dist/actions/account_cluster.d.ts +1 -1
  3. package/dist/actions/account_cluster.js +308 -121
  4. package/dist/actions/admin.js +115 -28
  5. package/dist/actions/application.js +68 -14
  6. package/dist/actions/instance.js +237 -72
  7. package/dist/actions/operation.d.ts +12 -6
  8. package/dist/actions/operation.js +242 -90
  9. package/dist/actions/token.js +107 -31
  10. package/dist/constants.d.ts +8 -0
  11. package/dist/constants.js +132 -36
  12. package/dist/entities/account.js +26 -28
  13. package/dist/entities/financial/account_balance.js +22 -24
  14. package/dist/entities/financial/asset.js +15 -17
  15. package/dist/entities/financial/currency.js +37 -25
  16. package/dist/entities/financial/currency_amount.js +79 -64
  17. package/dist/entities/financial/fungible_token.js +49 -34
  18. package/dist/entities/financial/fungible_token_amount.js +85 -70
  19. package/dist/entities/financial/non_fungible_token.js +45 -30
  20. package/dist/entities/financial/semi_fungible_token.js +45 -30
  21. package/dist/entities/library_request.js +19 -24
  22. package/dist/entities/state.js +67 -60
  23. package/dist/enums.js +34 -37
  24. package/dist/index.d.ts +1 -3
  25. package/dist/index.js +27 -46
  26. package/dist/interfaces/account_cluster.d.ts +1 -1
  27. package/dist/interfaces/account_cluster.js +1 -2
  28. package/dist/interfaces/admin.js +1 -2
  29. package/dist/interfaces/application.js +1 -2
  30. package/dist/interfaces/instance.js +1 -2
  31. package/dist/interfaces/operation.d.ts +5 -5
  32. package/dist/interfaces/operation.js +1 -2
  33. package/dist/interfaces/orby.js +1 -2
  34. package/dist/interfaces/token.js +1 -2
  35. package/dist/tsconfig.tsbuildinfo +1 -0
  36. package/dist/types.d.ts +4 -0
  37. package/dist/types.js +1 -2
  38. package/dist/utils/action_helpers.d.ts +22 -0
  39. package/dist/utils/action_helpers.js +270 -0
  40. package/dist/utils/utils.d.ts +5 -22
  41. package/dist/utils/utils.js +30 -279
  42. package/dist/utils/validateAndParseAddress.js +7 -11
  43. package/package.json +6 -1
@@ -1,4 +1,18 @@
1
- "use strict";
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,35 +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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AdminActions = void 0;
13
- const utils_1 = require("../utils/utils");
14
- const library_request_1 = require("../entities/library_request");
15
- class AdminActions extends library_request_1.LibraryRequest {
16
- constructor(library, client, provider) {
17
- super(library, client, provider);
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;
46
+ }
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 };
18
50
  }
19
- createInstance(name) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- return yield this.sendRequest("orby_createInstance", [{ name }]);
22
- });
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;
23
58
  }
24
- getInstanceUrls(name) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- return yield this.sendRequest("orby_getInstanceUrls", [{ name }]);
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
+ });
27
74
  });
28
- }
29
- getGasSpentForCustomer(month, year) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- const { totalGasSpentForCustomer } = yield this.sendRequest("orby_getGasSpentForCustomer", [{ month, year }]);
32
- return (0, utils_1.extractGasSponsorshipData)(totalGasSpentForCustomer);
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
+ });
33
91
  });
34
- }
35
- getGasSpentForInstances(month, year, instanceNames) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const { totalGasSpendForInstances } = yield this.sendRequest("orby_getGasSpentForInstances", [{ month, year, instanceNames }]);
38
- return (0, utils_1.extractGasSpendForInstances)(totalGasSpendForInstances);
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
+ });
39
108
  });
40
- }
41
- }
42
- exports.AdminActions = AdminActions;
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
- "use strict";
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,18 +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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ApplicationActions = void 0;
13
- const library_request_1 = require("../entities/library_request");
14
- class ApplicationActions extends library_request_1.LibraryRequest {
15
- constructor(library, client, provider) {
16
- super(library, client, provider);
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;
46
+ }
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 };
17
50
  }
18
- isChainAbstractionCompatible(appDomainUrl) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const { isChainAbstractionCompatible } = yield this.sendRequest("orby_isChainAbstractionCompatible", [{ appDomainUrl }]);
21
- return isChainAbstractionCompatible;
22
- });
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;
23
57
  }
24
- }
25
- exports.ApplicationActions = ApplicationActions;
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 };
@@ -1,4 +1,29 @@
1
- "use strict";
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
+ })();
16
+ var __assign = (this && this.__assign) || function () {
17
+ __assign = Object.assign || function(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
+ t[p] = s[p];
22
+ }
23
+ return t;
24
+ };
25
+ return __assign.apply(this, arguments);
26
+ };
2
27
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
28
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
29
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,87 +33,227 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
33
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
34
  });
10
35
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.InstanceActions = void 0;
13
- const utils_1 = require("../utils/utils");
14
- const library_request_1 = require("../entities/library_request");
15
- class InstanceActions extends library_request_1.LibraryRequest {
16
- constructor(library, client, provider) {
17
- super(library, client, provider);
36
+ var __generator = (this && this.__generator) || function (thisArg, body) {
37
+ 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);
38
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
39
+ function verb(n) { return function (v) { return step([n, v]); }; }
40
+ function step(op) {
41
+ if (f) throw new TypeError("Generator is already executing.");
42
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
43
+ 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;
44
+ if (y = 0, t) op = [op[0] & 2, t.value];
45
+ switch (op[0]) {
46
+ case 0: case 1: t = op; break;
47
+ case 4: _.label++; return { value: op[1], done: false };
48
+ case 5: _.label++; y = op[1]; op = [0]; continue;
49
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
50
+ default:
51
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
52
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
53
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
54
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
55
+ if (t[2]) _.ops.pop();
56
+ _.trys.pop(); continue;
57
+ }
58
+ op = body.call(thisArg, _);
59
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
60
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
61
+ }
62
+ };
63
+ import { extractBlockchainInformations, extractGasSponsorshipPolicy, } from "../utils/action_helpers";
64
+ import { LibraryRequest } from "../entities/library_request";
65
+ import { getChainIdFromOrbyChainId } from "../utils/utils";
66
+ var InstanceActions = /** @class */ (function (_super) {
67
+ __extends(InstanceActions, _super);
68
+ function InstanceActions(library, client, provider) {
69
+ return _super.call(this, library, client, provider) || this;
18
70
  }
19
- setCustomChainEndpointsForInstance(chainEndpoints) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const formattedEndpoints = chainEndpoints.map((endpoint) => {
22
- return {
23
- chainId: `EIP155-${endpoint.chainId}`,
24
- customRpcUrls: endpoint.customRpcUrls,
25
- customIndexerUrls: endpoint.customIndexerUrls,
26
- };
71
+ InstanceActions.prototype.setCustomChainEndpointsForInstance = function (chainEndpoints) {
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ var formattedEndpoints, _a, success, code, message;
74
+ return __generator(this, function (_b) {
75
+ switch (_b.label) {
76
+ case 0:
77
+ formattedEndpoints = chainEndpoints.map(function (endpoint) {
78
+ return {
79
+ chainId: "EIP155-".concat(endpoint.chainId),
80
+ customRpcUrls: endpoint.customRpcUrls,
81
+ customIndexerUrls: endpoint.customIndexerUrls,
82
+ };
83
+ });
84
+ return [4 /*yield*/, this.sendRequest("orby_setCustomChainEndpointsForInstance", [{ chainEndpoints: formattedEndpoints }])];
85
+ case 1:
86
+ _a = _b.sent(), success = _a.success, code = _a.code, message = _a.message;
87
+ if (code && message) {
88
+ console.error("[setCustomChainEndpointsForInstance]", code, message);
89
+ return [2 /*return*/, undefined];
90
+ }
91
+ return [2 /*return*/, success];
92
+ }
27
93
  });
28
- const { success } = yield this.sendRequest("orby_setCustomChainEndpointsForInstance", [{ chainEndpoints: formattedEndpoints }]);
29
- return success;
30
94
  });
31
- }
32
- removeCustomChainEndpointForInstance(chainIds) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const formattedChainIds = chainIds.map((chainId) => `EIP155-${chainId}`);
35
- const { success } = yield this.sendRequest("orby_removeCustomChainEndpointForInstance", [{ chainIds: formattedChainIds }]);
36
- return success;
95
+ };
96
+ InstanceActions.prototype.removeCustomChainEndpointForInstance = function (chainIds) {
97
+ return __awaiter(this, void 0, void 0, function () {
98
+ var formattedChainIds, _a, success, code, message;
99
+ return __generator(this, function (_b) {
100
+ switch (_b.label) {
101
+ case 0:
102
+ formattedChainIds = chainIds.map(function (chainId) { return "EIP155-".concat(chainId); });
103
+ return [4 /*yield*/, this.sendRequest("orby_removeCustomChainEndpointForInstance", [{ chainIds: formattedChainIds }])];
104
+ case 1:
105
+ _a = _b.sent(), success = _a.success, code = _a.code, message = _a.message;
106
+ if (code && message) {
107
+ console.error("[removeCustomChainEndpointForInstance]", code, message);
108
+ return [2 /*return*/, undefined];
109
+ }
110
+ return [2 /*return*/, success];
111
+ }
112
+ });
37
113
  });
38
- }
39
- getCustomChainEndpointsForInstance(returnChainIdsOnly) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const { chainEndpoints } = yield this.sendRequest("orby_getCustomChainEndpointsForInstance", [{ returnChainIdsOnly }]);
42
- return chainEndpoints.map((endpoint) => {
43
- return {
44
- chainId: (0, utils_1.getChainIdFromOrbyChainId)(endpoint.chainId),
45
- customRpcUrls: endpoint.customRpcUrls,
46
- customIndexerUrls: endpoint.customIndexerUrls,
47
- };
114
+ };
115
+ InstanceActions.prototype.getCustomChainEndpointsForInstance = function (returnChainIdsOnly) {
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ var _a, chainEndpoints, code, message;
118
+ return __generator(this, function (_b) {
119
+ switch (_b.label) {
120
+ case 0: return [4 /*yield*/, this.sendRequest("orby_getCustomChainEndpointsForInstance", [{ returnChainIdsOnly: returnChainIdsOnly }])];
121
+ case 1:
122
+ _a = _b.sent(), chainEndpoints = _a.chainEndpoints, code = _a.code, message = _a.message;
123
+ if (code && message) {
124
+ console.error("[getCustomChainEndpointsForInstance]", code, message);
125
+ return [2 /*return*/, undefined];
126
+ }
127
+ return [2 /*return*/, chainEndpoints.map(function (endpoint) {
128
+ return {
129
+ chainId: getChainIdFromOrbyChainId(endpoint.chainId),
130
+ customRpcUrls: endpoint.customRpcUrls,
131
+ customIndexerUrls: endpoint.customIndexerUrls,
132
+ };
133
+ })];
134
+ }
48
135
  });
49
136
  });
50
- }
51
- getChainsSupportedByDefault() {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- const { supportedChains } = yield this.sendRequest("orby_getChainsSupportedByDefault", [{}]);
54
- return (0, utils_1.extractBlockchainInformations)(supportedChains);
137
+ };
138
+ InstanceActions.prototype.getChainsSupportedByDefault = function () {
139
+ return __awaiter(this, void 0, void 0, function () {
140
+ var _a, supportedChains, code, message;
141
+ return __generator(this, function (_b) {
142
+ switch (_b.label) {
143
+ case 0: return [4 /*yield*/, this.sendRequest("orby_getChainsSupportedByDefault", [{}])];
144
+ case 1:
145
+ _a = _b.sent(), supportedChains = _a.supportedChains, code = _a.code, message = _a.message;
146
+ if (code && message) {
147
+ console.error("[getChainsSupportedByDefault]", code, message);
148
+ return [2 /*return*/, undefined];
149
+ }
150
+ return [2 /*return*/, extractBlockchainInformations(supportedChains)];
151
+ }
152
+ });
55
153
  });
56
- }
57
- enabledChainAbstractionForInstance(enable) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- const { success } = yield this.sendRequest("orby_enabledChainAbstractionForInstance", [{ enable }]);
60
- return success;
154
+ };
155
+ InstanceActions.prototype.enabledChainAbstractionForInstance = function (enable) {
156
+ return __awaiter(this, void 0, void 0, function () {
157
+ var _a, success, code, message;
158
+ return __generator(this, function (_b) {
159
+ switch (_b.label) {
160
+ case 0: return [4 /*yield*/, this.sendRequest("orby_enabledChainAbstractionForInstance", [{ enable: enable }])];
161
+ case 1:
162
+ _a = _b.sent(), success = _a.success, code = _a.code, message = _a.message;
163
+ if (code && message) {
164
+ console.error("[enabledChainAbstractionForInstance]", code, message);
165
+ return [2 /*return*/, undefined];
166
+ }
167
+ return [2 /*return*/, success];
168
+ }
169
+ });
61
170
  });
62
- }
63
- enableGasSponsorshipForInstance(enable) {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- const { success } = yield this.sendRequest("orby_enableGasSponsorshipForInstance", [{ enable }]);
66
- return success;
171
+ };
172
+ InstanceActions.prototype.enableGasSponsorshipForInstance = function (enable) {
173
+ return __awaiter(this, void 0, void 0, function () {
174
+ var _a, success, code, message;
175
+ return __generator(this, function (_b) {
176
+ switch (_b.label) {
177
+ case 0: return [4 /*yield*/, this.sendRequest("orby_enableGasSponsorshipForInstance", [{ enable: enable }])];
178
+ case 1:
179
+ _a = _b.sent(), success = _a.success, code = _a.code, message = _a.message;
180
+ if (code && message) {
181
+ console.error("[enableGasSponsorshipForInstance]", code, message);
182
+ return [2 /*return*/, undefined];
183
+ }
184
+ return [2 /*return*/, success];
185
+ }
186
+ });
67
187
  });
68
- }
69
- getGasSponsorForInstance() {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- const { gasSponsor } = yield this.sendRequest("orby_getGasSponsorForInstance", [{}]);
72
- return gasSponsor;
188
+ };
189
+ InstanceActions.prototype.getGasSponsorForInstance = function () {
190
+ return __awaiter(this, void 0, void 0, function () {
191
+ var _a, gasSponsor, code, message;
192
+ return __generator(this, function (_b) {
193
+ switch (_b.label) {
194
+ case 0: return [4 /*yield*/, this.sendRequest("orby_getGasSponsorForInstance", [{}])];
195
+ case 1:
196
+ _a = _b.sent(), gasSponsor = _a.gasSponsor, code = _a.code, message = _a.message;
197
+ if (code && message) {
198
+ console.error("[getGasSponsorForInstance]", code, message);
199
+ return [2 /*return*/, undefined];
200
+ }
201
+ return [2 /*return*/, gasSponsor];
202
+ }
203
+ });
73
204
  });
74
- }
75
- getOrbyGasSponsorPolicyForInstance() {
76
- return __awaiter(this, void 0, void 0, function* () {
77
- const { gasSponsorshipPolicy } = yield this.sendRequest("orby_getOrbyGasSponsorPolicyForInstance", [{}]);
78
- return (0, utils_1.extractGasSponsorshipPolicy)(gasSponsorshipPolicy);
205
+ };
206
+ InstanceActions.prototype.getOrbyGasSponsorPolicyForInstance = function () {
207
+ return __awaiter(this, void 0, void 0, function () {
208
+ var _a, gasSponsorshipPolicy, message, code;
209
+ return __generator(this, function (_b) {
210
+ switch (_b.label) {
211
+ case 0: return [4 /*yield*/, this.sendRequest("orby_getOrbyGasSponsorPolicyForInstance", [{}])];
212
+ case 1:
213
+ _a = _b.sent(), gasSponsorshipPolicy = _a.gasSponsorshipPolicy, message = _a.message, code = _a.code;
214
+ if (code && message) {
215
+ console.error("[getOrbyGasSponsorPolicyForInstance]", code, message);
216
+ return [2 /*return*/, undefined];
217
+ }
218
+ return [2 /*return*/, extractGasSponsorshipPolicy(gasSponsorshipPolicy)];
219
+ }
220
+ });
79
221
  });
80
- }
81
- setOrbyGasSponsorPolicyForInstance(gasSponsorshipPolicy) {
82
- return __awaiter(this, void 0, void 0, function* () {
83
- const { success } = yield this.sendRequest("orby_setOrbyGasSponsorPolicyForInstance", [Object.assign({}, gasSponsorshipPolicy)]);
84
- return success;
222
+ };
223
+ InstanceActions.prototype.setOrbyGasSponsorPolicyForInstance = function (gasSponsorshipPolicy) {
224
+ return __awaiter(this, void 0, void 0, function () {
225
+ var _a, success, code, message;
226
+ return __generator(this, function (_b) {
227
+ switch (_b.label) {
228
+ case 0: return [4 /*yield*/, this.sendRequest("orby_setOrbyGasSponsorPolicyForInstance", [__assign({}, gasSponsorshipPolicy)])];
229
+ case 1:
230
+ _a = _b.sent(), success = _a.success, code = _a.code, message = _a.message;
231
+ if (code && message) {
232
+ console.error("[setOrbyGasSponsorPolicyForInstance]", code, message);
233
+ return [2 /*return*/, undefined];
234
+ }
235
+ return [2 /*return*/, success];
236
+ }
237
+ });
85
238
  });
86
- }
87
- removeOrbyGasSponsorPolicyForInstance() {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- const { success } = yield this.sendRequest("orby_removeOrbyGasSponsorPolicyForInstance", [{}]);
90
- return success;
239
+ };
240
+ InstanceActions.prototype.removeOrbyGasSponsorPolicyForInstance = function () {
241
+ return __awaiter(this, void 0, void 0, function () {
242
+ var _a, success, code, message;
243
+ return __generator(this, function (_b) {
244
+ switch (_b.label) {
245
+ case 0: return [4 /*yield*/, this.sendRequest("orby_removeOrbyGasSponsorPolicyForInstance", [{}])];
246
+ case 1:
247
+ _a = _b.sent(), success = _a.success, code = _a.code, message = _a.message;
248
+ if (code && message) {
249
+ console.error("[removeOrbyGasSponsorPolicyForInstance]", code, message);
250
+ return [2 /*return*/, undefined];
251
+ }
252
+ return [2 /*return*/, success];
253
+ }
254
+ });
91
255
  });
92
- }
93
- }
94
- exports.InstanceActions = InstanceActions;
256
+ };
257
+ return InstanceActions;
258
+ }(LibraryRequest));
259
+ export { InstanceActions };
@@ -4,7 +4,13 @@ import { LIBRARY_TYPE, QuoteType } from "../enums";
4
4
  import { LibraryRequest } from "../entities/library_request";
5
5
  export declare class OperationActions extends LibraryRequest {
6
6
  constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
7
- getOperationsToExecuteTransaction(accountClusterId: string, to: string, data: string, value?: bigint): Promise<OperationSet>;
7
+ getOperationsToExecuteTransaction(accountClusterId: string, to: string, data: string, value?: bigint, gasToken?: {
8
+ standardizedTokenId: string;
9
+ tokenSources?: {
10
+ chainId: bigint;
11
+ address?: string;
12
+ }[];
13
+ }): Promise<OperationSet>;
8
14
  getOperationsToSignTypedData(accountClusterId: string, data: string): Promise<OperationSet>;
9
15
  getOperationsToCancelTransaction(accountClusterId: string, operationSetId: string): Promise<OperationSet>;
10
16
  isTransactionPreconditionSatisfied(accountClusterId: string, to: string, data: string, value?: string): Promise<boolean>;
@@ -16,7 +22,7 @@ export declare class OperationActions extends LibraryRequest {
16
22
  getOperationStatuses(operationIds: string[]): Promise<OperationStatus[]>;
17
23
  estimateFiatCostToExecuteTransaction(to: string, data: string, value?: string): Promise<CurrencyAmount>;
18
24
  estimateFiatCostToSignTypedData(data: string): Promise<CurrencyAmount>;
19
- getOperationsToTransferToken(accountClusterId: string, standardizedTokenId: string, amount: number, recipient: {
25
+ getOperationsToTransferToken(accountClusterId: string, standardizedTokenId: string, amount: bigint, recipient: {
20
26
  chainId: bigint;
21
27
  recipientAddress: string;
22
28
  }, gasToken?: {
@@ -28,14 +34,14 @@ export declare class OperationActions extends LibraryRequest {
28
34
  }): Promise<OperationSet>;
29
35
  getOperationsToSwap(accountClusterId: string, swapType: QuoteType, input: {
30
36
  standardizedTokenId: string;
31
- amount?: number;
37
+ amount?: bigint;
32
38
  tokenSources?: {
33
39
  chainId: string;
34
40
  address?: string;
35
41
  }[];
36
42
  }, output: {
37
43
  standardizedTokenId: string;
38
- amount?: number;
44
+ amount?: bigint;
39
45
  tokenDestination?: {
40
46
  chainId: string;
41
47
  address?: string;
@@ -49,14 +55,14 @@ export declare class OperationActions extends LibraryRequest {
49
55
  }): Promise<OperationSet>;
50
56
  getQuote(accountClusterId: string, swapType: QuoteType, input: {
51
57
  standardizedTokenId: string;
52
- amount?: number;
58
+ amount?: bigint;
53
59
  tokenSources?: {
54
60
  chainId: string;
55
61
  address?: string;
56
62
  }[];
57
63
  }, output: {
58
64
  standardizedTokenId: string;
59
- amount?: number;
65
+ amount?: bigint;
60
66
  tokenDestination?: {
61
67
  chainId: string;
62
68
  address?: string;