@orb-labs/orby-core 0.0.6 → 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/CHANGELOG.md +7 -0
- package/dist/actions/account_cluster.d.ts +12 -5
- package/dist/actions/account_cluster.js +185 -338
- package/dist/actions/admin.d.ts +3 -3
- package/dist/actions/admin.js +37 -127
- package/dist/actions/application.d.ts +2 -2
- package/dist/actions/application.js +14 -77
- package/dist/actions/blockchain.d.ts +16 -0
- package/dist/actions/blockchain.js +35 -0
- package/dist/actions/instance.d.ts +3 -4
- package/dist/actions/instance.js +90 -255
- package/dist/actions/operation.d.ts +19 -10
- package/dist/actions/operation.js +323 -259
- package/dist/actions/token.d.ts +3 -3
- package/dist/actions/token.js +43 -119
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +70 -71
- package/dist/entities/account.d.ts +1 -1
- package/dist/entities/account.js +25 -30
- package/dist/entities/financial/account_balance.d.ts +2 -2
- package/dist/entities/financial/account_balance.js +20 -22
- package/dist/entities/financial/asset.js +13 -15
- package/dist/entities/financial/currency.d.ts +1 -1
- package/dist/entities/financial/currency.js +16 -35
- package/dist/entities/financial/currency_amount.d.ts +1 -1
- package/dist/entities/financial/currency_amount.js +49 -71
- package/dist/entities/financial/fungible_token.d.ts +3 -3
- package/dist/entities/financial/fungible_token.js +31 -52
- package/dist/entities/financial/fungible_token_amount.d.ts +2 -2
- package/dist/entities/financial/fungible_token_amount.js +53 -75
- package/dist/entities/financial/non_fungible_token.d.ts +2 -2
- package/dist/entities/financial/non_fungible_token.js +25 -45
- package/dist/entities/financial/semi_fungible_token.d.ts +2 -2
- package/dist/entities/financial/semi_fungible_token.js +25 -45
- package/dist/entities/library_request.d.ts +1 -1
- package/dist/entities/library_request.js +7 -9
- package/dist/entities/state.d.ts +4 -4
- package/dist/entities/state.js +57 -67
- package/dist/index.d.ts +29 -27
- package/dist/index.js +29 -27
- package/dist/interfaces/account_cluster.d.ts +11 -4
- package/dist/interfaces/admin.d.ts +1 -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 +25 -10
- package/dist/interfaces/orby.d.ts +8 -7
- package/dist/interfaces/token.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +9 -9
- package/dist/utils/action_helpers.d.ts +1 -1
- package/dist/utils/action_helpers.js +43 -63
- package/dist/utils/utils.d.ts +2 -1
- package/dist/utils/utils.js +23 -19
- package/dist/utils/validateAndParseAddress.js +3 -3
- package/package.json +4 -2
package/dist/actions/admin.js
CHANGED
@@ -1,129 +1,39 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
return extendStatics(d, b);
|
7
|
-
};
|
8
|
-
return function (d, b) {
|
9
|
-
if (typeof b !== "function" && b !== null)
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
-
extendStatics(d, b);
|
12
|
-
function __() { this.constructor = d; }
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
-
};
|
15
|
-
})();
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23
|
-
});
|
24
|
-
};
|
25
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
26
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
27
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
28
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
29
|
-
function step(op) {
|
30
|
-
if (f) throw new TypeError("Generator is already executing.");
|
31
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
32
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
33
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
34
|
-
switch (op[0]) {
|
35
|
-
case 0: case 1: t = op; break;
|
36
|
-
case 4: _.label++; return { value: op[1], done: false };
|
37
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
38
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
39
|
-
default:
|
40
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
41
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
42
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
43
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
44
|
-
if (t[2]) _.ops.pop();
|
45
|
-
_.trys.pop(); continue;
|
46
|
-
}
|
47
|
-
op = body.call(thisArg, _);
|
48
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
49
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
1
|
+
import { extractGasSpendForInstances, extractGasSponsorshipData, } from "../utils/action_helpers.js";
|
2
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
3
|
+
export class AdminActions extends LibraryRequest {
|
4
|
+
constructor(library, client, provider) {
|
5
|
+
super(library, client, provider);
|
50
6
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
return
|
7
|
+
async createInstance(name) {
|
8
|
+
const result = await this.sendRequest("orby_createInstance", [{ name }]);
|
9
|
+
if (result.code && result.message) {
|
10
|
+
console.error("[createInstance]", result.code, result.message);
|
11
|
+
return undefined;
|
12
|
+
}
|
13
|
+
return result;
|
58
14
|
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
return
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
if (result.code && result.message) {
|
85
|
-
console.error("[getInstanceUrls]", result.code, result.message);
|
86
|
-
return [2 /*return*/, undefined];
|
87
|
-
}
|
88
|
-
return [2 /*return*/, result];
|
89
|
-
}
|
90
|
-
});
|
91
|
-
});
|
92
|
-
};
|
93
|
-
AdminActions.prototype.getGasSpentForCustomer = function (month, year) {
|
94
|
-
return __awaiter(this, void 0, void 0, function () {
|
95
|
-
var _a, totalGasSpentForCustomer, code, message;
|
96
|
-
return __generator(this, function (_b) {
|
97
|
-
switch (_b.label) {
|
98
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_getGasSpentForCustomer", [{ month: month, year: year }])];
|
99
|
-
case 1:
|
100
|
-
_a = _b.sent(), totalGasSpentForCustomer = _a.totalGasSpentForCustomer, code = _a.code, message = _a.message;
|
101
|
-
if (code && message) {
|
102
|
-
console.error("[getGasSpentForCustomer]", code, message);
|
103
|
-
return [2 /*return*/, undefined];
|
104
|
-
}
|
105
|
-
return [2 /*return*/, extractGasSponsorshipData(totalGasSpentForCustomer)];
|
106
|
-
}
|
107
|
-
});
|
108
|
-
});
|
109
|
-
};
|
110
|
-
AdminActions.prototype.getGasSpentForInstances = function (month, year, instanceNames) {
|
111
|
-
return __awaiter(this, void 0, void 0, function () {
|
112
|
-
var _a, totalGasSpendForInstances, code, message;
|
113
|
-
return __generator(this, function (_b) {
|
114
|
-
switch (_b.label) {
|
115
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_getGasSpentForInstances", [{ month: month, year: year, instanceNames: instanceNames }])];
|
116
|
-
case 1:
|
117
|
-
_a = _b.sent(), totalGasSpendForInstances = _a.totalGasSpendForInstances, code = _a.code, message = _a.message;
|
118
|
-
if (code && message) {
|
119
|
-
console.error("[getGasSpentForInstances]", code, message);
|
120
|
-
return [2 /*return*/, undefined];
|
121
|
-
}
|
122
|
-
return [2 /*return*/, extractGasSpendForInstances(totalGasSpendForInstances)];
|
123
|
-
}
|
124
|
-
});
|
125
|
-
});
|
126
|
-
};
|
127
|
-
return AdminActions;
|
128
|
-
}(LibraryRequest));
|
129
|
-
export { AdminActions };
|
15
|
+
async getInstanceUrls(name) {
|
16
|
+
const result = await this.sendRequest("orby_getInstanceUrls", [{ name }]);
|
17
|
+
if (result.code && result.message) {
|
18
|
+
console.error("[getInstanceUrls]", result.code, result.message);
|
19
|
+
return undefined;
|
20
|
+
}
|
21
|
+
return result;
|
22
|
+
}
|
23
|
+
async getGasSpentForCustomer(month, year) {
|
24
|
+
const { totalGasSpentForCustomer, code, message } = await this.sendRequest("orby_getGasSpentForCustomer", [{ month, year }]);
|
25
|
+
if (code && message) {
|
26
|
+
console.error("[getGasSpentForCustomer]", code, message);
|
27
|
+
return undefined;
|
28
|
+
}
|
29
|
+
return extractGasSponsorshipData(totalGasSpentForCustomer);
|
30
|
+
}
|
31
|
+
async getGasSpentForInstances(month, year, instanceNames) {
|
32
|
+
const { totalGasSpendForInstances, code, message } = await this.sendRequest("orby_getGasSpentForInstances", [{ month, year, instanceNames }]);
|
33
|
+
if (code && message) {
|
34
|
+
console.error("[getGasSpentForInstances]", code, message);
|
35
|
+
return undefined;
|
36
|
+
}
|
37
|
+
return extractGasSpendForInstances(totalGasSpendForInstances);
|
38
|
+
}
|
39
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { LibraryRequest } from "../entities/library_request";
|
2
|
-
import { LIBRARY_TYPE } from "../enums";
|
1
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
2
|
+
import { LIBRARY_TYPE } from "../enums.js";
|
3
3
|
export declare class ApplicationActions extends LibraryRequest {
|
4
4
|
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
5
5
|
isChainAbstractionCompatible(appDomainUrl: string): Promise<boolean>;
|
@@ -1,79 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
-
return extendStatics(d, b);
|
7
|
-
};
|
8
|
-
return function (d, b) {
|
9
|
-
if (typeof b !== "function" && b !== null)
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
-
extendStatics(d, b);
|
12
|
-
function __() { this.constructor = d; }
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
-
};
|
15
|
-
})();
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23
|
-
});
|
24
|
-
};
|
25
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
26
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
27
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
28
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
29
|
-
function step(op) {
|
30
|
-
if (f) throw new TypeError("Generator is already executing.");
|
31
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
32
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
33
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
34
|
-
switch (op[0]) {
|
35
|
-
case 0: case 1: t = op; break;
|
36
|
-
case 4: _.label++; return { value: op[1], done: false };
|
37
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
38
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
39
|
-
default:
|
40
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
41
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
42
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
43
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
44
|
-
if (t[2]) _.ops.pop();
|
45
|
-
_.trys.pop(); continue;
|
46
|
-
}
|
47
|
-
op = body.call(thisArg, _);
|
48
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
49
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
1
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
2
|
+
export class ApplicationActions extends LibraryRequest {
|
3
|
+
constructor(library, client, provider) {
|
4
|
+
super(library, client, provider);
|
50
5
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
6
|
+
async isChainAbstractionCompatible(appDomainUrl) {
|
7
|
+
const { isChainAbstractionCompatible, code, message } = await this.sendRequest("orby_isChainAbstractionCompatible", [
|
8
|
+
{ appDomainUrl },
|
9
|
+
]);
|
10
|
+
if (code && message) {
|
11
|
+
console.error("[isChainAbstractionCompatible]", code, message);
|
12
|
+
return undefined;
|
13
|
+
}
|
14
|
+
return isChainAbstractionCompatible;
|
57
15
|
}
|
58
|
-
|
59
|
-
return __awaiter(this, void 0, void 0, function () {
|
60
|
-
var _a, isChainAbstractionCompatible, code, message;
|
61
|
-
return __generator(this, function (_b) {
|
62
|
-
switch (_b.label) {
|
63
|
-
case 0: return [4 /*yield*/, this.sendRequest("orby_isChainAbstractionCompatible", [
|
64
|
-
{ appDomainUrl: appDomainUrl },
|
65
|
-
])];
|
66
|
-
case 1:
|
67
|
-
_a = _b.sent(), isChainAbstractionCompatible = _a.isChainAbstractionCompatible, code = _a.code, message = _a.message;
|
68
|
-
if (code && message) {
|
69
|
-
console.error("[isChainAbstractionCompatible]", code, message);
|
70
|
-
return [2 /*return*/, undefined];
|
71
|
-
}
|
72
|
-
return [2 /*return*/, isChainAbstractionCompatible];
|
73
|
-
}
|
74
|
-
});
|
75
|
-
});
|
76
|
-
};
|
77
|
-
return ApplicationActions;
|
78
|
-
}(LibraryRequest));
|
79
|
-
export { ApplicationActions };
|
16
|
+
}
|
@@ -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,35 @@
|
|
1
|
+
import { extractBlockchainInformation, extractBlockchainInformations, } from "../utils/action_helpers.js";
|
2
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
3
|
+
import { getOrbyChainId } from "../utils/utils.js";
|
4
|
+
export class BlockchainActions extends LibraryRequest {
|
5
|
+
constructor(library, client, provider) {
|
6
|
+
super(library, client, provider);
|
7
|
+
}
|
8
|
+
async getBlockchainInformation(chainId) {
|
9
|
+
const { blockchain, code, message } = await this.sendRequest("orby_getBlockchainInformation", [{ chainId: getOrbyChainId(chainId) }]);
|
10
|
+
if (code && message) {
|
11
|
+
console.error("[getBlockchainInformation]", code, message);
|
12
|
+
return undefined;
|
13
|
+
}
|
14
|
+
return extractBlockchainInformation(blockchain);
|
15
|
+
}
|
16
|
+
async listBlockchainsInformation(offset, limit) {
|
17
|
+
const { pageInfo, blockchains, code, message } = await this.sendRequest("orby_listBlockchainsInformation", [{ offset, limit }]);
|
18
|
+
if (code && message) {
|
19
|
+
console.error("[listBlockchainsInformation]", code, message);
|
20
|
+
return undefined;
|
21
|
+
}
|
22
|
+
return {
|
23
|
+
blockchains: extractBlockchainInformations(blockchains),
|
24
|
+
pageInfo,
|
25
|
+
};
|
26
|
+
}
|
27
|
+
async getChainsSupportedByDefault() {
|
28
|
+
const { blockchains, code, message } = await this.sendRequest("orby_getChainsSupportedByDefault", []);
|
29
|
+
if (code && message) {
|
30
|
+
console.error("[getChainsSupportedByDefault]", code, message);
|
31
|
+
return undefined;
|
32
|
+
}
|
33
|
+
return extractBlockchainInformations(blockchains);
|
34
|
+
}
|
35
|
+
}
|
@@ -1,12 +1,11 @@
|
|
1
|
-
import {
|
2
|
-
import { LIBRARY_TYPE } from "../enums";
|
3
|
-
import { LibraryRequest } from "../entities/library_request";
|
1
|
+
import { ChainEndpoint, GasSponsorshipPolicy } from "../types.js";
|
2
|
+
import { LIBRARY_TYPE } from "../enums.js";
|
3
|
+
import { LibraryRequest } from "../entities/library_request.js";
|
4
4
|
export declare class InstanceActions extends LibraryRequest {
|
5
5
|
constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
|
6
6
|
setCustomChainEndpointsForInstance(chainEndpoints: ChainEndpoint[]): Promise<boolean>;
|
7
7
|
removeCustomChainEndpointForInstance(chainIds: bigint[]): Promise<boolean>;
|
8
8
|
getCustomChainEndpointsForInstance(returnChainIdsOnly: boolean): Promise<boolean>;
|
9
|
-
getChainsSupportedByDefault(): Promise<BlockchainInformation[]>;
|
10
9
|
enabledChainAbstractionForInstance(enable: boolean): Promise<boolean>;
|
11
10
|
enableGasSponsorshipForInstance(enable: boolean): Promise<boolean>;
|
12
11
|
getGasSponsorForInstance(): Promise<string>;
|