@orb-labs/orby-core 0.0.7 → 0.0.8
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 +8 -1
- package/dist/actions/account_cluster.js +66 -28
- package/dist/actions/blockchain.d.ts +16 -0
- package/dist/actions/blockchain.js +35 -0
- package/dist/actions/instance.d.ts +1 -2
- package/dist/actions/instance.js +7 -15
- package/dist/actions/operation.d.ts +17 -8
- package/dist/actions/operation.js +248 -13
- package/dist/actions/token.js +13 -4
- package/dist/entities/financial/fungible_token.d.ts +1 -1
- package/dist/entities/financial/fungible_token.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/interfaces/account_cluster.d.ts +8 -1
- package/dist/interfaces/blockchain.d.ts +13 -0
- package/dist/interfaces/blockchain.js +1 -0
- package/dist/interfaces/instance.d.ts +1 -2
- package/dist/interfaces/operation.d.ts +24 -9
- package/dist/interfaces/orby.d.ts +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/utils/action_helpers.js +1 -5
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.js +6 -0
- package/package.json +1 -1
- package/dist/utils/jsbi.d.ts +0 -2
- package/dist/utils/jsbi.js +0 -2
@@ -1,28 +1,69 @@
|
|
1
1
|
import { extractOperationSet, extractOperationStatuses, } from "../utils/action_helpers.js";
|
2
2
|
import { CurrencyAmount } from "../entities/financial/currency_amount.js";
|
3
|
+
import { OperationStatusType, OperationType, } from "../enums.js";
|
3
4
|
import { LibraryRequest } from "../entities/library_request.js";
|
5
|
+
import { getOrbyChainId } from "../utils/utils.js";
|
4
6
|
export class OperationActions extends LibraryRequest {
|
5
7
|
constructor(library, client, provider) {
|
6
8
|
super(library, client, provider);
|
7
9
|
}
|
8
10
|
async getOperationsToExecuteTransaction(accountClusterId, to, data, value, gasToken) {
|
9
|
-
const
|
11
|
+
const formattedGasToken = gasToken
|
12
|
+
? {
|
13
|
+
...gasToken,
|
14
|
+
tokenSources: gasToken.tokenSources?.map(({ chainId, address }) => ({
|
15
|
+
chainId: getOrbyChainId(chainId),
|
16
|
+
address,
|
17
|
+
})),
|
18
|
+
}
|
19
|
+
: undefined;
|
20
|
+
const operationSet = await this.sendRequest("orby_getOperationsToExecuteTransaction", [
|
21
|
+
{
|
22
|
+
accountClusterId,
|
23
|
+
to,
|
24
|
+
data,
|
25
|
+
value,
|
26
|
+
gasToken: formattedGasToken,
|
27
|
+
},
|
28
|
+
]);
|
10
29
|
return extractOperationSet(operationSet);
|
11
30
|
}
|
12
31
|
async getOperationsToSignTypedData(accountClusterId, data) {
|
13
|
-
const operationSet = await this.sendRequest("orby_getOperationsToSignTypedData", [
|
32
|
+
const operationSet = await this.sendRequest("orby_getOperationsToSignTypedData", [
|
33
|
+
{
|
34
|
+
accountClusterId,
|
35
|
+
data,
|
36
|
+
},
|
37
|
+
]);
|
14
38
|
return extractOperationSet(operationSet);
|
15
39
|
}
|
16
40
|
async getOperationsToCancelTransaction(accountClusterId, operationSetId) {
|
17
|
-
const operationSet = await this.sendRequest("orby_getOperationsToCancelTransaction", [
|
41
|
+
const operationSet = await this.sendRequest("orby_getOperationsToCancelTransaction", [
|
42
|
+
{
|
43
|
+
accountClusterId,
|
44
|
+
operationSetId,
|
45
|
+
},
|
46
|
+
]);
|
18
47
|
return extractOperationSet(operationSet);
|
19
48
|
}
|
20
49
|
async isTransactionPreconditionSatisfied(accountClusterId, to, data, value) {
|
21
|
-
const { satisfied } = await this.sendRequest("orby_isTransactionPreconditionSatisfied", [
|
50
|
+
const { satisfied } = await this.sendRequest("orby_isTransactionPreconditionSatisfied", [
|
51
|
+
{
|
52
|
+
accountClusterId,
|
53
|
+
to,
|
54
|
+
data,
|
55
|
+
value,
|
56
|
+
},
|
57
|
+
]);
|
22
58
|
return satisfied;
|
23
59
|
}
|
24
60
|
async isTypedDataPreconditionSatisfied(accountClusterId, data) {
|
25
|
-
const { satisfied, code, message } = await this.sendRequest("orby_isTypedDataPreconditionSatisfied", [
|
61
|
+
const { satisfied, code, message } = await this.sendRequest("orby_isTypedDataPreconditionSatisfied", [
|
62
|
+
{
|
63
|
+
accountClusterId,
|
64
|
+
data,
|
65
|
+
},
|
66
|
+
]);
|
26
67
|
if (code && message) {
|
27
68
|
console.error("[isTypedDataPreconditionSatisfied]", code, message);
|
28
69
|
return undefined;
|
@@ -31,7 +72,10 @@ export class OperationActions extends LibraryRequest {
|
|
31
72
|
}
|
32
73
|
async sendSignedOperations(accountClusterId, signedOperations) {
|
33
74
|
const { operationSetId, operationResponses, code, message } = await this.sendRequest("orby_sendSignedOperations", [
|
34
|
-
{
|
75
|
+
{
|
76
|
+
accountClusterId,
|
77
|
+
signedOperations,
|
78
|
+
},
|
35
79
|
]);
|
36
80
|
if (code && message) {
|
37
81
|
console.error("[sendSignedOperations]", code, message);
|
@@ -47,7 +91,13 @@ export class OperationActions extends LibraryRequest {
|
|
47
91
|
return extractOperationStatuses(operationStatuses);
|
48
92
|
}
|
49
93
|
async estimateFiatCostToExecuteTransaction(to, data, value) {
|
50
|
-
const { estimatedCost, code, message } = await this.sendRequest("orby_estimateFiatCostToExecuteTransaction", [
|
94
|
+
const { estimatedCost, code, message } = await this.sendRequest("orby_estimateFiatCostToExecuteTransaction", [
|
95
|
+
{
|
96
|
+
to,
|
97
|
+
data,
|
98
|
+
value,
|
99
|
+
},
|
100
|
+
]);
|
51
101
|
if (code && message) {
|
52
102
|
console.error("[estimateFiatCostToExecuteTransaction]", code, message);
|
53
103
|
return undefined;
|
@@ -63,32 +113,217 @@ export class OperationActions extends LibraryRequest {
|
|
63
113
|
return CurrencyAmount.toCurrencyAmount(estimatedCost);
|
64
114
|
}
|
65
115
|
async getOperationsToTransferToken(accountClusterId, standardizedTokenId, amount, recipient, gasToken) {
|
66
|
-
const
|
116
|
+
const formattedGasToken = gasToken
|
117
|
+
? {
|
118
|
+
...gasToken,
|
119
|
+
tokenSources: gasToken.tokenSources?.map(({ chainId, address }) => ({
|
120
|
+
chainId: getOrbyChainId(chainId),
|
121
|
+
address,
|
122
|
+
})),
|
123
|
+
}
|
124
|
+
: undefined;
|
125
|
+
const formattedRecepient = {
|
126
|
+
chainId: getOrbyChainId(recipient.chainId),
|
127
|
+
recipientAddress: recipient.recipientAddress,
|
128
|
+
};
|
129
|
+
const operationSet = await this.sendRequest("orby_getOperationsToTransferToken", [
|
130
|
+
{
|
131
|
+
accountClusterId,
|
132
|
+
standardizedTokenId,
|
133
|
+
amount,
|
134
|
+
recipient: formattedRecepient,
|
135
|
+
gasToken: formattedGasToken,
|
136
|
+
},
|
137
|
+
]);
|
67
138
|
return extractOperationSet(operationSet);
|
68
139
|
}
|
69
140
|
async getOperationsToSwap(accountClusterId, swapType, input, output, gasToken) {
|
141
|
+
const formattedInput = input
|
142
|
+
? {
|
143
|
+
...input,
|
144
|
+
tokenSources: input?.tokenSources.map(({ chainId, address }) => ({
|
145
|
+
chainId: getOrbyChainId(chainId),
|
146
|
+
address,
|
147
|
+
})),
|
148
|
+
}
|
149
|
+
: undefined;
|
150
|
+
const formattedOutput = output
|
151
|
+
? {
|
152
|
+
...output,
|
153
|
+
tokenDestination: output?.tokenDestination
|
154
|
+
? {
|
155
|
+
chainId: getOrbyChainId(output.tokenDestination.chainId),
|
156
|
+
address: output.tokenDestination.address,
|
157
|
+
}
|
158
|
+
: undefined,
|
159
|
+
}
|
160
|
+
: undefined;
|
161
|
+
const formattedGasToken = gasToken
|
162
|
+
? {
|
163
|
+
...gasToken,
|
164
|
+
tokenSources: gasToken.tokenSources?.map(({ chainId, address }) => ({
|
165
|
+
chainId: getOrbyChainId(chainId),
|
166
|
+
address,
|
167
|
+
})),
|
168
|
+
}
|
169
|
+
: undefined;
|
70
170
|
const operationSet = await this.sendRequest("orby_getOperationsToSwap", [
|
71
|
-
{
|
171
|
+
{
|
172
|
+
accountClusterId,
|
173
|
+
swapType,
|
174
|
+
input: formattedInput,
|
175
|
+
output: formattedOutput,
|
176
|
+
gasToken: formattedGasToken,
|
177
|
+
},
|
72
178
|
]);
|
73
179
|
return extractOperationSet(operationSet);
|
74
180
|
}
|
75
181
|
async getQuote(accountClusterId, swapType, input, output) {
|
182
|
+
const formattedInput = input
|
183
|
+
? {
|
184
|
+
...input,
|
185
|
+
tokenSources: input?.tokenSources.map(({ chainId, address }) => ({
|
186
|
+
chainId: getOrbyChainId(chainId),
|
187
|
+
address,
|
188
|
+
})),
|
189
|
+
}
|
190
|
+
: undefined;
|
191
|
+
const formattedOutput = output
|
192
|
+
? {
|
193
|
+
...output,
|
194
|
+
tokenDestination: output?.tokenDestination
|
195
|
+
? {
|
196
|
+
chainId: getOrbyChainId(output.tokenDestination.chainId),
|
197
|
+
address: output.tokenDestination.address,
|
198
|
+
}
|
199
|
+
: undefined,
|
200
|
+
}
|
201
|
+
: undefined;
|
76
202
|
const operationSet = await this.sendRequest("orby_getQuote", [
|
77
|
-
{
|
203
|
+
{
|
204
|
+
accountClusterId,
|
205
|
+
swapType,
|
206
|
+
input: formattedInput,
|
207
|
+
output: formattedOutput,
|
208
|
+
},
|
78
209
|
]);
|
79
210
|
return extractOperationSet(operationSet);
|
80
211
|
}
|
81
212
|
async getOperationsToBridge(accountClusterId, standardizedTokenId, amount, tokenSources, tokenDestination, gasToken) {
|
213
|
+
const formattedTokenSources = tokenSources.map(({ chainId, address }) => ({
|
214
|
+
chainId: getOrbyChainId(chainId),
|
215
|
+
address,
|
216
|
+
}));
|
217
|
+
const formattedDestination = tokenDestination
|
218
|
+
? {
|
219
|
+
chainId: getOrbyChainId(tokenDestination.chainId),
|
220
|
+
address: tokenDestination.address,
|
221
|
+
}
|
222
|
+
: undefined;
|
223
|
+
const formattedGasToken = gasToken
|
224
|
+
? {
|
225
|
+
...gasToken,
|
226
|
+
tokenSources: gasToken.tokenSources?.map(({ chainId, address }) => ({
|
227
|
+
chainId: getOrbyChainId(chainId),
|
228
|
+
address,
|
229
|
+
})),
|
230
|
+
}
|
231
|
+
: undefined;
|
82
232
|
const operationSet = await this.sendRequest("orby_getOperationsToBridge", [
|
83
233
|
{
|
84
234
|
accountClusterId,
|
85
235
|
standardizedTokenId,
|
86
236
|
amount,
|
87
|
-
tokenSources,
|
88
|
-
tokenDestination,
|
89
|
-
gasToken,
|
237
|
+
tokenSources: formattedTokenSources,
|
238
|
+
tokenDestination: formattedDestination,
|
239
|
+
gasToken: formattedGasToken,
|
90
240
|
},
|
91
241
|
]);
|
92
242
|
return extractOperationSet(operationSet);
|
93
243
|
}
|
244
|
+
subscribeToOperationStatuses(ids, onOperationStatusesUpdateCallback) {
|
245
|
+
let intervalId = null;
|
246
|
+
let totalWaitTime = 0;
|
247
|
+
if (ids && ids?.length > 0) {
|
248
|
+
const waitTime = 500;
|
249
|
+
intervalId = setInterval(async () => {
|
250
|
+
let statusSummary = OperationStatusType.WAITING_PRECONDITION;
|
251
|
+
try {
|
252
|
+
const statuses = ids && ids?.length > 0
|
253
|
+
? await this?.getOperationStatuses(ids)
|
254
|
+
: undefined;
|
255
|
+
if (!ids || ids?.length == 0) {
|
256
|
+
statusSummary = OperationStatusType.NOT_FOUND;
|
257
|
+
}
|
258
|
+
else if (!statuses) {
|
259
|
+
statusSummary = OperationStatusType.NOT_FOUND;
|
260
|
+
}
|
261
|
+
else if (statuses.some((status) => status.status == OperationStatusType.FAILED)) {
|
262
|
+
statusSummary = OperationStatusType.FAILED;
|
263
|
+
}
|
264
|
+
else if (statuses.every((status) => status.status == OperationStatusType.SUCCESSFUL)) {
|
265
|
+
statusSummary = OperationStatusType.SUCCESSFUL;
|
266
|
+
}
|
267
|
+
const primaryOperation = statuses?.find((status) => status.type == OperationType.FINAL_TRANSACTION);
|
268
|
+
if (primaryOperation?.status == OperationStatusType.PENDING) {
|
269
|
+
statusSummary = OperationStatusType.PENDING;
|
270
|
+
}
|
271
|
+
onOperationStatusesUpdateCallback?.(statusSummary, primaryOperation, statuses);
|
272
|
+
}
|
273
|
+
catch (error) {
|
274
|
+
console.error("[useWaitForStatusCompletion]", error);
|
275
|
+
}
|
276
|
+
finally {
|
277
|
+
totalWaitTime += waitTime;
|
278
|
+
if (intervalId &&
|
279
|
+
OperationStatusType.WAITING_PRECONDITION != statusSummary) {
|
280
|
+
clearInterval(intervalId);
|
281
|
+
intervalId = null;
|
282
|
+
}
|
283
|
+
else if (intervalId && totalWaitTime >= 60_000) {
|
284
|
+
// we cant wait for more than 2 ETH blocks
|
285
|
+
clearInterval(intervalId);
|
286
|
+
intervalId = null;
|
287
|
+
}
|
288
|
+
}
|
289
|
+
}, waitTime);
|
290
|
+
}
|
291
|
+
return { intervalId };
|
292
|
+
}
|
293
|
+
async sendOperationSet(accountClusterId, operationSet, signOperation) {
|
294
|
+
const signedOperations = [];
|
295
|
+
const operations = operationSet.intents
|
296
|
+
?.map((intent) => intent.intentOperations)
|
297
|
+
.flat()
|
298
|
+
?.concat(operationSet.primaryOperation)
|
299
|
+
.filter((value) => value != undefined && value != null);
|
300
|
+
if (operations?.length == 0) {
|
301
|
+
return { success: true, operationResponses: [] };
|
302
|
+
}
|
303
|
+
else if (!operations) {
|
304
|
+
return { success: false };
|
305
|
+
}
|
306
|
+
const hasPrimaryOperation = operations.find((operation) => operation.type == OperationType.FINAL_TRANSACTION);
|
307
|
+
if (!hasPrimaryOperation) {
|
308
|
+
return { success: false };
|
309
|
+
}
|
310
|
+
// Loop through all the operations and sign them
|
311
|
+
for (let i = 0; i < operations.length; i++) {
|
312
|
+
const signature = await signOperation(operations[i]);
|
313
|
+
if (!signature) {
|
314
|
+
return { success: false };
|
315
|
+
}
|
316
|
+
signedOperations.push(signature);
|
317
|
+
}
|
318
|
+
const { operationSetId, operationResponses } = await this.sendSignedOperations(accountClusterId, signedOperations);
|
319
|
+
return {
|
320
|
+
operationSetId,
|
321
|
+
operationResponses,
|
322
|
+
success: true,
|
323
|
+
primaryOperationStatus: {
|
324
|
+
type: OperationType.FINAL_TRANSACTION,
|
325
|
+
status: OperationStatusType.WAITING_PRECONDITION,
|
326
|
+
},
|
327
|
+
};
|
328
|
+
}
|
94
329
|
}
|
package/dist/actions/token.js
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
import { extractStandardizedToken, extractStandardizedTokens, } from "../utils/action_helpers.js";
|
2
2
|
import { LibraryRequest } from "../entities/library_request.js";
|
3
|
+
import { getOrbyChainId } from "../utils/utils.js";
|
3
4
|
export class TokenActions extends LibraryRequest {
|
4
5
|
constructor(library, client, provider) {
|
5
6
|
super(library, client, provider);
|
6
7
|
}
|
7
8
|
async getStandardizedTokenIds(tokens) {
|
8
9
|
const formattedTokensInfo = tokens.map(({ tokenAddress, chainId }) => {
|
9
|
-
return { chainId:
|
10
|
+
return { chainId: getOrbyChainId(chainId), tokenAddress };
|
10
11
|
});
|
11
|
-
const { standardizedTokenIds, message, code } = await this.sendRequest("orby_getStandardizedTokenIds", [
|
12
|
+
const { standardizedTokenIds, message, code } = await this.sendRequest("orby_getStandardizedTokenIds", [
|
13
|
+
{
|
14
|
+
tokens: formattedTokensInfo,
|
15
|
+
},
|
16
|
+
]);
|
12
17
|
if (code && message) {
|
13
18
|
console.error("[getStandardizedTokenIds]", code, message);
|
14
19
|
return undefined;
|
@@ -17,9 +22,13 @@ export class TokenActions extends LibraryRequest {
|
|
17
22
|
}
|
18
23
|
async getStandardizedTokens(tokens) {
|
19
24
|
const formattedTokensInfo = tokens.map(({ tokenAddress, chainId }) => {
|
20
|
-
return { chainId:
|
25
|
+
return { chainId: getOrbyChainId(chainId), tokenAddress };
|
21
26
|
});
|
22
|
-
const { standardizedTokens, message, code } = await this.sendRequest("orby_getStandardizedTokens", [
|
27
|
+
const { standardizedTokens, message, code } = await this.sendRequest("orby_getStandardizedTokens", [
|
28
|
+
{
|
29
|
+
tokens: formattedTokensInfo,
|
30
|
+
},
|
31
|
+
]);
|
23
32
|
if (code && message) {
|
24
33
|
console.error("[getStandardizedTokens]", code, message);
|
25
34
|
return undefined;
|
@@ -26,7 +26,7 @@ export declare class FungibleToken extends Currency {
|
|
26
26
|
* @param name {@link Currency#name}
|
27
27
|
* @param bypassChecksum If true it only checks for length === 42, startsWith 0x and contains only hex characters
|
28
28
|
*/
|
29
|
-
constructor(chainId: bigint, address: string, decimals: number, symbol: string, name: string, bypassChecksum?: boolean, isNative?: boolean, coinGeckoId?: string);
|
29
|
+
constructor(chainId: bigint, address: string, decimals: number, symbol: string, name: string, bypassChecksum?: boolean, isNative?: boolean, coinGeckoId?: string, logoUrl?: string);
|
30
30
|
/**
|
31
31
|
* Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
|
32
32
|
* @param other other token to compare
|
@@ -20,10 +20,10 @@ export class FungibleToken extends Currency {
|
|
20
20
|
* @param name {@link Currency#name}
|
21
21
|
* @param bypassChecksum If true it only checks for length === 42, startsWith 0x and contains only hex characters
|
22
22
|
*/
|
23
|
-
constructor(chainId, address, decimals, symbol, name, bypassChecksum, isNative, coinGeckoId) {
|
23
|
+
constructor(chainId, address, decimals, symbol, name, bypassChecksum, isNative, coinGeckoId, logoUrl) {
|
24
24
|
// TODO(felix): add this back
|
25
25
|
// invariant(!_.isUndefined(getBlockchainFromBlockchainId(chainId)), "CHAIN_ID");
|
26
|
-
super(decimals, symbol, name,
|
26
|
+
super(decimals, symbol, name, logoUrl, isNative, true, coinGeckoId);
|
27
27
|
this.isToken = true;
|
28
28
|
// TODO(felix): bypassChecksum is a little confusing since when bypassChecksum is true, we still validate the address
|
29
29
|
// bypassChecksum is derived from the isNative parameter, so we should remove it and just check if isNative here
|
package/dist/index.d.ts
CHANGED
@@ -5,12 +5,14 @@ export * from "./interfaces/instance.js";
|
|
5
5
|
export * from "./interfaces/operation.js";
|
6
6
|
export * from "./interfaces/token.js";
|
7
7
|
export * from "./interfaces/orby.js";
|
8
|
+
export * from "./interfaces/blockchain.js";
|
8
9
|
export * from "./actions/account_cluster.js";
|
9
10
|
export * from "./actions/admin.js";
|
10
11
|
export * from "./actions/application.js";
|
11
12
|
export * from "./actions/instance.js";
|
12
13
|
export * from "./actions/operation.js";
|
13
14
|
export * from "./actions/token.js";
|
15
|
+
export * from "./actions/blockchain.js";
|
14
16
|
export * from "./entities/financial/account_balance.js";
|
15
17
|
export * from "./entities/financial/asset.js";
|
16
18
|
export * from "./entities/financial/currency_amount.js";
|
package/dist/index.js
CHANGED
@@ -6,6 +6,7 @@ export * from "./interfaces/instance.js";
|
|
6
6
|
export * from "./interfaces/operation.js";
|
7
7
|
export * from "./interfaces/token.js";
|
8
8
|
export * from "./interfaces/orby.js";
|
9
|
+
export * from "./interfaces/blockchain.js";
|
9
10
|
// actions
|
10
11
|
export * from "./actions/account_cluster.js";
|
11
12
|
export * from "./actions/admin.js";
|
@@ -13,6 +14,7 @@ export * from "./actions/application.js";
|
|
13
14
|
export * from "./actions/instance.js";
|
14
15
|
export * from "./actions/operation.js";
|
15
16
|
export * from "./actions/token.js";
|
17
|
+
export * from "./actions/blockchain.js";
|
16
18
|
// entities
|
17
19
|
export * from "./entities/financial/account_balance.js";
|
18
20
|
export * from "./entities/financial/asset.js";
|
@@ -15,7 +15,14 @@ export interface IAccountClusterActions {
|
|
15
15
|
getActivity(accountClusterId: string, limit?: number, offset?: number, order?: Order, startDate?: number, endDate?: number, filters?: {
|
16
16
|
transactionHash?: string;
|
17
17
|
address?: string;
|
18
|
-
}[]): Promise<
|
18
|
+
}[]): Promise<{
|
19
|
+
activities: Activity[];
|
20
|
+
pageInfo: {
|
21
|
+
hasNextPage: boolean;
|
22
|
+
hasPreviousPage: boolean;
|
23
|
+
totalCount: number;
|
24
|
+
};
|
25
|
+
}>;
|
19
26
|
getPortfolioOverview(accountClusterId: string): Promise<FungibleTokenOverview>;
|
20
27
|
getFungibleTokenPortfolio(accountClusterId: string): Promise<StandardizedBalance[]>;
|
21
28
|
getFungibleTokenBalances(accountClusterId: string, offset?: number, limit?: number, chainId?: bigint, tokensToOmit?: string[]): Promise<StandardizedBalance[]>;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { BlockchainInformation } from "../types.js";
|
2
|
+
export interface IBlockchainActions {
|
3
|
+
getBlockchainInformation(chainId: bigint): Promise<BlockchainInformation>;
|
4
|
+
listBlockchainsInformation(offset?: number, limit?: number): Promise<{
|
5
|
+
blockchains: BlockchainInformation[];
|
6
|
+
pageInfo: {
|
7
|
+
hasNextPage: boolean;
|
8
|
+
hasPreviousPage: boolean;
|
9
|
+
totalCount: number;
|
10
|
+
};
|
11
|
+
}>;
|
12
|
+
getChainsSupportedByDefault(chainId: bigint): Promise<BlockchainInformation[]>;
|
13
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { ChainEndpoint, GasSponsorshipPolicy } from "../types.js";
|
2
2
|
export interface IInstanceActions {
|
3
3
|
setCustomChainEndpointsForInstance(chainEndpoints: ChainEndpoint[]): Promise<boolean>;
|
4
4
|
removeCustomChainEndpointForInstance(chainIds: bigint[]): Promise<boolean>;
|
5
5
|
getCustomChainEndpointsForInstance(returnChainIdsOnly: boolean): Promise<boolean>;
|
6
|
-
getChainsSupportedByDefault(): Promise<BlockchainInformation[]>;
|
7
6
|
enabledChainAbstractionForInstance(enable: boolean): Promise<boolean>;
|
8
7
|
enableGasSponsorshipForInstance(enable: boolean): Promise<boolean>;
|
9
8
|
getGasSponsorForInstance(): Promise<string>;
|
@@ -1,8 +1,14 @@
|
|
1
|
-
import { OperationSet, OperationStatus, SignedOperation } from "../types.js";
|
1
|
+
import { OnchainOperation, OperationSet, OperationStatus, SignedOperation } from "../types.js";
|
2
2
|
import { CurrencyAmount } from "../entities/financial/currency_amount.js";
|
3
|
-
import { QuoteType } from "../enums.js";
|
3
|
+
import { OperationStatusType, QuoteType } from "../enums.js";
|
4
4
|
export interface IOperationActions {
|
5
|
-
getOperationsToExecuteTransaction(accountClusterId: string, to: string, data: string, value?: bigint
|
5
|
+
getOperationsToExecuteTransaction(accountClusterId: string, to: string, data: string, value?: bigint, gasToken?: {
|
6
|
+
standardizedTokenId: string;
|
7
|
+
tokenSources?: {
|
8
|
+
chainId: bigint;
|
9
|
+
address?: string;
|
10
|
+
}[];
|
11
|
+
}): Promise<OperationSet>;
|
6
12
|
getOperationsToSignTypedData(accountClusterId: string, data: string): Promise<OperationSet>;
|
7
13
|
getOperationsToCancelTransaction(accountClusterId: string, operationSetId: string): Promise<OperationSet>;
|
8
14
|
isTransactionPreconditionSatisfied(accountClusterId: string, to: string, data: string, value?: string): Promise<boolean>;
|
@@ -28,14 +34,14 @@ export interface IOperationActions {
|
|
28
34
|
standardizedTokenId: string;
|
29
35
|
amount?: bigint;
|
30
36
|
tokenSources?: {
|
31
|
-
chainId:
|
37
|
+
chainId: bigint;
|
32
38
|
address?: string;
|
33
39
|
}[];
|
34
40
|
}, output: {
|
35
41
|
standardizedTokenId: string;
|
36
42
|
amount?: bigint;
|
37
43
|
tokenDestination?: {
|
38
|
-
chainId:
|
44
|
+
chainId: bigint;
|
39
45
|
address?: string;
|
40
46
|
};
|
41
47
|
}, gasToken?: {
|
@@ -49,22 +55,22 @@ export interface IOperationActions {
|
|
49
55
|
standardizedTokenId: string;
|
50
56
|
amount?: bigint;
|
51
57
|
tokenSources?: {
|
52
|
-
chainId:
|
58
|
+
chainId: bigint;
|
53
59
|
address?: string;
|
54
60
|
}[];
|
55
61
|
}, output: {
|
56
62
|
standardizedTokenId: string;
|
57
63
|
amount?: bigint;
|
58
64
|
tokenDestination?: {
|
59
|
-
chainId:
|
65
|
+
chainId: bigint;
|
60
66
|
address?: string;
|
61
67
|
};
|
62
68
|
}): Promise<OperationSet>;
|
63
69
|
getOperationsToBridge(accountClusterId: string, standardizedTokenId: string, amount: bigint, tokenSources?: {
|
64
|
-
chainId:
|
70
|
+
chainId: bigint;
|
65
71
|
address?: string;
|
66
72
|
}[], tokenDestination?: {
|
67
|
-
chainId:
|
73
|
+
chainId: bigint;
|
68
74
|
address?: string;
|
69
75
|
}, gasToken?: {
|
70
76
|
standardizedTokenId: string;
|
@@ -73,4 +79,13 @@ export interface IOperationActions {
|
|
73
79
|
address?: string;
|
74
80
|
}[];
|
75
81
|
}): Promise<OperationSet>;
|
82
|
+
subscribeToOperationStatuses(ids?: string[], onOperationStatusesUpdateCallback?: (statusSummary: OperationStatusType, primaryOperationStatus?: OperationStatus, allOperationStatuses?: OperationStatus[]) => void): {
|
83
|
+
intervalId: number | null;
|
84
|
+
};
|
85
|
+
sendOperationSet(accountClusterId: string, operationSet: OperationSet, signOperation: (operation: OnchainOperation) => Promise<SignedOperation | undefined>): Promise<{
|
86
|
+
success: boolean;
|
87
|
+
operationSetId?: string;
|
88
|
+
primaryOperationStatus?: OperationStatus;
|
89
|
+
operationResponses?: OperationStatus[];
|
90
|
+
}>;
|
76
91
|
}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { IAccountClusterActions } from "./account_cluster.js";
|
2
2
|
import { IAdminActions } from "./admin.js";
|
3
3
|
import { IApplicationActions } from "./application.js";
|
4
|
+
import { IBlockchainActions } from "./blockchain.js";
|
4
5
|
import { IInstanceActions } from "./instance.js";
|
5
6
|
import { IOperationActions } from "./operation.js";
|
6
7
|
import { ITokenActions } from "./token.js";
|
7
|
-
export interface Orby extends IAccountClusterActions, IAdminActions, IApplicationActions, IInstanceActions, IOperationActions, ITokenActions {
|
8
|
+
export interface Orby extends IAccountClusterActions, IAdminActions, IApplicationActions, IInstanceActions, IOperationActions, ITokenActions, IBlockchainActions {
|
8
9
|
}
|