@orb-labs/orby-core 0.0.13 → 0.0.15
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 +9 -0
- package/dist/actions/operation.d.ts +1 -1
- package/dist/actions/operation.js +5 -3
- package/dist/cjs/actions/account_cluster.d.ts +32 -0
- package/dist/cjs/actions/account_cluster.js +211 -0
- package/dist/cjs/actions/admin.d.ts +17 -0
- package/dist/cjs/actions/admin.js +43 -0
- package/dist/cjs/actions/application.d.ts +6 -0
- package/dist/cjs/actions/application.js +20 -0
- package/dist/cjs/actions/blockchain.d.ts +16 -0
- package/dist/cjs/actions/blockchain.js +39 -0
- package/dist/cjs/actions/instance.d.ts +15 -0
- package/dist/cjs/actions/instance.js +98 -0
- package/dist/cjs/actions/operation.d.ts +99 -0
- package/dist/cjs/actions/operation.js +345 -0
- package/dist/cjs/actions/token.d.ts +15 -0
- package/dist/cjs/actions/token.js +50 -0
- package/dist/cjs/constants.d.ts +14 -0
- package/dist/cjs/constants.js +139 -0
- package/dist/cjs/entities/account.d.ts +14 -0
- package/dist/cjs/entities/account.js +49 -0
- package/dist/cjs/entities/financial/account_balance.d.ts +12 -0
- package/dist/cjs/entities/financial/account_balance.js +35 -0
- package/dist/cjs/entities/financial/asset.d.ts +31 -0
- package/dist/cjs/entities/financial/asset.js +42 -0
- package/dist/cjs/entities/financial/currency.d.ts +41 -0
- package/dist/cjs/entities/financial/currency.js +56 -0
- package/dist/cjs/entities/financial/currency_amount.d.ts +34 -0
- package/dist/cjs/entities/financial/currency_amount.js +99 -0
- package/dist/cjs/entities/financial/fungible_token.d.ts +41 -0
- package/dist/cjs/entities/financial/fungible_token.js +68 -0
- package/dist/cjs/entities/financial/fungible_token_amount.d.ts +36 -0
- package/dist/cjs/entities/financial/fungible_token_amount.js +102 -0
- package/dist/cjs/entities/financial/non_fungible_token.d.ts +39 -0
- package/dist/cjs/entities/financial/non_fungible_token.js +65 -0
- package/dist/cjs/entities/financial/semi_fungible_token.d.ts +41 -0
- package/dist/cjs/entities/financial/semi_fungible_token.js +67 -0
- package/dist/cjs/entities/library_request.d.ts +8 -0
- package/dist/cjs/entities/library_request.js +37 -0
- package/dist/cjs/entities/state.d.ts +22 -0
- package/dist/cjs/entities/state.js +106 -0
- package/dist/cjs/enums.d.ts +116 -0
- package/dist/cjs/enums.js +138 -0
- package/dist/cjs/index.d.ts +29 -0
- package/dist/cjs/index.js +49 -0
- package/dist/cjs/interfaces/account_cluster.d.ts +30 -0
- package/dist/cjs/interfaces/account_cluster.js +2 -0
- package/dist/cjs/interfaces/admin.d.ts +14 -0
- package/dist/cjs/interfaces/admin.js +2 -0
- package/dist/cjs/interfaces/application.d.ts +3 -0
- package/dist/cjs/interfaces/application.js +2 -0
- package/dist/cjs/interfaces/blockchain.d.ts +13 -0
- package/dist/cjs/interfaces/blockchain.js +2 -0
- package/dist/cjs/interfaces/instance.d.ts +12 -0
- package/dist/cjs/interfaces/instance.js +2 -0
- package/dist/cjs/interfaces/operation.d.ts +97 -0
- package/dist/cjs/interfaces/operation.js +2 -0
- package/dist/cjs/interfaces/orby.d.ts +9 -0
- package/dist/cjs/interfaces/orby.js +2 -0
- package/dist/cjs/interfaces/token.d.ts +12 -0
- package/dist/cjs/interfaces/token.js +2 -0
- package/dist/cjs/types.d.ts +152 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils/action_helpers.d.ts +22 -0
- package/dist/cjs/utils/action_helpers.js +274 -0
- package/dist/cjs/utils/utils.d.ts +10 -0
- package/dist/cjs/utils/utils.js +79 -0
- package/dist/cjs/utils/validateAndParseAddress.d.ts +10 -0
- package/dist/cjs/utils/validateAndParseAddress.js +29 -0
- package/dist/esm/actions/account_cluster.d.ts +32 -0
- package/dist/esm/actions/account_cluster.js +207 -0
- package/dist/esm/actions/admin.d.ts +17 -0
- package/dist/esm/actions/admin.js +39 -0
- package/dist/esm/actions/application.d.ts +6 -0
- package/dist/esm/actions/application.js +16 -0
- package/dist/esm/actions/blockchain.d.ts +16 -0
- package/dist/esm/actions/blockchain.js +35 -0
- package/dist/esm/actions/instance.d.ts +15 -0
- package/dist/esm/actions/instance.js +94 -0
- package/dist/esm/actions/operation.d.ts +99 -0
- package/dist/esm/actions/operation.js +341 -0
- package/dist/esm/actions/token.d.ts +15 -0
- package/dist/esm/actions/token.js +46 -0
- package/dist/esm/constants.d.ts +14 -0
- package/dist/esm/constants.js +133 -0
- package/dist/esm/entities/account.d.ts +14 -0
- package/dist/esm/entities/account.js +45 -0
- package/dist/esm/entities/financial/account_balance.d.ts +12 -0
- package/dist/esm/entities/financial/account_balance.js +31 -0
- package/dist/esm/entities/financial/asset.d.ts +31 -0
- package/dist/esm/entities/financial/asset.js +38 -0
- package/dist/esm/entities/financial/currency.d.ts +41 -0
- package/dist/esm/entities/financial/currency.js +49 -0
- package/dist/esm/entities/financial/currency_amount.d.ts +34 -0
- package/dist/esm/entities/financial/currency_amount.js +92 -0
- package/dist/esm/entities/financial/fungible_token.d.ts +41 -0
- package/dist/esm/entities/financial/fungible_token.js +64 -0
- package/dist/esm/entities/financial/fungible_token_amount.d.ts +36 -0
- package/dist/esm/entities/financial/fungible_token_amount.js +95 -0
- package/dist/esm/entities/financial/non_fungible_token.d.ts +39 -0
- package/dist/esm/entities/financial/non_fungible_token.js +61 -0
- package/dist/esm/entities/financial/semi_fungible_token.d.ts +41 -0
- package/dist/esm/entities/financial/semi_fungible_token.js +63 -0
- package/dist/esm/entities/library_request.d.ts +8 -0
- package/dist/esm/entities/library_request.js +30 -0
- package/dist/esm/entities/state.d.ts +22 -0
- package/dist/esm/entities/state.js +102 -0
- package/dist/esm/enums.d.ts +116 -0
- package/dist/esm/enums.js +135 -0
- package/dist/esm/index.d.ts +29 -0
- package/dist/esm/index.js +33 -0
- package/dist/esm/interfaces/account_cluster.d.ts +30 -0
- package/dist/esm/interfaces/account_cluster.js +1 -0
- package/dist/esm/interfaces/admin.d.ts +14 -0
- package/dist/esm/interfaces/admin.js +1 -0
- package/dist/esm/interfaces/application.d.ts +3 -0
- package/dist/esm/interfaces/application.js +1 -0
- package/dist/esm/interfaces/blockchain.d.ts +13 -0
- package/dist/esm/interfaces/blockchain.js +1 -0
- package/dist/esm/interfaces/instance.d.ts +12 -0
- package/dist/esm/interfaces/instance.js +1 -0
- package/dist/esm/interfaces/operation.d.ts +97 -0
- package/dist/esm/interfaces/operation.js +1 -0
- package/dist/esm/interfaces/orby.d.ts +9 -0
- package/dist/esm/interfaces/orby.js +1 -0
- package/dist/esm/interfaces/token.d.ts +12 -0
- package/dist/esm/interfaces/token.js +1 -0
- package/dist/esm/types.d.ts +152 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils/action_helpers.d.ts +22 -0
- package/dist/esm/utils/action_helpers.js +250 -0
- package/dist/esm/utils/utils.d.ts +10 -0
- package/dist/esm/utils/utils.js +70 -0
- package/dist/esm/utils/validateAndParseAddress.d.ts +10 -0
- package/dist/esm/utils/validateAndParseAddress.js +25 -0
- package/dist/interfaces/operation.d.ts +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/action_helpers.js +1 -1
- package/package.json +16 -7
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
### Unreleased
|
4
4
|
|
5
|
+
### 0.0.15
|
6
|
+
|
7
|
+
- feat: support dual module format builds
|
8
|
+
|
9
|
+
### 0.0.14
|
10
|
+
|
11
|
+
- passing optional request timeout to subscribeToOperationStatuses
|
12
|
+
- increase default timeout to 5 minutes
|
13
|
+
|
5
14
|
### 0.0.13
|
6
15
|
|
7
16
|
- fixing types of returned values from the `getCustomChainEndpointsForAccountCluster` function
|
@@ -87,7 +87,7 @@ export declare class OperationActions extends LibraryRequest {
|
|
87
87
|
address?: string;
|
88
88
|
}[];
|
89
89
|
}): Promise<OperationSet>;
|
90
|
-
subscribeToOperationStatuses(ids?: string[], onOperationStatusesUpdateCallback?: (statusSummary: OperationStatusType, primaryOperationStatus?: OperationStatus, allOperationStatuses?: OperationStatus[]) => void): {
|
90
|
+
subscribeToOperationStatuses(ids?: string[], onOperationStatusesUpdateCallback?: (statusSummary: OperationStatusType, primaryOperationStatus?: OperationStatus, allOperationStatuses?: OperationStatus[]) => void, timout?: number): {
|
91
91
|
intervalId: NodeJS.Timeout | null;
|
92
92
|
};
|
93
93
|
sendOperationSet(accountClusterId: string, operationSet: OperationSet, signOperation: (operation: OnchainOperation) => Promise<SignedOperation | undefined>): Promise<{
|
@@ -251,13 +251,15 @@ export class OperationActions extends LibraryRequest {
|
|
251
251
|
]);
|
252
252
|
return extractOperationSet(operationSet);
|
253
253
|
}
|
254
|
-
subscribeToOperationStatuses(ids, onOperationStatusesUpdateCallback) {
|
254
|
+
subscribeToOperationStatuses(ids, onOperationStatusesUpdateCallback, timout) {
|
255
255
|
let intervalId = null;
|
256
256
|
let totalWaitTime = 0;
|
257
|
+
const timeoutOrDefault = timout ?? 300_000;
|
257
258
|
if (ids && ids?.length > 0) {
|
258
259
|
const waitTime = 500;
|
259
260
|
intervalId = setInterval(async () => {
|
260
261
|
let statusSummary = OperationStatusType.WAITING_PRECONDITION;
|
262
|
+
let primaryOperation;
|
261
263
|
try {
|
262
264
|
const statuses = ids && ids?.length > 0
|
263
265
|
? await this?.getOperationStatuses(ids)
|
@@ -274,7 +276,7 @@ export class OperationActions extends LibraryRequest {
|
|
274
276
|
else if (statuses.every((status) => status.status == OperationStatusType.SUCCESSFUL)) {
|
275
277
|
statusSummary = OperationStatusType.SUCCESSFUL;
|
276
278
|
}
|
277
|
-
|
279
|
+
primaryOperation = statuses?.find((status) => status.type == OperationType.FINAL_TRANSACTION);
|
278
280
|
if (primaryOperation?.status == OperationStatusType.PENDING) {
|
279
281
|
statusSummary = OperationStatusType.PENDING;
|
280
282
|
}
|
@@ -290,7 +292,7 @@ export class OperationActions extends LibraryRequest {
|
|
290
292
|
clearInterval(intervalId);
|
291
293
|
intervalId = null;
|
292
294
|
}
|
293
|
-
else if (intervalId && totalWaitTime >=
|
295
|
+
else if (intervalId && totalWaitTime >= timeoutOrDefault) {
|
294
296
|
// we cant wait for more than 2 ETH blocks
|
295
297
|
clearInterval(intervalId);
|
296
298
|
intervalId = null;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { Account } from "../entities/account.js";
|
2
|
+
import { AccountCluster, Activity, ChainEndpoint, FungibleTokenOverview, StandardizedBalance, VirtualNodeRpcUrlForSupportedChain } from "../types.js";
|
3
|
+
import { ChainSupportStatus, LIBRARY_TYPE, Order } from "../enums.js";
|
4
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
5
|
+
export declare class AccountClusterActions extends LibraryRequest {
|
6
|
+
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
7
|
+
createAccountCluster(accounts: Account[]): Promise<AccountCluster>;
|
8
|
+
addToAccountCluster(accounts: Account[], accountClusterId: string): Promise<AccountCluster>;
|
9
|
+
removeFromAccountCluster(accounts: Account[], accountClusterId: string): Promise<AccountCluster>;
|
10
|
+
getVirtualNodeRpcUrlsForSupportedChains(accountClusterId: string): Promise<VirtualNodeRpcUrlForSupportedChain[]>;
|
11
|
+
enableChainAbstractionForAccountCluster(accountClusterId: string, enable: boolean): Promise<boolean>;
|
12
|
+
setCustomChainEndpointsForAccountCluster(accountClusterId: string, chainEndpoints: ChainEndpoint[]): Promise<boolean>;
|
13
|
+
removeCustomChainEndpointsForAccountCluster(accountClusterId: string, chainIds: bigint[]): Promise<boolean>;
|
14
|
+
getCustomChainEndpointsForAccountCluster(accountClusterId: string, returnChainIdsOnly: boolean): Promise<ChainEndpoint[]>;
|
15
|
+
isChainSupportedOnAccountCluster(accountClusterId: string, chainId: bigint): Promise<ChainSupportStatus>;
|
16
|
+
getNodeRpcUrl(accountClusterId: string, chainId: bigint): Promise<string>;
|
17
|
+
getVirtualNodeRpcUrl(accountClusterId: string, chainId: bigint, entrypointAccountAddress: string): Promise<string>;
|
18
|
+
getActivity(accountClusterId: string, limit?: number, offset?: number, order?: Order, startDate?: number, endDate?: number, filters?: {
|
19
|
+
transactionHash?: string;
|
20
|
+
address?: string;
|
21
|
+
}[]): Promise<{
|
22
|
+
activities: Activity[];
|
23
|
+
pageInfo: {
|
24
|
+
hasNextPage: boolean;
|
25
|
+
hasPreviousPage: boolean;
|
26
|
+
totalCount: number;
|
27
|
+
};
|
28
|
+
}>;
|
29
|
+
getPortfolioOverview(accountClusterId: string): Promise<FungibleTokenOverview>;
|
30
|
+
getFungibleTokenPortfolio(accountClusterId: string): Promise<StandardizedBalance[]>;
|
31
|
+
getFungibleTokenBalances(accountClusterId: string, offset?: number, limit?: number, chainId?: bigint, tokensToOmit?: string[]): Promise<StandardizedBalance[]>;
|
32
|
+
}
|
@@ -0,0 +1,211 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AccountClusterActions = void 0;
|
4
|
+
const action_helpers_js_1 = require("../utils/action_helpers.js");
|
5
|
+
const library_request_js_1 = require("../entities/library_request.js");
|
6
|
+
const utils_js_1 = require("../utils/utils.js");
|
7
|
+
class AccountClusterActions extends library_request_js_1.LibraryRequest {
|
8
|
+
constructor(library, client, provider) {
|
9
|
+
super(library, client, provider);
|
10
|
+
}
|
11
|
+
async createAccountCluster(accounts) {
|
12
|
+
const formattedAccounts = accounts.map((account) => account.toAccountModel());
|
13
|
+
const accountCluster = await this.sendRequest("orby_createAccountCluster", [
|
14
|
+
{
|
15
|
+
accounts: formattedAccounts,
|
16
|
+
},
|
17
|
+
]);
|
18
|
+
return (0, action_helpers_js_1.extractAccountCluster)(accountCluster);
|
19
|
+
}
|
20
|
+
async addToAccountCluster(accounts, accountClusterId) {
|
21
|
+
const formattedAccounts = accounts.map((account) => account.toAccountModel());
|
22
|
+
const accountCluster = await this.sendRequest("orby_addToAccountCluster", [
|
23
|
+
{
|
24
|
+
accounts: formattedAccounts,
|
25
|
+
accountClusterId,
|
26
|
+
},
|
27
|
+
]);
|
28
|
+
return (0, action_helpers_js_1.extractAccountCluster)(accountCluster);
|
29
|
+
}
|
30
|
+
async removeFromAccountCluster(accounts, accountClusterId) {
|
31
|
+
const formattedAccounts = accounts.map((account) => account.toAccountModel());
|
32
|
+
const accountCluster = await this.sendRequest("orby_removeFromAccountCluster", [
|
33
|
+
{
|
34
|
+
accounts: formattedAccounts,
|
35
|
+
accountClusterId,
|
36
|
+
},
|
37
|
+
]);
|
38
|
+
return (0, action_helpers_js_1.extractAccountCluster)(accountCluster);
|
39
|
+
}
|
40
|
+
async getVirtualNodeRpcUrlsForSupportedChains(accountClusterId) {
|
41
|
+
const { virtualNodeRpcUrlsForSupportedChains, message, code } = await this.sendRequest("orby_getVirtualNodeRpcUrlsForSupportedChains", [
|
42
|
+
{
|
43
|
+
accountClusterId,
|
44
|
+
},
|
45
|
+
]);
|
46
|
+
if (code && message) {
|
47
|
+
console.error("[getVirtualNodeRpcUrlsForSupportedChains]", code, message);
|
48
|
+
return undefined;
|
49
|
+
}
|
50
|
+
return virtualNodeRpcUrlsForSupportedChains.map((info) => {
|
51
|
+
return {
|
52
|
+
chainId: (0, utils_js_1.getChainIdFromOrbyChainId)(info.chainId),
|
53
|
+
virtualNodeRpcUrl: info.virtualNodeRpcUrl,
|
54
|
+
entrypointAccountAddress: info?.entrypointAccountAddress?.toLowerCase(),
|
55
|
+
};
|
56
|
+
});
|
57
|
+
}
|
58
|
+
async enableChainAbstractionForAccountCluster(accountClusterId, enable) {
|
59
|
+
const { success, message, code } = await this.sendRequest("orby_enableChainAbstractionForAccountCluster", [
|
60
|
+
{
|
61
|
+
accountClusterId,
|
62
|
+
enable,
|
63
|
+
},
|
64
|
+
]);
|
65
|
+
if (code && message) {
|
66
|
+
console.error("[enableChainAbstractionForAccountCluster]", code, message);
|
67
|
+
return undefined;
|
68
|
+
}
|
69
|
+
return success;
|
70
|
+
}
|
71
|
+
async setCustomChainEndpointsForAccountCluster(accountClusterId, chainEndpoints) {
|
72
|
+
const formattedEndpoints = chainEndpoints.map((endpoint) => {
|
73
|
+
return {
|
74
|
+
chainId: (0, utils_js_1.getOrbyChainId)(endpoint.chainId),
|
75
|
+
customRpcUrls: endpoint.customRpcUrls,
|
76
|
+
customIndexerUrls: endpoint.customIndexerUrls,
|
77
|
+
};
|
78
|
+
});
|
79
|
+
const { success, message, code } = await this.sendRequest("orby_setCustomChainEndpointsForAccountCluster", [
|
80
|
+
{
|
81
|
+
accountClusterId,
|
82
|
+
chainEndpoints: formattedEndpoints,
|
83
|
+
},
|
84
|
+
]);
|
85
|
+
if (code && message) {
|
86
|
+
console.error("[setCustomChainEndpointsForAccountCluster]", code, message);
|
87
|
+
return undefined;
|
88
|
+
}
|
89
|
+
return success;
|
90
|
+
}
|
91
|
+
async removeCustomChainEndpointsForAccountCluster(accountClusterId, chainIds) {
|
92
|
+
const formattedChainIds = chainIds.map((chainId) => (0, utils_js_1.getOrbyChainId)(chainId));
|
93
|
+
const { success, message, code } = await this.sendRequest("orby_removeCustomChainEndpointsForAccountCluster", [
|
94
|
+
{
|
95
|
+
accountClusterId,
|
96
|
+
chainIds: formattedChainIds,
|
97
|
+
},
|
98
|
+
]);
|
99
|
+
if (code && message) {
|
100
|
+
console.error("[removeCustomChainEndpointsForAccountCluster]", code, message);
|
101
|
+
return undefined;
|
102
|
+
}
|
103
|
+
return success;
|
104
|
+
}
|
105
|
+
async getCustomChainEndpointsForAccountCluster(accountClusterId, returnChainIdsOnly) {
|
106
|
+
const { chainEndpoints, message, code } = await this.sendRequest("orby_getCustomChainEndpointsForAccountCluster", [
|
107
|
+
{
|
108
|
+
accountClusterId,
|
109
|
+
returnChainIdsOnly,
|
110
|
+
},
|
111
|
+
]);
|
112
|
+
if (code && message) {
|
113
|
+
console.error("[getCustomChainEndpointsForAccountCluster]", code, message);
|
114
|
+
return undefined;
|
115
|
+
}
|
116
|
+
return chainEndpoints.map((endpoint) => {
|
117
|
+
return {
|
118
|
+
chainId: (0, utils_js_1.getChainIdFromOrbyChainId)(endpoint.chainId),
|
119
|
+
customRpcUrls: endpoint.customRpcUrls,
|
120
|
+
customIndexerUrls: endpoint.customIndexerUrls,
|
121
|
+
};
|
122
|
+
});
|
123
|
+
}
|
124
|
+
async isChainSupportedOnAccountCluster(accountClusterId, chainId) {
|
125
|
+
const { supportStatus, message, code } = await this.sendRequest("orby_isChainSupportedOnAccountCluster", [
|
126
|
+
{
|
127
|
+
accountClusterId,
|
128
|
+
chainId: (0, utils_js_1.getOrbyChainId)(chainId),
|
129
|
+
},
|
130
|
+
]);
|
131
|
+
if (code && message) {
|
132
|
+
console.error("[isChainSupportedOnAccountCluster]", code, message);
|
133
|
+
return undefined;
|
134
|
+
}
|
135
|
+
return supportStatus;
|
136
|
+
}
|
137
|
+
async getNodeRpcUrl(accountClusterId, chainId) {
|
138
|
+
const { nodeRpcUrl, code, message } = await this.sendRequest("orby_getNodeRpcUrl", [
|
139
|
+
{
|
140
|
+
accountClusterId,
|
141
|
+
chainId: (0, utils_js_1.getOrbyChainId)(chainId),
|
142
|
+
},
|
143
|
+
]);
|
144
|
+
if (code && message) {
|
145
|
+
console.error("[getNodeRpcUrl]", code, message);
|
146
|
+
return undefined;
|
147
|
+
}
|
148
|
+
return nodeRpcUrl;
|
149
|
+
}
|
150
|
+
async getVirtualNodeRpcUrl(accountClusterId, chainId, entrypointAccountAddress) {
|
151
|
+
const { virtualNodeRpcUrl, message, code } = await this.sendRequest("orby_getVirtualNodeRpcUrl", [
|
152
|
+
{
|
153
|
+
accountClusterId,
|
154
|
+
chainId: (0, utils_js_1.getOrbyChainId)(chainId),
|
155
|
+
entrypointAccountAddress,
|
156
|
+
},
|
157
|
+
]);
|
158
|
+
if (code && message) {
|
159
|
+
console.error("[getVirtualNodeRpcUrl]", code, message);
|
160
|
+
return undefined;
|
161
|
+
}
|
162
|
+
return virtualNodeRpcUrl;
|
163
|
+
}
|
164
|
+
async getActivity(accountClusterId, limit, offset, order, startDate, endDate, filters) {
|
165
|
+
const { pageInfo, edges, code, message } = await this.sendRequest("orby_getActivity", [
|
166
|
+
{
|
167
|
+
accountClusterId,
|
168
|
+
limit,
|
169
|
+
offset,
|
170
|
+
order,
|
171
|
+
startDate,
|
172
|
+
endDate,
|
173
|
+
filters,
|
174
|
+
},
|
175
|
+
]);
|
176
|
+
if (code && message) {
|
177
|
+
console.error("[getActivity]", code, message);
|
178
|
+
return undefined;
|
179
|
+
}
|
180
|
+
return { activities: (0, action_helpers_js_1.extractActivities)(edges), pageInfo };
|
181
|
+
}
|
182
|
+
async getPortfolioOverview(accountClusterId) {
|
183
|
+
const fungibleTokenOverview = await this.sendRequest("orby_getPortfolioOverview", [{ accountClusterId }]);
|
184
|
+
return (0, action_helpers_js_1.extractFungibleTokenOverview)(fungibleTokenOverview);
|
185
|
+
}
|
186
|
+
async getFungibleTokenPortfolio(accountClusterId) {
|
187
|
+
const { fungibleTokenBalances, code, message } = await this.sendRequest("orby_getFungibleTokenPortfolio", [{ accountClusterId }]);
|
188
|
+
if (code && message) {
|
189
|
+
console.error("[getFungibleTokenPortfolio]", code, message);
|
190
|
+
return undefined;
|
191
|
+
}
|
192
|
+
return (0, action_helpers_js_1.extractStandardizedBalances)(fungibleTokenBalances);
|
193
|
+
}
|
194
|
+
async getFungibleTokenBalances(accountClusterId, offset, limit, chainId, tokensToOmit) {
|
195
|
+
const { fungibleTokenBalances, code, message } = await this.sendRequest("orby_getFungibleTokenBalances", [
|
196
|
+
{
|
197
|
+
accountClusterId,
|
198
|
+
offset,
|
199
|
+
limit,
|
200
|
+
chainId: chainId ? (0, utils_js_1.getOrbyChainId)(chainId) : undefined,
|
201
|
+
tokensToOmit,
|
202
|
+
},
|
203
|
+
]);
|
204
|
+
if (code && message) {
|
205
|
+
console.error("[getFungibleTokenBalances]", code, message);
|
206
|
+
return undefined;
|
207
|
+
}
|
208
|
+
return (0, action_helpers_js_1.extractStandardizedBalances)(fungibleTokenBalances);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
exports.AccountClusterActions = AccountClusterActions;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { GasSpendForInstance, GasSponsorshipData } from "../types.js";
|
2
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
3
|
+
import { LIBRARY_TYPE } from "../enums.js";
|
4
|
+
export declare class AdminActions extends LibraryRequest {
|
5
|
+
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
6
|
+
createInstance(name: string): Promise<{
|
7
|
+
success: boolean;
|
8
|
+
orbyInstancePrivateUrl: string;
|
9
|
+
orbyInstancePublicUrl: string;
|
10
|
+
}>;
|
11
|
+
getInstanceUrls(name: string): Promise<{
|
12
|
+
orbyInstancePrivateUrl: string;
|
13
|
+
orbyInstancePublicUrl: string;
|
14
|
+
}>;
|
15
|
+
getGasSpentForCustomer(month: string, year: string): Promise<GasSponsorshipData>;
|
16
|
+
getGasSpentForInstances(month: string, year: string, instanceNames: string[]): Promise<GasSpendForInstance[]>;
|
17
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AdminActions = void 0;
|
4
|
+
const action_helpers_js_1 = require("../utils/action_helpers.js");
|
5
|
+
const library_request_js_1 = require("../entities/library_request.js");
|
6
|
+
class AdminActions extends library_request_js_1.LibraryRequest {
|
7
|
+
constructor(library, client, provider) {
|
8
|
+
super(library, client, provider);
|
9
|
+
}
|
10
|
+
async createInstance(name) {
|
11
|
+
const result = await this.sendRequest("orby_createInstance", [{ name }]);
|
12
|
+
if (result.code && result.message) {
|
13
|
+
console.error("[createInstance]", result.code, result.message);
|
14
|
+
return undefined;
|
15
|
+
}
|
16
|
+
return result;
|
17
|
+
}
|
18
|
+
async getInstanceUrls(name) {
|
19
|
+
const result = await this.sendRequest("orby_getInstanceUrls", [{ name }]);
|
20
|
+
if (result.code && result.message) {
|
21
|
+
console.error("[getInstanceUrls]", result.code, result.message);
|
22
|
+
return undefined;
|
23
|
+
}
|
24
|
+
return result;
|
25
|
+
}
|
26
|
+
async getGasSpentForCustomer(month, year) {
|
27
|
+
const { totalGasSpentForCustomer, code, message } = await this.sendRequest("orby_getGasSpentForCustomer", [{ month, year }]);
|
28
|
+
if (code && message) {
|
29
|
+
console.error("[getGasSpentForCustomer]", code, message);
|
30
|
+
return undefined;
|
31
|
+
}
|
32
|
+
return (0, action_helpers_js_1.extractGasSponsorshipData)(totalGasSpentForCustomer);
|
33
|
+
}
|
34
|
+
async getGasSpentForInstances(month, year, instanceNames) {
|
35
|
+
const { totalGasSpendForInstances, code, message } = await this.sendRequest("orby_getGasSpentForInstances", [{ month, year, instanceNames }]);
|
36
|
+
if (code && message) {
|
37
|
+
console.error("[getGasSpentForInstances]", code, message);
|
38
|
+
return undefined;
|
39
|
+
}
|
40
|
+
return (0, action_helpers_js_1.extractGasSpendForInstances)(totalGasSpendForInstances);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
exports.AdminActions = AdminActions;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
2
|
+
import { LIBRARY_TYPE } from "../enums.js";
|
3
|
+
export declare class ApplicationActions extends LibraryRequest {
|
4
|
+
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
5
|
+
isChainAbstractionCompatible(appDomainUrl: string): Promise<boolean>;
|
6
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ApplicationActions = void 0;
|
4
|
+
const library_request_js_1 = require("../entities/library_request.js");
|
5
|
+
class ApplicationActions extends library_request_js_1.LibraryRequest {
|
6
|
+
constructor(library, client, provider) {
|
7
|
+
super(library, client, provider);
|
8
|
+
}
|
9
|
+
async isChainAbstractionCompatible(appDomainUrl) {
|
10
|
+
const { isChainAbstractionCompatible, code, message } = await this.sendRequest("orby_isChainAbstractionCompatible", [
|
11
|
+
{ appDomainUrl },
|
12
|
+
]);
|
13
|
+
if (code && message) {
|
14
|
+
console.error("[isChainAbstractionCompatible]", code, message);
|
15
|
+
return undefined;
|
16
|
+
}
|
17
|
+
return isChainAbstractionCompatible;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
exports.ApplicationActions = ApplicationActions;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { BlockchainInformation } from "../types.js";
|
2
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
3
|
+
import { LIBRARY_TYPE } from "../enums.js";
|
4
|
+
export declare class BlockchainActions extends LibraryRequest {
|
5
|
+
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
6
|
+
getBlockchainInformation(chainId: bigint): Promise<BlockchainInformation>;
|
7
|
+
listBlockchainsInformation(offset?: number, limit?: number): Promise<{
|
8
|
+
blockchains: BlockchainInformation[];
|
9
|
+
pageInfo: {
|
10
|
+
hasNextPage: boolean;
|
11
|
+
hasPreviousPage: boolean;
|
12
|
+
totalCount: number;
|
13
|
+
};
|
14
|
+
}>;
|
15
|
+
getChainsSupportedByDefault(): Promise<BlockchainInformation[]>;
|
16
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BlockchainActions = void 0;
|
4
|
+
const action_helpers_js_1 = require("../utils/action_helpers.js");
|
5
|
+
const library_request_js_1 = require("../entities/library_request.js");
|
6
|
+
const utils_js_1 = require("../utils/utils.js");
|
7
|
+
class BlockchainActions extends library_request_js_1.LibraryRequest {
|
8
|
+
constructor(library, client, provider) {
|
9
|
+
super(library, client, provider);
|
10
|
+
}
|
11
|
+
async getBlockchainInformation(chainId) {
|
12
|
+
const { blockchain, code, message } = await this.sendRequest("orby_getBlockchainInformation", [{ chainId: (0, utils_js_1.getOrbyChainId)(chainId) }]);
|
13
|
+
if (code && message) {
|
14
|
+
console.error("[getBlockchainInformation]", code, message);
|
15
|
+
return undefined;
|
16
|
+
}
|
17
|
+
return (0, action_helpers_js_1.extractBlockchainInformation)(blockchain);
|
18
|
+
}
|
19
|
+
async listBlockchainsInformation(offset, limit) {
|
20
|
+
const { pageInfo, edges, code, message } = await this.sendRequest("orby_listBlockchainsInformation", [{ offset, limit }]);
|
21
|
+
if (code && message) {
|
22
|
+
console.error("[listBlockchainsInformation]", code, message);
|
23
|
+
return undefined;
|
24
|
+
}
|
25
|
+
return {
|
26
|
+
blockchains: (0, action_helpers_js_1.extractBlockchainInformations)(edges),
|
27
|
+
pageInfo,
|
28
|
+
};
|
29
|
+
}
|
30
|
+
async getChainsSupportedByDefault() {
|
31
|
+
const { blockchains, code, message } = await this.sendRequest("orby_getChainsSupportedByDefault", []);
|
32
|
+
if (code && message) {
|
33
|
+
console.error("[getChainsSupportedByDefault]", code, message);
|
34
|
+
return undefined;
|
35
|
+
}
|
36
|
+
return (0, action_helpers_js_1.extractBlockchainInformations)(blockchains);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
exports.BlockchainActions = BlockchainActions;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { ChainEndpoint, GasSponsorshipPolicy } from "../types.js";
|
2
|
+
import { LIBRARY_TYPE } from "../enums.js";
|
3
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
4
|
+
export declare class InstanceActions extends LibraryRequest {
|
5
|
+
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
6
|
+
setCustomChainEndpointsForInstance(chainEndpoints: ChainEndpoint[]): Promise<boolean>;
|
7
|
+
removeCustomChainEndpointForInstance(chainIds: bigint[]): Promise<boolean>;
|
8
|
+
getCustomChainEndpointsForInstance(returnChainIdsOnly: boolean): Promise<boolean>;
|
9
|
+
enableChainAbstractionForInstance(enable: boolean): Promise<boolean>;
|
10
|
+
enableGasSponsorshipForInstance(enable: boolean): Promise<boolean>;
|
11
|
+
getGasSponsorForInstance(): Promise<string>;
|
12
|
+
getOrbyGasSponsorPolicyForInstance(): Promise<GasSponsorshipPolicy>;
|
13
|
+
setOrbyGasSponsorPolicyForInstance(gasSponsorshipPolicy: GasSponsorshipPolicy): Promise<boolean>;
|
14
|
+
removeOrbyGasSponsorPolicyForInstance(): Promise<boolean>;
|
15
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.InstanceActions = void 0;
|
4
|
+
const action_helpers_js_1 = require("../utils/action_helpers.js");
|
5
|
+
const library_request_js_1 = require("../entities/library_request.js");
|
6
|
+
const utils_js_1 = require("../utils/utils.js");
|
7
|
+
class InstanceActions extends library_request_js_1.LibraryRequest {
|
8
|
+
constructor(library, client, provider) {
|
9
|
+
super(library, client, provider);
|
10
|
+
}
|
11
|
+
async setCustomChainEndpointsForInstance(chainEndpoints) {
|
12
|
+
const formattedEndpoints = chainEndpoints.map((endpoint) => {
|
13
|
+
return {
|
14
|
+
chainId: (0, utils_js_1.getOrbyChainId)(endpoint.chainId),
|
15
|
+
customRpcUrls: endpoint.customRpcUrls,
|
16
|
+
customIndexerUrls: endpoint.customIndexerUrls,
|
17
|
+
};
|
18
|
+
});
|
19
|
+
const { success, code, message } = await this.sendRequest("orby_setCustomChainEndpointsForInstance", [{ chainEndpoints: formattedEndpoints }]);
|
20
|
+
if (code && message) {
|
21
|
+
console.error("[setCustomChainEndpointsForInstance]", code, message);
|
22
|
+
return undefined;
|
23
|
+
}
|
24
|
+
return success;
|
25
|
+
}
|
26
|
+
async removeCustomChainEndpointForInstance(chainIds) {
|
27
|
+
const formattedChainIds = chainIds.map((chainId) => (0, utils_js_1.getOrbyChainId)(chainId));
|
28
|
+
const { success, code, message } = await this.sendRequest("orby_removeCustomChainEndpointForInstance", [{ chainIds: formattedChainIds }]);
|
29
|
+
if (code && message) {
|
30
|
+
console.error("[removeCustomChainEndpointForInstance]", code, message);
|
31
|
+
return undefined;
|
32
|
+
}
|
33
|
+
return success;
|
34
|
+
}
|
35
|
+
async getCustomChainEndpointsForInstance(returnChainIdsOnly) {
|
36
|
+
const { chainEndpoints, code, message } = await this.sendRequest("orby_getCustomChainEndpointsForInstance", [{ returnChainIdsOnly }]);
|
37
|
+
if (code && message) {
|
38
|
+
console.error("[getCustomChainEndpointsForInstance]", code, message);
|
39
|
+
return undefined;
|
40
|
+
}
|
41
|
+
return chainEndpoints.map((endpoint) => {
|
42
|
+
return {
|
43
|
+
chainId: (0, utils_js_1.getChainIdFromOrbyChainId)(endpoint.chainId),
|
44
|
+
customRpcUrls: endpoint.customRpcUrls,
|
45
|
+
customIndexerUrls: endpoint.customIndexerUrls,
|
46
|
+
};
|
47
|
+
});
|
48
|
+
}
|
49
|
+
async enableChainAbstractionForInstance(enable) {
|
50
|
+
const { success, code, message } = await this.sendRequest("orby_enableChainAbstractionForInstance", [{ enable }]);
|
51
|
+
if (code && message) {
|
52
|
+
console.error("[enableChainAbstractionForInstance]", code, message);
|
53
|
+
return undefined;
|
54
|
+
}
|
55
|
+
return success;
|
56
|
+
}
|
57
|
+
async enableGasSponsorshipForInstance(enable) {
|
58
|
+
const { success, code, message } = await this.sendRequest("orby_enableGasSponsorshipForInstance", [{ enable }]);
|
59
|
+
if (code && message) {
|
60
|
+
console.error("[enableGasSponsorshipForInstance]", code, message);
|
61
|
+
return undefined;
|
62
|
+
}
|
63
|
+
return success;
|
64
|
+
}
|
65
|
+
async getGasSponsorForInstance() {
|
66
|
+
const { gasSponsor, code, message } = await this.sendRequest("orby_getGasSponsorForInstance", []);
|
67
|
+
if (code && message) {
|
68
|
+
console.error("[getGasSponsorForInstance]", code, message);
|
69
|
+
return undefined;
|
70
|
+
}
|
71
|
+
return gasSponsor;
|
72
|
+
}
|
73
|
+
async getOrbyGasSponsorPolicyForInstance() {
|
74
|
+
const { gasSponsorshipPolicy, message, code } = await this.sendRequest("orby_getOrbyGasSponsorPolicyForInstance", []);
|
75
|
+
if (code && message) {
|
76
|
+
console.error("[getOrbyGasSponsorPolicyForInstance]", code, message);
|
77
|
+
return undefined;
|
78
|
+
}
|
79
|
+
return (0, action_helpers_js_1.extractGasSponsorshipPolicy)(gasSponsorshipPolicy);
|
80
|
+
}
|
81
|
+
async setOrbyGasSponsorPolicyForInstance(gasSponsorshipPolicy) {
|
82
|
+
const { success, code, message } = await this.sendRequest("orby_setOrbyGasSponsorPolicyForInstance", [{ ...gasSponsorshipPolicy }]);
|
83
|
+
if (code && message) {
|
84
|
+
console.error("[setOrbyGasSponsorPolicyForInstance]", code, message);
|
85
|
+
return undefined;
|
86
|
+
}
|
87
|
+
return success;
|
88
|
+
}
|
89
|
+
async removeOrbyGasSponsorPolicyForInstance() {
|
90
|
+
const { success, code, message } = await this.sendRequest("orby_removeOrbyGasSponsorPolicyForInstance", []);
|
91
|
+
if (code && message) {
|
92
|
+
console.error("[removeOrbyGasSponsorPolicyForInstance]", code, message);
|
93
|
+
return undefined;
|
94
|
+
}
|
95
|
+
return success;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
exports.InstanceActions = InstanceActions;
|
@@ -0,0 +1,99 @@
|
|
1
|
+
import { OnchainOperation, OperationSet, OperationStatus, SignedOperation } from "../types.js";
|
2
|
+
import { CurrencyAmount } from "../entities/financial/currency_amount.js";
|
3
|
+
import { LIBRARY_TYPE, OperationStatusType, QuoteType } from "../enums.js";
|
4
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
5
|
+
export declare class OperationActions extends LibraryRequest {
|
6
|
+
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
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>;
|
14
|
+
getOperationsToSignTypedData(accountClusterId: string, data: string, gasToken?: {
|
15
|
+
standardizedTokenId: string;
|
16
|
+
tokenSources?: {
|
17
|
+
chainId: bigint;
|
18
|
+
address?: string;
|
19
|
+
}[];
|
20
|
+
}): Promise<OperationSet>;
|
21
|
+
getOperationsToCancelTransaction(accountClusterId: string, operationSetId: string): Promise<OperationSet>;
|
22
|
+
isTransactionPreconditionSatisfied(accountClusterId: string, to: string, data: string, value?: bigint): Promise<boolean>;
|
23
|
+
isTypedDataPreconditionSatisfied(accountClusterId: string, data: string): Promise<boolean>;
|
24
|
+
sendSignedOperations(accountClusterId: string, signedOperations: SignedOperation[]): Promise<{
|
25
|
+
operationSetId: string;
|
26
|
+
operationResponses: OperationStatus[];
|
27
|
+
}>;
|
28
|
+
getOperationStatuses(operationIds: string[]): Promise<OperationStatus[]>;
|
29
|
+
estimateFiatCostToExecuteTransaction(to: string, data: string, value?: bigint): Promise<CurrencyAmount>;
|
30
|
+
estimateFiatCostToSignTypedData(data: string): Promise<CurrencyAmount>;
|
31
|
+
getOperationsToTransferToken(accountClusterId: string, standardizedTokenId: string, amount: bigint, recipient: {
|
32
|
+
chainId: bigint;
|
33
|
+
recipientAddress: string;
|
34
|
+
}, gasToken?: {
|
35
|
+
standardizedTokenId: string;
|
36
|
+
tokenSources?: {
|
37
|
+
chainId: bigint;
|
38
|
+
address?: string;
|
39
|
+
}[];
|
40
|
+
}): Promise<OperationSet>;
|
41
|
+
getOperationsToSwap(accountClusterId: string, swapType: QuoteType, input: {
|
42
|
+
standardizedTokenId: string;
|
43
|
+
amount?: bigint;
|
44
|
+
tokenSources?: {
|
45
|
+
chainId: bigint;
|
46
|
+
address?: string;
|
47
|
+
}[];
|
48
|
+
}, output: {
|
49
|
+
standardizedTokenId: string;
|
50
|
+
amount?: bigint;
|
51
|
+
tokenDestination?: {
|
52
|
+
chainId: bigint;
|
53
|
+
address?: string;
|
54
|
+
};
|
55
|
+
}, gasToken?: {
|
56
|
+
standardizedTokenId: string;
|
57
|
+
tokenSources?: {
|
58
|
+
chainId: bigint;
|
59
|
+
address?: string;
|
60
|
+
}[];
|
61
|
+
}): Promise<OperationSet>;
|
62
|
+
getQuote(accountClusterId: string, swapType: QuoteType, input: {
|
63
|
+
standardizedTokenId: string;
|
64
|
+
amount?: bigint;
|
65
|
+
tokenSources?: {
|
66
|
+
chainId: bigint;
|
67
|
+
address?: string;
|
68
|
+
}[];
|
69
|
+
}, output: {
|
70
|
+
standardizedTokenId: string;
|
71
|
+
amount?: bigint;
|
72
|
+
tokenDestination?: {
|
73
|
+
chainId: bigint;
|
74
|
+
address?: string;
|
75
|
+
};
|
76
|
+
}): Promise<OperationSet>;
|
77
|
+
getOperationsToBridge(accountClusterId: string, standardizedTokenId: string, amount: bigint, tokenSources?: {
|
78
|
+
chainId: bigint;
|
79
|
+
address?: string;
|
80
|
+
}[], tokenDestination?: {
|
81
|
+
chainId: bigint;
|
82
|
+
address?: string;
|
83
|
+
}, gasToken?: {
|
84
|
+
standardizedTokenId: string;
|
85
|
+
tokenSources?: {
|
86
|
+
chainId: bigint;
|
87
|
+
address?: string;
|
88
|
+
}[];
|
89
|
+
}): Promise<OperationSet>;
|
90
|
+
subscribeToOperationStatuses(ids?: string[], onOperationStatusesUpdateCallback?: (statusSummary: OperationStatusType, primaryOperationStatus?: OperationStatus, allOperationStatuses?: OperationStatus[]) => void, timout?: number): {
|
91
|
+
intervalId: NodeJS.Timeout | null;
|
92
|
+
};
|
93
|
+
sendOperationSet(accountClusterId: string, operationSet: OperationSet, signOperation: (operation: OnchainOperation) => Promise<SignedOperation | undefined>): Promise<{
|
94
|
+
success: boolean;
|
95
|
+
operationSetId?: string;
|
96
|
+
primaryOperationStatus?: OperationStatus;
|
97
|
+
operationResponses?: OperationStatus[];
|
98
|
+
}>;
|
99
|
+
}
|