@orb-labs/orby-core 0.0.2 → 0.0.4
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/README.md +42 -1
- package/dist/actions/account_cluster.d.ts +1 -1
- package/dist/actions/account_cluster.js +64 -27
- package/dist/actions/admin.js +25 -7
- package/dist/actions/application.js +7 -1
- package/dist/actions/instance.js +54 -13
- package/dist/actions/operation.d.ts +19 -13
- package/dist/actions/operation.js +42 -22
- package/dist/actions/token.js +18 -8
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +104 -1
- package/dist/entities/financial/currency_amount.d.ts +4 -1
- package/dist/entities/financial/currency_amount.js +18 -0
- package/dist/entities/financial/fungible_token_amount.d.ts +4 -1
- package/dist/entities/financial/fungible_token_amount.js +18 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -4
- package/dist/interfaces/account_cluster.d.ts +1 -1
- package/dist/interfaces/operation.d.ts +13 -13
- package/dist/types.d.ts +6 -2
- package/dist/utils/action_helpers.d.ts +22 -0
- package/dist/utils/action_helpers.js +280 -0
- package/dist/utils/utils.d.ts +5 -22
- package/dist/utils/utils.js +13 -258
- package/package.json +6 -1
package/README.md
CHANGED
@@ -1 +1,42 @@
|
|
1
|
-
#
|
1
|
+
# Orby RPC SDK
|
2
|
+
|
3
|
+
A generic library for the Custom RPC functions on the Orby. The library can be used with either the ethers library or with extensions to the viem library. It us used by our @orb-labs/orby-viem-extension, @orb-labs/orby-ethers5 and @orb-labs/orby-ethers6 libraries.
|
4
|
+
|
5
|
+
Orby is an RPC-proxy that wraps around standard RPCs and extends their functionality to enable gas abstraction, gas sponsorship, and chain abstraction for any account (including EOAs) with just a few lines of code. Additionally, it allows wallets to monetize on any transaction from their users.
|
6
|
+
|
7
|
+
## Development
|
8
|
+
|
9
|
+
Run `yarn run dev`
|
10
|
+
|
11
|
+
## Publishing to npm
|
12
|
+
|
13
|
+
1. Bump the package.json version
|
14
|
+
|
15
|
+
```
|
16
|
+
// package.json
|
17
|
+
version: "0.0.1" // change to "0.0.2"
|
18
|
+
```
|
19
|
+
|
20
|
+
2. Run yarn at the root of orby folder
|
21
|
+
|
22
|
+
```
|
23
|
+
yarn
|
24
|
+
```
|
25
|
+
|
26
|
+
3. Build
|
27
|
+
|
28
|
+
```
|
29
|
+
yarn workspace @orb-labs/orby-core build
|
30
|
+
```
|
31
|
+
|
32
|
+
4. Login to npm
|
33
|
+
|
34
|
+
```
|
35
|
+
yarn npm login
|
36
|
+
```
|
37
|
+
|
38
|
+
4. Publish @orb-labs/orby-core to npm
|
39
|
+
|
40
|
+
```
|
41
|
+
yarn workspace @orb-labs/orby-core npm publish --access public
|
42
|
+
```
|
@@ -19,6 +19,6 @@ export declare class AccountClusterActions extends LibraryRequest {
|
|
19
19
|
address?: string;
|
20
20
|
}[]): Promise<Activity[]>;
|
21
21
|
getPortfolioOverview(accountClusterId: string): Promise<FungibleTokenOverview>;
|
22
|
-
getFungibleTokenPortfolio(accountClusterId: string): Promise<
|
22
|
+
getFungibleTokenPortfolio(accountClusterId: string): Promise<StandardizedBalance[]>;
|
23
23
|
getFungibleTokenBalances(accountClusterId: string, offset?: number, limit?: number, tokensToOmit?: string[]): Promise<StandardizedBalance[]>;
|
24
24
|
}
|
@@ -10,8 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.AccountClusterActions = void 0;
|
13
|
-
const
|
13
|
+
const action_helpers_1 = require("../utils/action_helpers");
|
14
14
|
const library_request_1 = require("../entities/library_request");
|
15
|
+
const utils_1 = require("../utils/utils");
|
15
16
|
class AccountClusterActions extends library_request_1.LibraryRequest {
|
16
17
|
constructor(library, client, provider) {
|
17
18
|
super(library, client, provider);
|
@@ -22,7 +23,7 @@ class AccountClusterActions extends library_request_1.LibraryRequest {
|
|
22
23
|
const accountCluster = yield this.sendRequest("orby_createAccountCluster", [
|
23
24
|
{ accounts: formattedAccounts },
|
24
25
|
]);
|
25
|
-
return (0,
|
26
|
+
return (0, action_helpers_1.extractAccountCluster)(accountCluster);
|
26
27
|
});
|
27
28
|
}
|
28
29
|
addToAccountCluster(accounts, accountClusterId) {
|
@@ -31,19 +32,23 @@ class AccountClusterActions extends library_request_1.LibraryRequest {
|
|
31
32
|
const accountCluster = yield this.sendRequest("orby_addToAccountCluster", [
|
32
33
|
{ accounts: formattedAccounts, accountClusterId },
|
33
34
|
]);
|
34
|
-
return (0,
|
35
|
+
return (0, action_helpers_1.extractAccountCluster)(accountCluster);
|
35
36
|
});
|
36
37
|
}
|
37
38
|
removeFromAccountCluster(accounts, accountClusterId) {
|
38
39
|
return __awaiter(this, void 0, void 0, function* () {
|
39
40
|
const formattedAccounts = accounts.map((account) => account.toAccountModel());
|
40
41
|
const accountCluster = yield this.sendRequest("orby_removeFromAccountCluster", [{ accounts: formattedAccounts, accountClusterId }]);
|
41
|
-
return (0,
|
42
|
+
return (0, action_helpers_1.extractAccountCluster)(accountCluster);
|
42
43
|
});
|
43
44
|
}
|
44
45
|
enableChainAbstractionForAccountCluster(accountClusterId, enable) {
|
45
46
|
return __awaiter(this, void 0, void 0, function* () {
|
46
|
-
const { success } = yield this.sendRequest("orby_enableChainAbstractionForAccountCluster", [{ accountClusterId, enable }]);
|
47
|
+
const { success, message, code } = yield this.sendRequest("orby_enableChainAbstractionForAccountCluster", [{ accountClusterId, enable }]);
|
48
|
+
if (code && message) {
|
49
|
+
console.error("[enableChainAbstractionForAccountCluster]", code, message);
|
50
|
+
return undefined;
|
51
|
+
}
|
47
52
|
return success;
|
48
53
|
});
|
49
54
|
}
|
@@ -56,20 +61,32 @@ class AccountClusterActions extends library_request_1.LibraryRequest {
|
|
56
61
|
customIndexerUrls: endpoint.customIndexerUrls,
|
57
62
|
};
|
58
63
|
});
|
59
|
-
const { success } = yield this.sendRequest("orby_setCustomChainEndpointsForAccountCluster", [{ accountClusterId, chainEndpoints: formattedEndpoints }]);
|
64
|
+
const { success, message, code } = yield this.sendRequest("orby_setCustomChainEndpointsForAccountCluster", [{ accountClusterId, chainEndpoints: formattedEndpoints }]);
|
65
|
+
if (code && message) {
|
66
|
+
console.error("[setCustomChainEndpointsForAccountCluster]", code, message);
|
67
|
+
return undefined;
|
68
|
+
}
|
60
69
|
return success;
|
61
70
|
});
|
62
71
|
}
|
63
72
|
removeCustomChainEndpointsForAccountCluster(accountClusterId, chainIds) {
|
64
73
|
return __awaiter(this, void 0, void 0, function* () {
|
65
74
|
const formattedChainIds = chainIds.map((chainId) => `EIP155-${chainId}`);
|
66
|
-
const { success } = yield this.sendRequest("orby_removeCustomChainEndpointsForAccountCluster", [{ accountClusterId, chainIds: formattedChainIds }]);
|
75
|
+
const { success, message, code } = yield this.sendRequest("orby_removeCustomChainEndpointsForAccountCluster", [{ accountClusterId, chainIds: formattedChainIds }]);
|
76
|
+
if (code && message) {
|
77
|
+
console.error("[removeCustomChainEndpointsForAccountCluster]", code, message);
|
78
|
+
return undefined;
|
79
|
+
}
|
67
80
|
return success;
|
68
81
|
});
|
69
82
|
}
|
70
83
|
getCustomChainEndpointsForAccountCluster(accountClusterId, returnChainIdsOnly) {
|
71
84
|
return __awaiter(this, void 0, void 0, function* () {
|
72
|
-
const { chainEndpoints } = yield this.sendRequest("orby_getCustomChainEndpointsForAccountCluster", [{ accountClusterId, returnChainIdsOnly }]);
|
85
|
+
const { chainEndpoints, message, code } = yield this.sendRequest("orby_getCustomChainEndpointsForAccountCluster", [{ accountClusterId, returnChainIdsOnly }]);
|
86
|
+
if (code && message) {
|
87
|
+
console.error("[getCustomChainEndpointsForAccountCluster]", code, message);
|
88
|
+
return undefined;
|
89
|
+
}
|
73
90
|
return chainEndpoints.map((endpoint) => {
|
74
91
|
return {
|
75
92
|
chainId: (0, utils_1.getChainIdFromOrbyChainId)(endpoint.chainId),
|
@@ -81,35 +98,43 @@ class AccountClusterActions extends library_request_1.LibraryRequest {
|
|
81
98
|
}
|
82
99
|
isChainSupportedOnAccountCluster(accountClusterId, chainId) {
|
83
100
|
return __awaiter(this, void 0, void 0, function* () {
|
84
|
-
const { supportStatus } = yield this.sendRequest("orby_isChainSupportedOnAccountCluster", [{ accountClusterId, chainId: `EIP155-${chainId}` }]);
|
101
|
+
const { supportStatus, message, code } = yield this.sendRequest("orby_isChainSupportedOnAccountCluster", [{ accountClusterId, chainId: `EIP155-${chainId}` }]);
|
102
|
+
if (code && message) {
|
103
|
+
console.error("[isChainSupportedOnAccountCluster]", code, message);
|
104
|
+
return undefined;
|
105
|
+
}
|
85
106
|
return supportStatus;
|
86
107
|
});
|
87
108
|
}
|
88
109
|
getNodeRpcUrl(accountClusterId, chainId) {
|
89
110
|
return __awaiter(this, void 0, void 0, function* () {
|
90
|
-
const { nodeRpcUrl } = yield this.sendRequest("orby_getNodeRpcUrl", [
|
91
|
-
|
92
|
-
|
111
|
+
const { nodeRpcUrl, code, message } = yield this.sendRequest("orby_getNodeRpcUrl", [[{ accountClusterId, chainId: `EIP155-${chainId}` }]]);
|
112
|
+
if (code && message) {
|
113
|
+
console.error("[getNodeRpcUrl]", code, message);
|
114
|
+
return undefined;
|
115
|
+
}
|
93
116
|
return nodeRpcUrl;
|
94
117
|
});
|
95
118
|
}
|
96
119
|
getVirtualNodeRpcUrl(accountClusterId, chainId, entrypointAccountAddress) {
|
97
120
|
return __awaiter(this, void 0, void 0, function* () {
|
98
|
-
const { virtualNodeRpcUrl } = yield this.sendRequest("orby_getVirtualNodeRpcUrl", [
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
},
|
105
|
-
],
|
121
|
+
const { virtualNodeRpcUrl, message, code } = yield this.sendRequest("orby_getVirtualNodeRpcUrl", [
|
122
|
+
{
|
123
|
+
accountClusterId,
|
124
|
+
chainId: `EIP155-${chainId}`,
|
125
|
+
entrypointAccountAddress,
|
126
|
+
},
|
106
127
|
]);
|
128
|
+
if (code && message) {
|
129
|
+
console.error("[getVirtualNodeRpcUrl]", code, message);
|
130
|
+
return undefined;
|
131
|
+
}
|
107
132
|
return virtualNodeRpcUrl;
|
108
133
|
});
|
109
134
|
}
|
110
135
|
getActivity(accountClusterId, limit, offset, order, startDate, endDate, filters) {
|
111
136
|
return __awaiter(this, void 0, void 0, function* () {
|
112
|
-
const { virtualNodeRpcUrl } = yield this.sendRequest("orby_getActivity", [
|
137
|
+
const { virtualNodeRpcUrl, code, message } = yield this.sendRequest("orby_getActivity", [
|
113
138
|
[
|
114
139
|
{
|
115
140
|
accountClusterId,
|
@@ -122,25 +147,37 @@ class AccountClusterActions extends library_request_1.LibraryRequest {
|
|
122
147
|
},
|
123
148
|
],
|
124
149
|
]);
|
150
|
+
if (code && message) {
|
151
|
+
console.error("[getActivity]", code, message);
|
152
|
+
return undefined;
|
153
|
+
}
|
125
154
|
return virtualNodeRpcUrl;
|
126
155
|
});
|
127
156
|
}
|
128
157
|
getPortfolioOverview(accountClusterId) {
|
129
158
|
return __awaiter(this, void 0, void 0, function* () {
|
130
|
-
const
|
131
|
-
return (0,
|
159
|
+
const fungibleTokenOverview = yield this.sendRequest("orby_getPortfolioOverview", [{ accountClusterId }]);
|
160
|
+
return (0, action_helpers_1.extractFungibleTokenOverview)(fungibleTokenOverview);
|
132
161
|
});
|
133
162
|
}
|
134
163
|
getFungibleTokenPortfolio(accountClusterId) {
|
135
164
|
return __awaiter(this, void 0, void 0, function* () {
|
136
|
-
const {
|
137
|
-
|
165
|
+
const { fungibleTokenBalances, code, message } = yield this.sendRequest("orby_getFungibleTokenPortfolio", [{ accountClusterId }]);
|
166
|
+
if (code && message) {
|
167
|
+
console.error("[getFungibleTokenPortfolio]", code, message);
|
168
|
+
return undefined;
|
169
|
+
}
|
170
|
+
return (0, action_helpers_1.extractStandardizedBalances)(fungibleTokenBalances);
|
138
171
|
});
|
139
172
|
}
|
140
173
|
getFungibleTokenBalances(accountClusterId, offset, limit, tokensToOmit) {
|
141
174
|
return __awaiter(this, void 0, void 0, function* () {
|
142
|
-
const { fungibleTokenBalances } = yield this.sendRequest("orby_getFungibleTokenBalances", [{ accountClusterId, offset, limit, tokensToOmit }]);
|
143
|
-
|
175
|
+
const { fungibleTokenBalances, code, message } = yield this.sendRequest("orby_getFungibleTokenBalances", [{ accountClusterId, offset, limit, tokensToOmit }]);
|
176
|
+
if (code && message) {
|
177
|
+
console.error("[getFungibleTokenBalances]", code, message);
|
178
|
+
return undefined;
|
179
|
+
}
|
180
|
+
return (0, action_helpers_1.extractStandardizedBalances)(fungibleTokenBalances);
|
144
181
|
});
|
145
182
|
}
|
146
183
|
}
|
package/dist/actions/admin.js
CHANGED
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.AdminActions = void 0;
|
13
|
-
const
|
13
|
+
const action_helpers_1 = require("../utils/action_helpers");
|
14
14
|
const library_request_1 = require("../entities/library_request");
|
15
15
|
class AdminActions extends library_request_1.LibraryRequest {
|
16
16
|
constructor(library, client, provider) {
|
@@ -18,24 +18,42 @@ class AdminActions extends library_request_1.LibraryRequest {
|
|
18
18
|
}
|
19
19
|
createInstance(name) {
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
21
|
-
|
21
|
+
const result = yield this.sendRequest("orby_createInstance", [{ name }]);
|
22
|
+
if (result.code && result.message) {
|
23
|
+
console.error("[createInstance]", result.code, result.message);
|
24
|
+
return undefined;
|
25
|
+
}
|
26
|
+
return result;
|
22
27
|
});
|
23
28
|
}
|
24
29
|
getInstanceUrls(name) {
|
25
30
|
return __awaiter(this, void 0, void 0, function* () {
|
26
|
-
|
31
|
+
const result = yield this.sendRequest("orby_getInstanceUrls", [{ name }]);
|
32
|
+
if (result.code && result.message) {
|
33
|
+
console.error("[getInstanceUrls]", result.code, result.message);
|
34
|
+
return undefined;
|
35
|
+
}
|
36
|
+
return result;
|
27
37
|
});
|
28
38
|
}
|
29
39
|
getGasSpentForCustomer(month, year) {
|
30
40
|
return __awaiter(this, void 0, void 0, function* () {
|
31
|
-
const { totalGasSpentForCustomer } = yield this.sendRequest("orby_getGasSpentForCustomer", [{ month, year }]);
|
32
|
-
|
41
|
+
const { totalGasSpentForCustomer, code, message } = yield this.sendRequest("orby_getGasSpentForCustomer", [{ month, year }]);
|
42
|
+
if (code && message) {
|
43
|
+
console.error("[getGasSpentForCustomer]", code, message);
|
44
|
+
return undefined;
|
45
|
+
}
|
46
|
+
return (0, action_helpers_1.extractGasSponsorshipData)(totalGasSpentForCustomer);
|
33
47
|
});
|
34
48
|
}
|
35
49
|
getGasSpentForInstances(month, year, instanceNames) {
|
36
50
|
return __awaiter(this, void 0, void 0, function* () {
|
37
|
-
const { totalGasSpendForInstances } = yield this.sendRequest("orby_getGasSpentForInstances", [{ month, year, instanceNames }]);
|
38
|
-
|
51
|
+
const { totalGasSpendForInstances, code, message } = yield this.sendRequest("orby_getGasSpentForInstances", [{ month, year, instanceNames }]);
|
52
|
+
if (code && message) {
|
53
|
+
console.error("[getGasSpentForInstances]", code, message);
|
54
|
+
return undefined;
|
55
|
+
}
|
56
|
+
return (0, action_helpers_1.extractGasSpendForInstances)(totalGasSpendForInstances);
|
39
57
|
});
|
40
58
|
}
|
41
59
|
}
|
@@ -17,7 +17,13 @@ class ApplicationActions extends library_request_1.LibraryRequest {
|
|
17
17
|
}
|
18
18
|
isChainAbstractionCompatible(appDomainUrl) {
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
20
|
-
const { isChainAbstractionCompatible } = yield this.sendRequest("orby_isChainAbstractionCompatible", [
|
20
|
+
const { isChainAbstractionCompatible, code, message } = yield this.sendRequest("orby_isChainAbstractionCompatible", [
|
21
|
+
{ appDomainUrl },
|
22
|
+
]);
|
23
|
+
if (code && message) {
|
24
|
+
console.error("[isChainAbstractionCompatible]", code, message);
|
25
|
+
return undefined;
|
26
|
+
}
|
21
27
|
return isChainAbstractionCompatible;
|
22
28
|
});
|
23
29
|
}
|
package/dist/actions/instance.js
CHANGED
@@ -10,8 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.InstanceActions = void 0;
|
13
|
-
const
|
13
|
+
const action_helpers_1 = require("../utils/action_helpers");
|
14
14
|
const library_request_1 = require("../entities/library_request");
|
15
|
+
const utils_1 = require("../utils/utils");
|
15
16
|
class InstanceActions extends library_request_1.LibraryRequest {
|
16
17
|
constructor(library, client, provider) {
|
17
18
|
super(library, client, provider);
|
@@ -25,20 +26,32 @@ class InstanceActions extends library_request_1.LibraryRequest {
|
|
25
26
|
customIndexerUrls: endpoint.customIndexerUrls,
|
26
27
|
};
|
27
28
|
});
|
28
|
-
const { success } = yield this.sendRequest("orby_setCustomChainEndpointsForInstance", [{ chainEndpoints: formattedEndpoints }]);
|
29
|
+
const { success, code, message } = yield this.sendRequest("orby_setCustomChainEndpointsForInstance", [{ chainEndpoints: formattedEndpoints }]);
|
30
|
+
if (code && message) {
|
31
|
+
console.error("[setCustomChainEndpointsForInstance]", code, message);
|
32
|
+
return undefined;
|
33
|
+
}
|
29
34
|
return success;
|
30
35
|
});
|
31
36
|
}
|
32
37
|
removeCustomChainEndpointForInstance(chainIds) {
|
33
38
|
return __awaiter(this, void 0, void 0, function* () {
|
34
39
|
const formattedChainIds = chainIds.map((chainId) => `EIP155-${chainId}`);
|
35
|
-
const { success } = yield this.sendRequest("orby_removeCustomChainEndpointForInstance", [{ chainIds: formattedChainIds }]);
|
40
|
+
const { success, code, message } = yield this.sendRequest("orby_removeCustomChainEndpointForInstance", [{ chainIds: formattedChainIds }]);
|
41
|
+
if (code && message) {
|
42
|
+
console.error("[removeCustomChainEndpointForInstance]", code, message);
|
43
|
+
return undefined;
|
44
|
+
}
|
36
45
|
return success;
|
37
46
|
});
|
38
47
|
}
|
39
48
|
getCustomChainEndpointsForInstance(returnChainIdsOnly) {
|
40
49
|
return __awaiter(this, void 0, void 0, function* () {
|
41
|
-
const { chainEndpoints } = yield this.sendRequest("orby_getCustomChainEndpointsForInstance", [{ returnChainIdsOnly }]);
|
50
|
+
const { chainEndpoints, code, message } = yield this.sendRequest("orby_getCustomChainEndpointsForInstance", [{ returnChainIdsOnly }]);
|
51
|
+
if (code && message) {
|
52
|
+
console.error("[getCustomChainEndpointsForInstance]", code, message);
|
53
|
+
return undefined;
|
54
|
+
}
|
42
55
|
return chainEndpoints.map((endpoint) => {
|
43
56
|
return {
|
44
57
|
chainId: (0, utils_1.getChainIdFromOrbyChainId)(endpoint.chainId),
|
@@ -50,43 +63,71 @@ class InstanceActions extends library_request_1.LibraryRequest {
|
|
50
63
|
}
|
51
64
|
getChainsSupportedByDefault() {
|
52
65
|
return __awaiter(this, void 0, void 0, function* () {
|
53
|
-
const { supportedChains } = yield this.sendRequest("orby_getChainsSupportedByDefault", [{}]);
|
54
|
-
|
66
|
+
const { supportedChains, code, message } = yield this.sendRequest("orby_getChainsSupportedByDefault", [{}]);
|
67
|
+
if (code && message) {
|
68
|
+
console.error("[getChainsSupportedByDefault]", code, message);
|
69
|
+
return undefined;
|
70
|
+
}
|
71
|
+
return (0, action_helpers_1.extractBlockchainInformations)(supportedChains);
|
55
72
|
});
|
56
73
|
}
|
57
74
|
enabledChainAbstractionForInstance(enable) {
|
58
75
|
return __awaiter(this, void 0, void 0, function* () {
|
59
|
-
const { success } = yield this.sendRequest("orby_enabledChainAbstractionForInstance", [{ enable }]);
|
76
|
+
const { success, code, message } = yield this.sendRequest("orby_enabledChainAbstractionForInstance", [{ enable }]);
|
77
|
+
if (code && message) {
|
78
|
+
console.error("[enabledChainAbstractionForInstance]", code, message);
|
79
|
+
return undefined;
|
80
|
+
}
|
60
81
|
return success;
|
61
82
|
});
|
62
83
|
}
|
63
84
|
enableGasSponsorshipForInstance(enable) {
|
64
85
|
return __awaiter(this, void 0, void 0, function* () {
|
65
|
-
const { success } = yield this.sendRequest("orby_enableGasSponsorshipForInstance", [{ enable }]);
|
86
|
+
const { success, code, message } = yield this.sendRequest("orby_enableGasSponsorshipForInstance", [{ enable }]);
|
87
|
+
if (code && message) {
|
88
|
+
console.error("[enableGasSponsorshipForInstance]", code, message);
|
89
|
+
return undefined;
|
90
|
+
}
|
66
91
|
return success;
|
67
92
|
});
|
68
93
|
}
|
69
94
|
getGasSponsorForInstance() {
|
70
95
|
return __awaiter(this, void 0, void 0, function* () {
|
71
|
-
const { gasSponsor } = yield this.sendRequest("orby_getGasSponsorForInstance", [{}]);
|
96
|
+
const { gasSponsor, code, message } = yield this.sendRequest("orby_getGasSponsorForInstance", [{}]);
|
97
|
+
if (code && message) {
|
98
|
+
console.error("[getGasSponsorForInstance]", code, message);
|
99
|
+
return undefined;
|
100
|
+
}
|
72
101
|
return gasSponsor;
|
73
102
|
});
|
74
103
|
}
|
75
104
|
getOrbyGasSponsorPolicyForInstance() {
|
76
105
|
return __awaiter(this, void 0, void 0, function* () {
|
77
|
-
const { gasSponsorshipPolicy } = yield this.sendRequest("orby_getOrbyGasSponsorPolicyForInstance", [{}]);
|
78
|
-
|
106
|
+
const { gasSponsorshipPolicy, message, code } = yield this.sendRequest("orby_getOrbyGasSponsorPolicyForInstance", [{}]);
|
107
|
+
if (code && message) {
|
108
|
+
console.error("[getOrbyGasSponsorPolicyForInstance]", code, message);
|
109
|
+
return undefined;
|
110
|
+
}
|
111
|
+
return (0, action_helpers_1.extractGasSponsorshipPolicy)(gasSponsorshipPolicy);
|
79
112
|
});
|
80
113
|
}
|
81
114
|
setOrbyGasSponsorPolicyForInstance(gasSponsorshipPolicy) {
|
82
115
|
return __awaiter(this, void 0, void 0, function* () {
|
83
|
-
const { success } = yield this.sendRequest("orby_setOrbyGasSponsorPolicyForInstance", [Object.assign({}, gasSponsorshipPolicy)]);
|
116
|
+
const { success, code, message } = yield this.sendRequest("orby_setOrbyGasSponsorPolicyForInstance", [Object.assign({}, gasSponsorshipPolicy)]);
|
117
|
+
if (code && message) {
|
118
|
+
console.error("[setOrbyGasSponsorPolicyForInstance]", code, message);
|
119
|
+
return undefined;
|
120
|
+
}
|
84
121
|
return success;
|
85
122
|
});
|
86
123
|
}
|
87
124
|
removeOrbyGasSponsorPolicyForInstance() {
|
88
125
|
return __awaiter(this, void 0, void 0, function* () {
|
89
|
-
const { success } = yield this.sendRequest("orby_removeOrbyGasSponsorPolicyForInstance", [{}]);
|
126
|
+
const { success, code, message } = yield this.sendRequest("orby_removeOrbyGasSponsorPolicyForInstance", [{}]);
|
127
|
+
if (code && message) {
|
128
|
+
console.error("[removeOrbyGasSponsorPolicyForInstance]", code, message);
|
129
|
+
return undefined;
|
130
|
+
}
|
90
131
|
return success;
|
91
132
|
});
|
92
133
|
}
|
@@ -1,12 +1,18 @@
|
|
1
|
-
import {
|
1
|
+
import { OperationSet, OperationStatus, SignedOperation } from "../types";
|
2
2
|
import { CurrencyAmount } from "../entities/financial/currency_amount";
|
3
3
|
import { LIBRARY_TYPE, QuoteType } from "../enums";
|
4
4
|
import { LibraryRequest } from "../entities/library_request";
|
5
5
|
export declare class OperationActions extends LibraryRequest {
|
6
6
|
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
7
|
-
getOperationsToExecuteTransaction(accountClusterId: string, to: string, data: string, value?:
|
8
|
-
|
9
|
-
|
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): Promise<OperationSet>;
|
15
|
+
getOperationsToCancelTransaction(accountClusterId: string, operationSetId: string): Promise<OperationSet>;
|
10
16
|
isTransactionPreconditionSatisfied(accountClusterId: string, to: string, data: string, value?: string): Promise<boolean>;
|
11
17
|
isTypedDataPreconditionSatisfied(accountClusterId: string, data: string): Promise<boolean>;
|
12
18
|
sendSignedOperations(accountClusterId: string, signedOperations: SignedOperation[]): Promise<{
|
@@ -16,7 +22,7 @@ export declare class OperationActions extends LibraryRequest {
|
|
16
22
|
getOperationStatuses(operationIds: string[]): Promise<OperationStatus[]>;
|
17
23
|
estimateFiatCostToExecuteTransaction(to: string, data: string, value?: string): Promise<CurrencyAmount>;
|
18
24
|
estimateFiatCostToSignTypedData(data: string): Promise<CurrencyAmount>;
|
19
|
-
getOperationsToTransferToken(accountClusterId: string, standardizedTokenId: string, amount:
|
25
|
+
getOperationsToTransferToken(accountClusterId: string, standardizedTokenId: string, amount: bigint, recipient: {
|
20
26
|
chainId: bigint;
|
21
27
|
recipientAddress: string;
|
22
28
|
}, gasToken?: {
|
@@ -25,17 +31,17 @@ export declare class OperationActions extends LibraryRequest {
|
|
25
31
|
chainId: bigint;
|
26
32
|
address?: string;
|
27
33
|
}[];
|
28
|
-
}): Promise<
|
34
|
+
}): Promise<OperationSet>;
|
29
35
|
getOperationsToSwap(accountClusterId: string, swapType: QuoteType, input: {
|
30
36
|
standardizedTokenId: string;
|
31
|
-
amount?:
|
37
|
+
amount?: bigint;
|
32
38
|
tokenSources?: {
|
33
39
|
chainId: string;
|
34
40
|
address?: string;
|
35
41
|
}[];
|
36
42
|
}, output: {
|
37
43
|
standardizedTokenId: string;
|
38
|
-
amount?:
|
44
|
+
amount?: bigint;
|
39
45
|
tokenDestination?: {
|
40
46
|
chainId: string;
|
41
47
|
address?: string;
|
@@ -46,22 +52,22 @@ export declare class OperationActions extends LibraryRequest {
|
|
46
52
|
chainId: bigint;
|
47
53
|
address?: string;
|
48
54
|
}[];
|
49
|
-
}): Promise<
|
55
|
+
}): Promise<OperationSet>;
|
50
56
|
getQuote(accountClusterId: string, swapType: QuoteType, input: {
|
51
57
|
standardizedTokenId: string;
|
52
|
-
amount?:
|
58
|
+
amount?: bigint;
|
53
59
|
tokenSources?: {
|
54
60
|
chainId: string;
|
55
61
|
address?: string;
|
56
62
|
}[];
|
57
63
|
}, output: {
|
58
64
|
standardizedTokenId: string;
|
59
|
-
amount?:
|
65
|
+
amount?: bigint;
|
60
66
|
tokenDestination?: {
|
61
67
|
chainId: string;
|
62
68
|
address?: string;
|
63
69
|
};
|
64
|
-
}): Promise<
|
70
|
+
}): Promise<OperationSet>;
|
65
71
|
getOperationsToBridge(accountClusterId: string, standardizedTokenId: string, amount: bigint, tokenSources?: {
|
66
72
|
chainId: string;
|
67
73
|
address?: string;
|
@@ -74,5 +80,5 @@ export declare class OperationActions extends LibraryRequest {
|
|
74
80
|
chainId: bigint;
|
75
81
|
address?: string;
|
76
82
|
}[];
|
77
|
-
}): Promise<
|
83
|
+
}): Promise<OperationSet>;
|
78
84
|
}
|