@orb-labs/orby-core 0.0.14 → 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.
Files changed (137) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/cjs/actions/account_cluster.d.ts +32 -0
  3. package/dist/cjs/actions/account_cluster.js +211 -0
  4. package/dist/cjs/actions/admin.d.ts +17 -0
  5. package/dist/cjs/actions/admin.js +43 -0
  6. package/dist/cjs/actions/application.d.ts +6 -0
  7. package/dist/cjs/actions/application.js +20 -0
  8. package/dist/cjs/actions/blockchain.d.ts +16 -0
  9. package/dist/cjs/actions/blockchain.js +39 -0
  10. package/dist/cjs/actions/instance.d.ts +15 -0
  11. package/dist/cjs/actions/instance.js +98 -0
  12. package/dist/cjs/actions/operation.d.ts +99 -0
  13. package/dist/cjs/actions/operation.js +345 -0
  14. package/dist/cjs/actions/token.d.ts +15 -0
  15. package/dist/cjs/actions/token.js +50 -0
  16. package/dist/cjs/constants.d.ts +14 -0
  17. package/dist/cjs/constants.js +139 -0
  18. package/dist/cjs/entities/account.d.ts +14 -0
  19. package/dist/cjs/entities/account.js +49 -0
  20. package/dist/cjs/entities/financial/account_balance.d.ts +12 -0
  21. package/dist/cjs/entities/financial/account_balance.js +35 -0
  22. package/dist/cjs/entities/financial/asset.d.ts +31 -0
  23. package/dist/cjs/entities/financial/asset.js +42 -0
  24. package/dist/cjs/entities/financial/currency.d.ts +41 -0
  25. package/dist/cjs/entities/financial/currency.js +56 -0
  26. package/dist/cjs/entities/financial/currency_amount.d.ts +34 -0
  27. package/dist/cjs/entities/financial/currency_amount.js +99 -0
  28. package/dist/cjs/entities/financial/fungible_token.d.ts +41 -0
  29. package/dist/cjs/entities/financial/fungible_token.js +68 -0
  30. package/dist/cjs/entities/financial/fungible_token_amount.d.ts +36 -0
  31. package/dist/cjs/entities/financial/fungible_token_amount.js +102 -0
  32. package/dist/cjs/entities/financial/non_fungible_token.d.ts +39 -0
  33. package/dist/cjs/entities/financial/non_fungible_token.js +65 -0
  34. package/dist/cjs/entities/financial/semi_fungible_token.d.ts +41 -0
  35. package/dist/cjs/entities/financial/semi_fungible_token.js +67 -0
  36. package/dist/cjs/entities/library_request.d.ts +8 -0
  37. package/dist/cjs/entities/library_request.js +37 -0
  38. package/dist/cjs/entities/state.d.ts +22 -0
  39. package/dist/cjs/entities/state.js +106 -0
  40. package/dist/cjs/enums.d.ts +116 -0
  41. package/dist/cjs/enums.js +138 -0
  42. package/dist/cjs/index.d.ts +29 -0
  43. package/dist/cjs/index.js +49 -0
  44. package/dist/cjs/interfaces/account_cluster.d.ts +30 -0
  45. package/dist/cjs/interfaces/account_cluster.js +2 -0
  46. package/dist/cjs/interfaces/admin.d.ts +14 -0
  47. package/dist/cjs/interfaces/admin.js +2 -0
  48. package/dist/cjs/interfaces/application.d.ts +3 -0
  49. package/dist/cjs/interfaces/application.js +2 -0
  50. package/dist/cjs/interfaces/blockchain.d.ts +13 -0
  51. package/dist/cjs/interfaces/blockchain.js +2 -0
  52. package/dist/cjs/interfaces/instance.d.ts +12 -0
  53. package/dist/cjs/interfaces/instance.js +2 -0
  54. package/dist/cjs/interfaces/operation.d.ts +97 -0
  55. package/dist/cjs/interfaces/operation.js +2 -0
  56. package/dist/cjs/interfaces/orby.d.ts +9 -0
  57. package/dist/cjs/interfaces/orby.js +2 -0
  58. package/dist/cjs/interfaces/token.d.ts +12 -0
  59. package/dist/cjs/interfaces/token.js +2 -0
  60. package/dist/cjs/types.d.ts +152 -0
  61. package/dist/cjs/types.js +2 -0
  62. package/dist/cjs/utils/action_helpers.d.ts +22 -0
  63. package/dist/cjs/utils/action_helpers.js +274 -0
  64. package/dist/cjs/utils/utils.d.ts +10 -0
  65. package/dist/cjs/utils/utils.js +79 -0
  66. package/dist/cjs/utils/validateAndParseAddress.d.ts +10 -0
  67. package/dist/cjs/utils/validateAndParseAddress.js +29 -0
  68. package/dist/esm/actions/account_cluster.d.ts +32 -0
  69. package/dist/esm/actions/account_cluster.js +207 -0
  70. package/dist/esm/actions/admin.d.ts +17 -0
  71. package/dist/esm/actions/admin.js +39 -0
  72. package/dist/esm/actions/application.d.ts +6 -0
  73. package/dist/esm/actions/application.js +16 -0
  74. package/dist/esm/actions/blockchain.d.ts +16 -0
  75. package/dist/esm/actions/blockchain.js +35 -0
  76. package/dist/esm/actions/instance.d.ts +15 -0
  77. package/dist/esm/actions/instance.js +94 -0
  78. package/dist/esm/actions/operation.d.ts +99 -0
  79. package/dist/esm/actions/operation.js +341 -0
  80. package/dist/esm/actions/token.d.ts +15 -0
  81. package/dist/esm/actions/token.js +46 -0
  82. package/dist/esm/constants.d.ts +14 -0
  83. package/dist/esm/constants.js +133 -0
  84. package/dist/esm/entities/account.d.ts +14 -0
  85. package/dist/esm/entities/account.js +45 -0
  86. package/dist/esm/entities/financial/account_balance.d.ts +12 -0
  87. package/dist/esm/entities/financial/account_balance.js +31 -0
  88. package/dist/esm/entities/financial/asset.d.ts +31 -0
  89. package/dist/esm/entities/financial/asset.js +38 -0
  90. package/dist/esm/entities/financial/currency.d.ts +41 -0
  91. package/dist/esm/entities/financial/currency.js +49 -0
  92. package/dist/esm/entities/financial/currency_amount.d.ts +34 -0
  93. package/dist/esm/entities/financial/currency_amount.js +92 -0
  94. package/dist/esm/entities/financial/fungible_token.d.ts +41 -0
  95. package/dist/esm/entities/financial/fungible_token.js +64 -0
  96. package/dist/esm/entities/financial/fungible_token_amount.d.ts +36 -0
  97. package/dist/esm/entities/financial/fungible_token_amount.js +95 -0
  98. package/dist/esm/entities/financial/non_fungible_token.d.ts +39 -0
  99. package/dist/esm/entities/financial/non_fungible_token.js +61 -0
  100. package/dist/esm/entities/financial/semi_fungible_token.d.ts +41 -0
  101. package/dist/esm/entities/financial/semi_fungible_token.js +63 -0
  102. package/dist/esm/entities/library_request.d.ts +8 -0
  103. package/dist/esm/entities/library_request.js +30 -0
  104. package/dist/esm/entities/state.d.ts +22 -0
  105. package/dist/esm/entities/state.js +102 -0
  106. package/dist/esm/enums.d.ts +116 -0
  107. package/dist/esm/enums.js +135 -0
  108. package/dist/esm/index.d.ts +29 -0
  109. package/dist/esm/index.js +33 -0
  110. package/dist/esm/interfaces/account_cluster.d.ts +30 -0
  111. package/dist/esm/interfaces/account_cluster.js +1 -0
  112. package/dist/esm/interfaces/admin.d.ts +14 -0
  113. package/dist/esm/interfaces/admin.js +1 -0
  114. package/dist/esm/interfaces/application.d.ts +3 -0
  115. package/dist/esm/interfaces/application.js +1 -0
  116. package/dist/esm/interfaces/blockchain.d.ts +13 -0
  117. package/dist/esm/interfaces/blockchain.js +1 -0
  118. package/dist/esm/interfaces/instance.d.ts +12 -0
  119. package/dist/esm/interfaces/instance.js +1 -0
  120. package/dist/esm/interfaces/operation.d.ts +97 -0
  121. package/dist/esm/interfaces/operation.js +1 -0
  122. package/dist/esm/interfaces/orby.d.ts +9 -0
  123. package/dist/esm/interfaces/orby.js +1 -0
  124. package/dist/esm/interfaces/token.d.ts +12 -0
  125. package/dist/esm/interfaces/token.js +1 -0
  126. package/dist/esm/types.d.ts +152 -0
  127. package/dist/esm/types.js +1 -0
  128. package/dist/esm/utils/action_helpers.d.ts +22 -0
  129. package/dist/esm/utils/action_helpers.js +250 -0
  130. package/dist/esm/utils/utils.d.ts +10 -0
  131. package/dist/esm/utils/utils.js +70 -0
  132. package/dist/esm/utils/validateAndParseAddress.d.ts +10 -0
  133. package/dist/esm/utils/validateAndParseAddress.js +25 -0
  134. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  135. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  136. package/dist/tsconfig.tsbuildinfo +1 -1
  137. package/package.json +16 -7
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ### Unreleased
4
4
 
5
+ ### 0.0.15
6
+
7
+ - feat: support dual module format builds
8
+
5
9
  ### 0.0.14
6
10
 
7
11
  - passing optional request timeout to subscribeToOperationStatuses
@@ -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
+ }