@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/CHANGELOG.md
ADDED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Account } from "../entities/account";
|
2
|
-
import { AccountCluster, Activity, ChainEndpoint, FungibleTokenOverview, StandardizedBalance } from "../types";
|
3
|
-
import { ChainSupportStatus, LIBRARY_TYPE, Order } from "../enums";
|
4
|
-
import { LibraryRequest } from "../entities/library_request";
|
1
|
+
import { Account } from "../entities/account.js";
|
2
|
+
import { AccountCluster, Activity, ChainEndpoint, FungibleTokenOverview, StandardizedBalance } from "../types.js";
|
3
|
+
import { ChainSupportStatus, LIBRARY_TYPE, Order } from "../enums.js";
|
4
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
5
5
|
export declare class AccountClusterActions extends LibraryRequest {
|
6
6
|
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
7
7
|
createAccountCluster(accounts: Account[]): Promise<AccountCluster>;
|
@@ -1,342 +1,151 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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 { extractAccountCluster, extractFungibleTokenOverview, extractStandardizedBalances, } from "../utils/action_helpers.js";
|
2
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
3
|
+
import { getChainIdFromOrbyChainId } from "../utils/utils.js";
|
4
|
+
export class AccountClusterActions extends LibraryRequest {
|
5
|
+
constructor(library, client, provider) {
|
6
|
+
super(library, client, provider);
|
50
7
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
function AccountClusterActions(library, client, provider) {
|
58
|
-
return _super.call(this, library, client, provider) || this;
|
8
|
+
async createAccountCluster(accounts) {
|
9
|
+
const formattedAccounts = accounts.map((account) => account.toAccountModel());
|
10
|
+
const accountCluster = await this.sendRequest("orby_createAccountCluster", [
|
11
|
+
{ accounts: formattedAccounts },
|
12
|
+
]);
|
13
|
+
return extractAccountCluster(accountCluster);
|
59
14
|
}
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
return
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
});
|
88
|
-
return [4 /*yield*/, this.sendRequest("orby_addToAccountCluster", [
|
89
|
-
{ accounts: formattedAccounts, accountClusterId: accountClusterId },
|
90
|
-
])];
|
91
|
-
case 1:
|
92
|
-
accountCluster = _a.sent();
|
93
|
-
return [2 /*return*/, extractAccountCluster(accountCluster)];
|
94
|
-
}
|
95
|
-
});
|
96
|
-
});
|
97
|
-
};
|
98
|
-
AccountClusterActions.prototype.removeFromAccountCluster = function (accounts, accountClusterId) {
|
99
|
-
return __awaiter(this, void 0, void 0, function () {
|
100
|
-
var formattedAccounts, accountCluster;
|
101
|
-
return __generator(this, function (_a) {
|
102
|
-
switch (_a.label) {
|
103
|
-
case 0:
|
104
|
-
formattedAccounts = accounts.map(function (account) {
|
105
|
-
return account.toAccountModel();
|
106
|
-
});
|
107
|
-
return [4 /*yield*/, this.sendRequest("orby_removeFromAccountCluster", [{ accounts: formattedAccounts, accountClusterId: accountClusterId }])];
|
108
|
-
case 1:
|
109
|
-
accountCluster = _a.sent();
|
110
|
-
return [2 /*return*/, extractAccountCluster(accountCluster)];
|
111
|
-
}
|
112
|
-
});
|
113
|
-
});
|
114
|
-
};
|
115
|
-
AccountClusterActions.prototype.enableChainAbstractionForAccountCluster = function (accountClusterId, enable) {
|
116
|
-
return __awaiter(this, void 0, void 0, function () {
|
117
|
-
var _a, success, message, code;
|
118
|
-
return __generator(this, function (_b) {
|
119
|
-
switch (_b.label) {
|
120
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_enableChainAbstractionForAccountCluster", [{ accountClusterId: accountClusterId, enable: enable }])];
|
121
|
-
case 1:
|
122
|
-
_a = _b.sent(), success = _a.success, message = _a.message, code = _a.code;
|
123
|
-
if (code && message) {
|
124
|
-
console.error("[enableChainAbstractionForAccountCluster]", code, message);
|
125
|
-
return [2 /*return*/, undefined];
|
126
|
-
}
|
127
|
-
return [2 /*return*/, success];
|
128
|
-
}
|
129
|
-
});
|
130
|
-
});
|
131
|
-
};
|
132
|
-
AccountClusterActions.prototype.setCustomChainEndpointsForAccountCluster = function (accountClusterId, chainEndpoints) {
|
133
|
-
return __awaiter(this, void 0, void 0, function () {
|
134
|
-
var formattedEndpoints, _a, success, message, code;
|
135
|
-
return __generator(this, function (_b) {
|
136
|
-
switch (_b.label) {
|
137
|
-
case 0:
|
138
|
-
formattedEndpoints = chainEndpoints.map(function (endpoint) {
|
139
|
-
return {
|
140
|
-
chainId: "EIP155-".concat(endpoint.chainId),
|
141
|
-
customRpcUrls: endpoint.customRpcUrls,
|
142
|
-
customIndexerUrls: endpoint.customIndexerUrls,
|
143
|
-
};
|
144
|
-
});
|
145
|
-
return [4 /*yield*/, this.sendRequest("orby_setCustomChainEndpointsForAccountCluster", [{ accountClusterId: accountClusterId, chainEndpoints: formattedEndpoints }])];
|
146
|
-
case 1:
|
147
|
-
_a = _b.sent(), success = _a.success, message = _a.message, code = _a.code;
|
148
|
-
if (code && message) {
|
149
|
-
console.error("[setCustomChainEndpointsForAccountCluster]", code, message);
|
150
|
-
return [2 /*return*/, undefined];
|
151
|
-
}
|
152
|
-
return [2 /*return*/, success];
|
153
|
-
}
|
154
|
-
});
|
155
|
-
});
|
156
|
-
};
|
157
|
-
AccountClusterActions.prototype.removeCustomChainEndpointsForAccountCluster = function (accountClusterId, chainIds) {
|
158
|
-
return __awaiter(this, void 0, void 0, function () {
|
159
|
-
var formattedChainIds, _a, success, message, code;
|
160
|
-
return __generator(this, function (_b) {
|
161
|
-
switch (_b.label) {
|
162
|
-
case 0:
|
163
|
-
formattedChainIds = chainIds.map(function (chainId) { return "EIP155-".concat(chainId); });
|
164
|
-
return [4 /*yield*/, this.sendRequest("orby_removeCustomChainEndpointsForAccountCluster", [{ accountClusterId: accountClusterId, chainIds: formattedChainIds }])];
|
165
|
-
case 1:
|
166
|
-
_a = _b.sent(), success = _a.success, message = _a.message, code = _a.code;
|
167
|
-
if (code && message) {
|
168
|
-
console.error("[removeCustomChainEndpointsForAccountCluster]", code, message);
|
169
|
-
return [2 /*return*/, undefined];
|
170
|
-
}
|
171
|
-
return [2 /*return*/, success];
|
172
|
-
}
|
173
|
-
});
|
174
|
-
});
|
175
|
-
};
|
176
|
-
AccountClusterActions.prototype.getCustomChainEndpointsForAccountCluster = function (accountClusterId, returnChainIdsOnly) {
|
177
|
-
return __awaiter(this, void 0, void 0, function () {
|
178
|
-
var _a, chainEndpoints, message, code;
|
179
|
-
return __generator(this, function (_b) {
|
180
|
-
switch (_b.label) {
|
181
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_getCustomChainEndpointsForAccountCluster", [{ accountClusterId: accountClusterId, returnChainIdsOnly: returnChainIdsOnly }])];
|
182
|
-
case 1:
|
183
|
-
_a = _b.sent(), chainEndpoints = _a.chainEndpoints, message = _a.message, code = _a.code;
|
184
|
-
if (code && message) {
|
185
|
-
console.error("[getCustomChainEndpointsForAccountCluster]", code, message);
|
186
|
-
return [2 /*return*/, undefined];
|
187
|
-
}
|
188
|
-
return [2 /*return*/, chainEndpoints.map(function (endpoint) {
|
189
|
-
return {
|
190
|
-
chainId: getChainIdFromOrbyChainId(endpoint.chainId),
|
191
|
-
customRpcUrls: endpoint.customRpcUrls,
|
192
|
-
customIndexerUrls: endpoint.customIndexerUrls,
|
193
|
-
};
|
194
|
-
})];
|
195
|
-
}
|
196
|
-
});
|
197
|
-
});
|
198
|
-
};
|
199
|
-
AccountClusterActions.prototype.isChainSupportedOnAccountCluster = function (accountClusterId, chainId) {
|
200
|
-
return __awaiter(this, void 0, void 0, function () {
|
201
|
-
var _a, supportStatus, message, code;
|
202
|
-
return __generator(this, function (_b) {
|
203
|
-
switch (_b.label) {
|
204
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_isChainSupportedOnAccountCluster", [{ accountClusterId: accountClusterId, chainId: "EIP155-".concat(chainId) }])];
|
205
|
-
case 1:
|
206
|
-
_a = _b.sent(), supportStatus = _a.supportStatus, message = _a.message, code = _a.code;
|
207
|
-
if (code && message) {
|
208
|
-
console.error("[isChainSupportedOnAccountCluster]", code, message);
|
209
|
-
return [2 /*return*/, undefined];
|
210
|
-
}
|
211
|
-
return [2 /*return*/, supportStatus];
|
212
|
-
}
|
213
|
-
});
|
214
|
-
});
|
215
|
-
};
|
216
|
-
AccountClusterActions.prototype.getNodeRpcUrl = function (accountClusterId, chainId) {
|
217
|
-
return __awaiter(this, void 0, void 0, function () {
|
218
|
-
var _a, nodeRpcUrl, code, message;
|
219
|
-
return __generator(this, function (_b) {
|
220
|
-
switch (_b.label) {
|
221
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_getNodeRpcUrl", [[{ accountClusterId: accountClusterId, chainId: "EIP155-".concat(chainId) }]])];
|
222
|
-
case 1:
|
223
|
-
_a = _b.sent(), nodeRpcUrl = _a.nodeRpcUrl, code = _a.code, message = _a.message;
|
224
|
-
if (code && message) {
|
225
|
-
console.error("[getNodeRpcUrl]", code, message);
|
226
|
-
return [2 /*return*/, undefined];
|
227
|
-
}
|
228
|
-
return [2 /*return*/, nodeRpcUrl];
|
229
|
-
}
|
230
|
-
});
|
231
|
-
});
|
232
|
-
};
|
233
|
-
AccountClusterActions.prototype.getVirtualNodeRpcUrl = function (accountClusterId, chainId, entrypointAccountAddress) {
|
234
|
-
return __awaiter(this, void 0, void 0, function () {
|
235
|
-
var _a, virtualNodeRpcUrl, message, code;
|
236
|
-
return __generator(this, function (_b) {
|
237
|
-
switch (_b.label) {
|
238
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_getVirtualNodeRpcUrl", [
|
239
|
-
{
|
240
|
-
accountClusterId: accountClusterId,
|
241
|
-
chainId: "EIP155-".concat(chainId),
|
242
|
-
entrypointAccountAddress: entrypointAccountAddress,
|
243
|
-
},
|
244
|
-
])];
|
245
|
-
case 1:
|
246
|
-
_a = _b.sent(), virtualNodeRpcUrl = _a.virtualNodeRpcUrl, message = _a.message, code = _a.code;
|
247
|
-
if (code && message) {
|
248
|
-
console.error("[getVirtualNodeRpcUrl]", code, message);
|
249
|
-
return [2 /*return*/, undefined];
|
250
|
-
}
|
251
|
-
return [2 /*return*/, virtualNodeRpcUrl];
|
252
|
-
}
|
253
|
-
});
|
254
|
-
});
|
255
|
-
};
|
256
|
-
AccountClusterActions.prototype.getActivity = function (accountClusterId, limit, offset, order, startDate, endDate, filters) {
|
257
|
-
return __awaiter(this, void 0, void 0, function () {
|
258
|
-
var _a, virtualNodeRpcUrl, code, message;
|
259
|
-
return __generator(this, function (_b) {
|
260
|
-
switch (_b.label) {
|
261
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_getActivity", [
|
262
|
-
[
|
263
|
-
{
|
264
|
-
accountClusterId: accountClusterId,
|
265
|
-
limit: limit,
|
266
|
-
offset: offset,
|
267
|
-
order: order,
|
268
|
-
startDate: startDate,
|
269
|
-
endDate: endDate,
|
270
|
-
filters: filters,
|
271
|
-
},
|
272
|
-
],
|
273
|
-
])];
|
274
|
-
case 1:
|
275
|
-
_a = _b.sent(), virtualNodeRpcUrl = _a.virtualNodeRpcUrl, code = _a.code, message = _a.message;
|
276
|
-
if (code && message) {
|
277
|
-
console.error("[getActivity]", code, message);
|
278
|
-
return [2 /*return*/, undefined];
|
279
|
-
}
|
280
|
-
return [2 /*return*/, virtualNodeRpcUrl];
|
281
|
-
}
|
282
|
-
});
|
283
|
-
});
|
284
|
-
};
|
285
|
-
AccountClusterActions.prototype.getPortfolioOverview = function (accountClusterId) {
|
286
|
-
return __awaiter(this, void 0, void 0, function () {
|
287
|
-
var fungibleTokenOverview;
|
288
|
-
return __generator(this, function (_a) {
|
289
|
-
switch (_a.label) {
|
290
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_getPortfolioOverview", [{ accountClusterId: accountClusterId }])];
|
291
|
-
case 1:
|
292
|
-
fungibleTokenOverview = _a.sent();
|
293
|
-
return [2 /*return*/, extractFungibleTokenOverview(fungibleTokenOverview)];
|
294
|
-
}
|
295
|
-
});
|
296
|
-
});
|
297
|
-
};
|
298
|
-
AccountClusterActions.prototype.getFungibleTokenPortfolio = function (accountClusterId) {
|
299
|
-
return __awaiter(this, void 0, void 0, function () {
|
300
|
-
var _a, fungibleTokenBalances, code, message;
|
301
|
-
return __generator(this, function (_b) {
|
302
|
-
switch (_b.label) {
|
303
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_getFungibleTokenPortfolio", [{ accountClusterId: accountClusterId }])];
|
304
|
-
case 1:
|
305
|
-
_a = _b.sent(), fungibleTokenBalances = _a.fungibleTokenBalances, code = _a.code, message = _a.message;
|
306
|
-
if (code && message) {
|
307
|
-
console.error("[getFungibleTokenPortfolio]", code, message);
|
308
|
-
return [2 /*return*/, undefined];
|
309
|
-
}
|
310
|
-
return [2 /*return*/, extractStandardizedBalances(fungibleTokenBalances)];
|
311
|
-
}
|
312
|
-
});
|
15
|
+
async addToAccountCluster(accounts, accountClusterId) {
|
16
|
+
const formattedAccounts = accounts.map((account) => account.toAccountModel());
|
17
|
+
const accountCluster = await this.sendRequest("orby_addToAccountCluster", [
|
18
|
+
{ accounts: formattedAccounts, accountClusterId },
|
19
|
+
]);
|
20
|
+
return extractAccountCluster(accountCluster);
|
21
|
+
}
|
22
|
+
async removeFromAccountCluster(accounts, accountClusterId) {
|
23
|
+
const formattedAccounts = accounts.map((account) => account.toAccountModel());
|
24
|
+
const accountCluster = await this.sendRequest("orby_removeFromAccountCluster", [{ accounts: formattedAccounts, accountClusterId }]);
|
25
|
+
return extractAccountCluster(accountCluster);
|
26
|
+
}
|
27
|
+
async enableChainAbstractionForAccountCluster(accountClusterId, enable) {
|
28
|
+
const { success, message, code } = await this.sendRequest("orby_enableChainAbstractionForAccountCluster", [{ accountClusterId, enable }]);
|
29
|
+
if (code && message) {
|
30
|
+
console.error("[enableChainAbstractionForAccountCluster]", code, message);
|
31
|
+
return undefined;
|
32
|
+
}
|
33
|
+
return success;
|
34
|
+
}
|
35
|
+
async setCustomChainEndpointsForAccountCluster(accountClusterId, chainEndpoints) {
|
36
|
+
const formattedEndpoints = chainEndpoints.map((endpoint) => {
|
37
|
+
return {
|
38
|
+
chainId: `EIP155-${endpoint.chainId}`,
|
39
|
+
customRpcUrls: endpoint.customRpcUrls,
|
40
|
+
customIndexerUrls: endpoint.customIndexerUrls,
|
41
|
+
};
|
313
42
|
});
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
43
|
+
const { success, message, code } = await this.sendRequest("orby_setCustomChainEndpointsForAccountCluster", [{ accountClusterId, chainEndpoints: formattedEndpoints }]);
|
44
|
+
if (code && message) {
|
45
|
+
console.error("[setCustomChainEndpointsForAccountCluster]", code, message);
|
46
|
+
return undefined;
|
47
|
+
}
|
48
|
+
return success;
|
49
|
+
}
|
50
|
+
async removeCustomChainEndpointsForAccountCluster(accountClusterId, chainIds) {
|
51
|
+
const formattedChainIds = chainIds.map((chainId) => `EIP155-${chainId}`);
|
52
|
+
const { success, message, code } = await this.sendRequest("orby_removeCustomChainEndpointsForAccountCluster", [{ accountClusterId, chainIds: formattedChainIds }]);
|
53
|
+
if (code && message) {
|
54
|
+
console.error("[removeCustomChainEndpointsForAccountCluster]", code, message);
|
55
|
+
return undefined;
|
56
|
+
}
|
57
|
+
return success;
|
58
|
+
}
|
59
|
+
async getCustomChainEndpointsForAccountCluster(accountClusterId, returnChainIdsOnly) {
|
60
|
+
const { chainEndpoints, message, code } = await this.sendRequest("orby_getCustomChainEndpointsForAccountCluster", [{ accountClusterId, returnChainIdsOnly }]);
|
61
|
+
if (code && message) {
|
62
|
+
console.error("[getCustomChainEndpointsForAccountCluster]", code, message);
|
63
|
+
return undefined;
|
64
|
+
}
|
65
|
+
return chainEndpoints.map((endpoint) => {
|
66
|
+
return {
|
67
|
+
chainId: getChainIdFromOrbyChainId(endpoint.chainId),
|
68
|
+
customRpcUrls: endpoint.customRpcUrls,
|
69
|
+
customIndexerUrls: endpoint.customIndexerUrls,
|
70
|
+
};
|
338
71
|
});
|
339
|
-
}
|
340
|
-
|
341
|
-
}(
|
342
|
-
|
72
|
+
}
|
73
|
+
async isChainSupportedOnAccountCluster(accountClusterId, chainId) {
|
74
|
+
const { supportStatus, message, code } = await this.sendRequest("orby_isChainSupportedOnAccountCluster", [{ accountClusterId, chainId: `EIP155-${chainId}` }]);
|
75
|
+
if (code && message) {
|
76
|
+
console.error("[isChainSupportedOnAccountCluster]", code, message);
|
77
|
+
return undefined;
|
78
|
+
}
|
79
|
+
return supportStatus;
|
80
|
+
}
|
81
|
+
async getNodeRpcUrl(accountClusterId, chainId) {
|
82
|
+
const { nodeRpcUrl, code, message } = await this.sendRequest("orby_getNodeRpcUrl", [[{ accountClusterId, chainId: `EIP155-${chainId}` }]]);
|
83
|
+
if (code && message) {
|
84
|
+
console.error("[getNodeRpcUrl]", code, message);
|
85
|
+
return undefined;
|
86
|
+
}
|
87
|
+
return nodeRpcUrl;
|
88
|
+
}
|
89
|
+
async getVirtualNodeRpcUrl(accountClusterId, chainId, entrypointAccountAddress) {
|
90
|
+
const { virtualNodeRpcUrl, message, code } = await this.sendRequest("orby_getVirtualNodeRpcUrl", [
|
91
|
+
{
|
92
|
+
accountClusterId,
|
93
|
+
chainId: `EIP155-${chainId}`,
|
94
|
+
entrypointAccountAddress,
|
95
|
+
},
|
96
|
+
]);
|
97
|
+
if (code && message) {
|
98
|
+
console.error("[getVirtualNodeRpcUrl]", code, message);
|
99
|
+
return undefined;
|
100
|
+
}
|
101
|
+
return virtualNodeRpcUrl;
|
102
|
+
}
|
103
|
+
async getActivity(accountClusterId, limit, offset, order, startDate, endDate, filters) {
|
104
|
+
const { virtualNodeRpcUrl, code, message } = await this.sendRequest("orby_getActivity", [
|
105
|
+
[
|
106
|
+
{
|
107
|
+
accountClusterId,
|
108
|
+
limit,
|
109
|
+
offset,
|
110
|
+
order,
|
111
|
+
startDate,
|
112
|
+
endDate,
|
113
|
+
filters,
|
114
|
+
},
|
115
|
+
],
|
116
|
+
]);
|
117
|
+
if (code && message) {
|
118
|
+
console.error("[getActivity]", code, message);
|
119
|
+
return undefined;
|
120
|
+
}
|
121
|
+
return virtualNodeRpcUrl;
|
122
|
+
}
|
123
|
+
async getPortfolioOverview(accountClusterId) {
|
124
|
+
const fungibleTokenOverview = await this.sendRequest("orby_getPortfolioOverview", [{ accountClusterId }]);
|
125
|
+
return extractFungibleTokenOverview(fungibleTokenOverview);
|
126
|
+
}
|
127
|
+
async getFungibleTokenPortfolio(accountClusterId) {
|
128
|
+
const { fungibleTokenBalances, code, message } = await this.sendRequest("orby_getFungibleTokenPortfolio", [{ accountClusterId }]);
|
129
|
+
if (code && message) {
|
130
|
+
console.error("[getFungibleTokenPortfolio]", code, message);
|
131
|
+
return undefined;
|
132
|
+
}
|
133
|
+
return extractStandardizedBalances(fungibleTokenBalances);
|
134
|
+
}
|
135
|
+
async getFungibleTokenBalances(accountClusterId, offset, limit, chainId, tokensToOmit) {
|
136
|
+
const { fungibleTokenBalances, code, message } = await this.sendRequest("orby_getFungibleTokenBalances", [
|
137
|
+
{
|
138
|
+
accountClusterId,
|
139
|
+
offset,
|
140
|
+
limit,
|
141
|
+
chainId: chainId ? `EIP155-${chainId?.toString()}` : undefined,
|
142
|
+
tokensToOmit,
|
143
|
+
},
|
144
|
+
]);
|
145
|
+
if (code && message) {
|
146
|
+
console.error("[getFungibleTokenBalances]", code, message);
|
147
|
+
return undefined;
|
148
|
+
}
|
149
|
+
return extractStandardizedBalances(fungibleTokenBalances);
|
150
|
+
}
|
151
|
+
}
|
package/dist/actions/admin.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { GasSpendForInstance, GasSponsorshipData } from "../types";
|
2
|
-
import { LibraryRequest } from "../entities/library_request";
|
3
|
-
import { LIBRARY_TYPE } from "../enums";
|
1
|
+
import { GasSpendForInstance, GasSponsorshipData } from "../types.js";
|
2
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
3
|
+
import { LIBRARY_TYPE } from "../enums.js";
|
4
4
|
export declare class AdminActions extends LibraryRequest {
|
5
5
|
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
6
6
|
createInstance(name: string): Promise<{
|