@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
@@ -20,5 +20,5 @@ export declare class AccountClusterActions extends LibraryRequest {
|
|
20
20
|
}[]): Promise<Activity[]>;
|
21
21
|
getPortfolioOverview(accountClusterId: string): Promise<FungibleTokenOverview>;
|
22
22
|
getFungibleTokenPortfolio(accountClusterId: string): Promise<StandardizedBalance[]>;
|
23
|
-
getFungibleTokenBalances(accountClusterId: string, offset?: number, limit?: number, tokensToOmit?: string[]): Promise<StandardizedBalance[]>;
|
23
|
+
getFungibleTokenBalances(accountClusterId: string, offset?: number, limit?: number, chainId?: bigint, tokensToOmit?: string[]): Promise<StandardizedBalance[]>;
|
24
24
|
}
|
@@ -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,177 +22,321 @@ 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
|
-
|
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 };
|
19
50
|
}
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
51
|
+
};
|
52
|
+
import { extractAccountCluster, extractFungibleTokenOverview, extractStandardizedBalances, } from "../utils/action_helpers";
|
53
|
+
import { LibraryRequest } from "../entities/library_request";
|
54
|
+
import { getChainIdFromOrbyChainId } from "../utils/utils";
|
55
|
+
var AccountClusterActions = /** @class */ (function (_super) {
|
56
|
+
__extends(AccountClusterActions, _super);
|
57
|
+
function AccountClusterActions(library, client, provider) {
|
58
|
+
return _super.call(this, library, client, provider) || this;
|
28
59
|
}
|
29
|
-
|
30
|
-
return __awaiter(this, void 0, void 0, function
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
60
|
+
AccountClusterActions.prototype.createAccountCluster = function (accounts) {
|
61
|
+
return __awaiter(this, void 0, void 0, function () {
|
62
|
+
var formattedAccounts, accountCluster;
|
63
|
+
return __generator(this, function (_a) {
|
64
|
+
switch (_a.label) {
|
65
|
+
case 0:
|
66
|
+
formattedAccounts = accounts.map(function (account) {
|
67
|
+
return account.toAccountModel();
|
68
|
+
});
|
69
|
+
return [4 /*yield*/, this.sendRequest("orby_createAccountCluster", [
|
70
|
+
{ accounts: formattedAccounts },
|
71
|
+
])];
|
72
|
+
case 1:
|
73
|
+
accountCluster = _a.sent();
|
74
|
+
return [2 /*return*/, extractAccountCluster(accountCluster)];
|
75
|
+
}
|
76
|
+
});
|
36
77
|
});
|
37
|
-
}
|
38
|
-
|
39
|
-
return __awaiter(this, void 0, void 0, function
|
40
|
-
|
41
|
-
|
42
|
-
|
78
|
+
};
|
79
|
+
AccountClusterActions.prototype.addToAccountCluster = function (accounts, accountClusterId) {
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
81
|
+
var formattedAccounts, accountCluster;
|
82
|
+
return __generator(this, function (_a) {
|
83
|
+
switch (_a.label) {
|
84
|
+
case 0:
|
85
|
+
formattedAccounts = accounts.map(function (account) {
|
86
|
+
return account.toAccountModel();
|
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
|
+
});
|
43
96
|
});
|
44
|
-
}
|
45
|
-
|
46
|
-
return __awaiter(this, void 0, void 0, function
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
+
});
|
53
113
|
});
|
54
|
-
}
|
55
|
-
|
56
|
-
return __awaiter(this, void 0, void 0, function
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
+
}
|
63
129
|
});
|
64
|
-
const { success, message, code } = yield this.sendRequest("orby_setCustomChainEndpointsForAccountCluster", [{ accountClusterId, chainEndpoints: formattedEndpoints }]);
|
65
|
-
if (code && message) {
|
66
|
-
console.error("[setCustomChainEndpointsForAccountCluster]", code, message);
|
67
|
-
return undefined;
|
68
|
-
}
|
69
|
-
return success;
|
70
130
|
});
|
71
|
-
}
|
72
|
-
|
73
|
-
return __awaiter(this, void 0, void 0, function
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
+
});
|
81
155
|
});
|
82
|
-
}
|
83
|
-
|
84
|
-
return __awaiter(this, void 0, void 0, function
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
+
}
|
96
173
|
});
|
97
174
|
});
|
98
|
-
}
|
99
|
-
|
100
|
-
return __awaiter(this, void 0, void 0, function
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
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
|
+
});
|
107
197
|
});
|
108
|
-
}
|
109
|
-
|
110
|
-
return __awaiter(this, void 0, void 0, function
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
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
|
+
});
|
117
214
|
});
|
118
|
-
}
|
119
|
-
|
120
|
-
return __awaiter(this, void 0, void 0, function
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
chainId:
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
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
|
+
});
|
133
231
|
});
|
134
|
-
}
|
135
|
-
|
136
|
-
return __awaiter(this, void 0, void 0, function
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
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
|
+
});
|
155
254
|
});
|
156
|
-
}
|
157
|
-
|
158
|
-
return __awaiter(this, void 0, void 0, function
|
159
|
-
|
160
|
-
return (
|
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
|
+
});
|
161
283
|
});
|
162
|
-
}
|
163
|
-
|
164
|
-
return __awaiter(this, void 0, void 0, function
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
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
|
+
});
|
171
296
|
});
|
172
|
-
}
|
173
|
-
|
174
|
-
return __awaiter(this, void 0, void 0, function
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
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
|
+
});
|
181
313
|
});
|
182
|
-
}
|
183
|
-
|
184
|
-
|
314
|
+
};
|
315
|
+
AccountClusterActions.prototype.getFungibleTokenBalances = function (accountClusterId, offset, limit, chainId, tokensToOmit) {
|
316
|
+
return __awaiter(this, void 0, void 0, function () {
|
317
|
+
var _a, fungibleTokenBalances, code, message;
|
318
|
+
return __generator(this, function (_b) {
|
319
|
+
switch (_b.label) {
|
320
|
+
case 0: return [4 /*yield*/, this.sendRequest("orby_getFungibleTokenBalances", [
|
321
|
+
{
|
322
|
+
accountClusterId: accountClusterId,
|
323
|
+
offset: offset,
|
324
|
+
limit: limit,
|
325
|
+
chainId: chainId ? "EIP155-".concat(chainId === null || chainId === void 0 ? void 0 : chainId.toString()) : undefined,
|
326
|
+
tokensToOmit: tokensToOmit,
|
327
|
+
},
|
328
|
+
])];
|
329
|
+
case 1:
|
330
|
+
_a = _b.sent(), fungibleTokenBalances = _a.fungibleTokenBalances, code = _a.code, message = _a.message;
|
331
|
+
if (code && message) {
|
332
|
+
console.error("[getFungibleTokenBalances]", code, message);
|
333
|
+
return [2 /*return*/, undefined];
|
334
|
+
}
|
335
|
+
return [2 /*return*/, extractStandardizedBalances(fungibleTokenBalances)];
|
336
|
+
}
|
337
|
+
});
|
338
|
+
});
|
339
|
+
};
|
340
|
+
return AccountClusterActions;
|
341
|
+
}(LibraryRequest));
|
342
|
+
export { AccountClusterActions };
|