@orb-labs/orby-core 0.0.6 → 0.0.7
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/CHANGELOG.md +7 -0
- package/dist/actions/account_cluster.d.ts +4 -4
- package/dist/actions/account_cluster.js +147 -338
- package/dist/actions/admin.d.ts +3 -3
- package/dist/actions/admin.js +37 -127
- package/dist/actions/application.d.ts +2 -2
- package/dist/actions/application.js +14 -77
- package/dist/actions/instance.d.ts +3 -3
- package/dist/actions/instance.js +98 -255
- package/dist/actions/operation.d.ts +4 -4
- package/dist/actions/operation.js +92 -263
- package/dist/actions/token.d.ts +3 -3
- package/dist/actions/token.js +34 -119
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +70 -71
- package/dist/entities/account.d.ts +1 -1
- package/dist/entities/account.js +25 -30
- package/dist/entities/financial/account_balance.d.ts +2 -2
- package/dist/entities/financial/account_balance.js +20 -22
- package/dist/entities/financial/asset.js +13 -15
- package/dist/entities/financial/currency.d.ts +1 -1
- package/dist/entities/financial/currency.js +16 -35
- package/dist/entities/financial/currency_amount.d.ts +1 -1
- package/dist/entities/financial/currency_amount.js +49 -71
- package/dist/entities/financial/fungible_token.d.ts +2 -2
- package/dist/entities/financial/fungible_token.js +31 -52
- package/dist/entities/financial/fungible_token_amount.d.ts +2 -2
- package/dist/entities/financial/fungible_token_amount.js +53 -75
- package/dist/entities/financial/non_fungible_token.d.ts +2 -2
- package/dist/entities/financial/non_fungible_token.js +25 -45
- package/dist/entities/financial/semi_fungible_token.d.ts +2 -2
- package/dist/entities/financial/semi_fungible_token.js +25 -45
- package/dist/entities/library_request.d.ts +1 -1
- package/dist/entities/library_request.js +7 -9
- package/dist/entities/state.d.ts +4 -4
- package/dist/entities/state.js +57 -67
- package/dist/index.d.ts +27 -27
- package/dist/index.js +27 -27
- package/dist/interfaces/account_cluster.d.ts +3 -3
- package/dist/interfaces/admin.d.ts +1 -1
- package/dist/interfaces/instance.d.ts +1 -1
- package/dist/interfaces/operation.d.ts +3 -3
- package/dist/interfaces/orby.d.ts +6 -6
- package/dist/interfaces/token.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +7 -7
- package/dist/utils/action_helpers.d.ts +1 -1
- package/dist/utils/action_helpers.js +42 -58
- package/dist/utils/jsbi.d.ts +2 -0
- package/dist/utils/jsbi.js +2 -0
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.js +17 -19
- package/dist/utils/validateAndParseAddress.js +3 -3
- package/package.json +4 -2
package/dist/actions/admin.js
CHANGED
@@ -1,129 +1,39 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
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;
|
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 };
|
1
|
+
import { extractGasSpendForInstances, extractGasSponsorshipData, } from "../utils/action_helpers.js";
|
2
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
3
|
+
export class AdminActions extends LibraryRequest {
|
4
|
+
constructor(library, client, provider) {
|
5
|
+
super(library, client, provider);
|
50
6
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
return
|
7
|
+
async createInstance(name) {
|
8
|
+
const result = await this.sendRequest("orby_createInstance", [{ name }]);
|
9
|
+
if (result.code && result.message) {
|
10
|
+
console.error("[createInstance]", result.code, result.message);
|
11
|
+
return undefined;
|
12
|
+
}
|
13
|
+
return result;
|
58
14
|
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
return
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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
|
-
});
|
91
|
-
});
|
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 };
|
15
|
+
async getInstanceUrls(name) {
|
16
|
+
const result = await this.sendRequest("orby_getInstanceUrls", [{ name }]);
|
17
|
+
if (result.code && result.message) {
|
18
|
+
console.error("[getInstanceUrls]", result.code, result.message);
|
19
|
+
return undefined;
|
20
|
+
}
|
21
|
+
return result;
|
22
|
+
}
|
23
|
+
async getGasSpentForCustomer(month, year) {
|
24
|
+
const { totalGasSpentForCustomer, code, message } = await this.sendRequest("orby_getGasSpentForCustomer", [{ month, year }]);
|
25
|
+
if (code && message) {
|
26
|
+
console.error("[getGasSpentForCustomer]", code, message);
|
27
|
+
return undefined;
|
28
|
+
}
|
29
|
+
return extractGasSponsorshipData(totalGasSpentForCustomer);
|
30
|
+
}
|
31
|
+
async getGasSpentForInstances(month, year, instanceNames) {
|
32
|
+
const { totalGasSpendForInstances, code, message } = await this.sendRequest("orby_getGasSpentForInstances", [{ month, year, instanceNames }]);
|
33
|
+
if (code && message) {
|
34
|
+
console.error("[getGasSpentForInstances]", code, message);
|
35
|
+
return undefined;
|
36
|
+
}
|
37
|
+
return extractGasSpendForInstances(totalGasSpendForInstances);
|
38
|
+
}
|
39
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { LibraryRequest } from "../entities/library_request";
|
2
|
-
import { LIBRARY_TYPE } from "../enums";
|
1
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
2
|
+
import { LIBRARY_TYPE } from "../enums.js";
|
3
3
|
export declare class ApplicationActions extends LibraryRequest {
|
4
4
|
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
5
5
|
isChainAbstractionCompatible(appDomainUrl: string): Promise<boolean>;
|
@@ -1,79 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
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;
|
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 };
|
1
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
2
|
+
export class ApplicationActions extends LibraryRequest {
|
3
|
+
constructor(library, client, provider) {
|
4
|
+
super(library, client, provider);
|
50
5
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
6
|
+
async isChainAbstractionCompatible(appDomainUrl) {
|
7
|
+
const { isChainAbstractionCompatible, code, message } = await this.sendRequest("orby_isChainAbstractionCompatible", [
|
8
|
+
{ appDomainUrl },
|
9
|
+
]);
|
10
|
+
if (code && message) {
|
11
|
+
console.error("[isChainAbstractionCompatible]", code, message);
|
12
|
+
return undefined;
|
13
|
+
}
|
14
|
+
return isChainAbstractionCompatible;
|
57
15
|
}
|
58
|
-
|
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 };
|
16
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { BlockchainInformation, ChainEndpoint, GasSponsorshipPolicy } from "../types";
|
2
|
-
import { LIBRARY_TYPE } from "../enums";
|
3
|
-
import { LibraryRequest } from "../entities/library_request";
|
1
|
+
import { BlockchainInformation, ChainEndpoint, GasSponsorshipPolicy } from "../types.js";
|
2
|
+
import { LIBRARY_TYPE } from "../enums.js";
|
3
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
4
4
|
export declare class InstanceActions extends LibraryRequest {
|
5
5
|
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
6
6
|
setCustomChainEndpointsForInstance(chainEndpoints: ChainEndpoint[]): Promise<boolean>;
|
package/dist/actions/instance.js
CHANGED
@@ -1,259 +1,102 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
}
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
})
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
21
|
-
t[p] = s[p];
|
1
|
+
import { extractBlockchainInformations, extractGasSponsorshipPolicy, } from "../utils/action_helpers.js";
|
2
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
3
|
+
import { getChainIdFromOrbyChainId } from "../utils/utils.js";
|
4
|
+
export class InstanceActions extends LibraryRequest {
|
5
|
+
constructor(library, client, provider) {
|
6
|
+
super(library, client, provider);
|
7
|
+
}
|
8
|
+
async setCustomChainEndpointsForInstance(chainEndpoints) {
|
9
|
+
const formattedEndpoints = chainEndpoints.map((endpoint) => {
|
10
|
+
return {
|
11
|
+
chainId: `EIP155-${endpoint.chainId}`,
|
12
|
+
customRpcUrls: endpoint.customRpcUrls,
|
13
|
+
customIndexerUrls: endpoint.customIndexerUrls,
|
14
|
+
};
|
15
|
+
});
|
16
|
+
const { success, code, message } = await this.sendRequest("orby_setCustomChainEndpointsForInstance", [{ chainEndpoints: formattedEndpoints }]);
|
17
|
+
if (code && message) {
|
18
|
+
console.error("[setCustomChainEndpointsForInstance]", code, message);
|
19
|
+
return undefined;
|
22
20
|
}
|
23
|
-
return
|
24
|
-
};
|
25
|
-
return __assign.apply(this, arguments);
|
26
|
-
};
|
27
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
28
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
29
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
30
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
31
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
32
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
33
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
34
|
-
});
|
35
|
-
};
|
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 };
|
21
|
+
return success;
|
61
22
|
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
return
|
23
|
+
async removeCustomChainEndpointForInstance(chainIds) {
|
24
|
+
const formattedChainIds = chainIds.map((chainId) => `EIP155-${chainId}`);
|
25
|
+
const { success, code, message } = await this.sendRequest("orby_removeCustomChainEndpointForInstance", [{ chainIds: formattedChainIds }]);
|
26
|
+
if (code && message) {
|
27
|
+
console.error("[removeCustomChainEndpointForInstance]", code, message);
|
28
|
+
return undefined;
|
29
|
+
}
|
30
|
+
return success;
|
70
31
|
}
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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
|
-
}
|
93
|
-
});
|
94
|
-
});
|
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
|
-
});
|
113
|
-
});
|
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
|
-
}
|
135
|
-
});
|
136
|
-
});
|
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
|
-
});
|
153
|
-
});
|
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
|
-
});
|
170
|
-
});
|
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
|
-
});
|
187
|
-
});
|
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
|
-
});
|
204
|
-
});
|
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
|
-
});
|
221
|
-
});
|
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
|
-
});
|
238
|
-
});
|
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
|
-
});
|
32
|
+
async getCustomChainEndpointsForInstance(returnChainIdsOnly) {
|
33
|
+
const { chainEndpoints, code, message } = await this.sendRequest("orby_getCustomChainEndpointsForInstance", [{ returnChainIdsOnly }]);
|
34
|
+
if (code && message) {
|
35
|
+
console.error("[getCustomChainEndpointsForInstance]", code, message);
|
36
|
+
return undefined;
|
37
|
+
}
|
38
|
+
return chainEndpoints.map((endpoint) => {
|
39
|
+
return {
|
40
|
+
chainId: getChainIdFromOrbyChainId(endpoint.chainId),
|
41
|
+
customRpcUrls: endpoint.customRpcUrls,
|
42
|
+
customIndexerUrls: endpoint.customIndexerUrls,
|
43
|
+
};
|
255
44
|
});
|
256
|
-
}
|
257
|
-
|
258
|
-
}(
|
259
|
-
|
45
|
+
}
|
46
|
+
async getChainsSupportedByDefault() {
|
47
|
+
const { supportedChains, code, message } = await this.sendRequest("orby_getChainsSupportedByDefault", [{}]);
|
48
|
+
if (code && message) {
|
49
|
+
console.error("[getChainsSupportedByDefault]", code, message);
|
50
|
+
return undefined;
|
51
|
+
}
|
52
|
+
return extractBlockchainInformations(supportedChains);
|
53
|
+
}
|
54
|
+
async enabledChainAbstractionForInstance(enable) {
|
55
|
+
const { success, code, message } = await this.sendRequest("orby_enabledChainAbstractionForInstance", [{ enable }]);
|
56
|
+
if (code && message) {
|
57
|
+
console.error("[enabledChainAbstractionForInstance]", code, message);
|
58
|
+
return undefined;
|
59
|
+
}
|
60
|
+
return success;
|
61
|
+
}
|
62
|
+
async enableGasSponsorshipForInstance(enable) {
|
63
|
+
const { success, code, message } = await this.sendRequest("orby_enableGasSponsorshipForInstance", [{ enable }]);
|
64
|
+
if (code && message) {
|
65
|
+
console.error("[enableGasSponsorshipForInstance]", code, message);
|
66
|
+
return undefined;
|
67
|
+
}
|
68
|
+
return success;
|
69
|
+
}
|
70
|
+
async getGasSponsorForInstance() {
|
71
|
+
const { gasSponsor, code, message } = await this.sendRequest("orby_getGasSponsorForInstance", [{}]);
|
72
|
+
if (code && message) {
|
73
|
+
console.error("[getGasSponsorForInstance]", code, message);
|
74
|
+
return undefined;
|
75
|
+
}
|
76
|
+
return gasSponsor;
|
77
|
+
}
|
78
|
+
async getOrbyGasSponsorPolicyForInstance() {
|
79
|
+
const { gasSponsorshipPolicy, message, code } = await this.sendRequest("orby_getOrbyGasSponsorPolicyForInstance", [{}]);
|
80
|
+
if (code && message) {
|
81
|
+
console.error("[getOrbyGasSponsorPolicyForInstance]", code, message);
|
82
|
+
return undefined;
|
83
|
+
}
|
84
|
+
return extractGasSponsorshipPolicy(gasSponsorshipPolicy);
|
85
|
+
}
|
86
|
+
async setOrbyGasSponsorPolicyForInstance(gasSponsorshipPolicy) {
|
87
|
+
const { success, code, message } = await this.sendRequest("orby_setOrbyGasSponsorPolicyForInstance", [{ ...gasSponsorshipPolicy }]);
|
88
|
+
if (code && message) {
|
89
|
+
console.error("[setOrbyGasSponsorPolicyForInstance]", code, message);
|
90
|
+
return undefined;
|
91
|
+
}
|
92
|
+
return success;
|
93
|
+
}
|
94
|
+
async removeOrbyGasSponsorPolicyForInstance() {
|
95
|
+
const { success, code, message } = await this.sendRequest("orby_removeOrbyGasSponsorPolicyForInstance", [{}]);
|
96
|
+
if (code && message) {
|
97
|
+
console.error("[removeOrbyGasSponsorPolicyForInstance]", code, message);
|
98
|
+
return undefined;
|
99
|
+
}
|
100
|
+
return success;
|
101
|
+
}
|
102
|
+
}
|