@super-protocol/sdk-js 0.10.2-beta.4 → 0.10.7-beta.0
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/build/BlockchainConnector.d.ts +3 -1
- package/build/BlockchainConnector.js +79 -58
- package/build/TIIGenerator.js +1 -1
- package/build/proto/Compression.d.ts +5 -3
- package/build/proto/Compression.js +23 -43
- package/build/proto/TRI.d.ts +18 -16
- package/build/proto/TRI.js +34 -54
- package/build/proto/TeeProperties.d.ts +263 -0
- package/build/proto/TeeProperties.js +406 -0
- package/build/store.d.ts +1 -0
- package/build/store.js +1 -0
- package/build/utils.d.ts +5 -0
- package/build/utils.js +10 -1
- package/package.json +2 -2
- package/readme.md +8 -15
|
@@ -6,6 +6,7 @@ declare class BlockchainConnector {
|
|
|
6
6
|
private static logger;
|
|
7
7
|
private static contract;
|
|
8
8
|
private static provider?;
|
|
9
|
+
private static providerHttps?;
|
|
9
10
|
static defaultActionAccount?: string;
|
|
10
11
|
private static initContracts;
|
|
11
12
|
static getContractInstance(transactionOptions?: TransactionOptions): Contract;
|
|
@@ -54,6 +55,7 @@ declare class BlockchainConnector {
|
|
|
54
55
|
*/
|
|
55
56
|
static getTransactionCount(address: string, status?: string): Promise<number>;
|
|
56
57
|
static getAddressByKey(pk: string): string;
|
|
58
|
+
private static executeBatchAsync;
|
|
57
59
|
/**
|
|
58
60
|
* Fetch transactions for specific addresses starting with specific block until last block
|
|
59
61
|
* @param addresses - array of addresses to fetch transactions (from these addresses and to these addresses)
|
|
@@ -68,10 +70,10 @@ declare class BlockchainConnector {
|
|
|
68
70
|
static getTransactions(addresses: string[], startBlock?: number, lastBlock?: number, batchSize?: number): Promise<BlockchainTransaction>;
|
|
69
71
|
static disconnect(): void;
|
|
70
72
|
}
|
|
71
|
-
export declare type onNewBlockCallback = (blockInfo: BlockInfo) => void;
|
|
72
73
|
export declare type Config = {
|
|
73
74
|
contractAddress: string;
|
|
74
75
|
blockchainUrl?: string;
|
|
76
|
+
blockchainHttpsUrl?: string;
|
|
75
77
|
gasPrice?: string;
|
|
76
78
|
gasLimit?: number;
|
|
77
79
|
gasLimitMultiplier?: number;
|
|
@@ -52,6 +52,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
var logger_1 = __importDefault(require("./logger"));
|
|
54
54
|
var web3_1 = __importDefault(require("web3"));
|
|
55
|
+
var web3_core_helpers_1 = require("web3-core-helpers");
|
|
55
56
|
var store_1 = __importDefault(require("./store"));
|
|
56
57
|
var constants_1 = require("./constants");
|
|
57
58
|
var utils_1 = require("./utils");
|
|
@@ -60,6 +61,7 @@ var SuperproToken_1 = __importDefault(require("./staticModels/SuperproToken"));
|
|
|
60
61
|
var TxManager_1 = __importDefault(require("./utils/TxManager"));
|
|
61
62
|
var app_json_1 = __importDefault(require("./contracts/app.json"));
|
|
62
63
|
var ethers_1 = require("ethers");
|
|
64
|
+
var Jsonrpc = require('web3-core-requestmanager/src/jsonrpc');
|
|
63
65
|
var BlockchainConnector = /** @class */ (function () {
|
|
64
66
|
function BlockchainConnector() {
|
|
65
67
|
}
|
|
@@ -90,6 +92,10 @@ var BlockchainConnector = /** @class */ (function () {
|
|
|
90
92
|
switch (_b.label) {
|
|
91
93
|
case 0:
|
|
92
94
|
url = (config === null || config === void 0 ? void 0 : config.blockchainUrl) || constants_1.defaultBlockchainUrl;
|
|
95
|
+
if (config === null || config === void 0 ? void 0 : config.blockchainHttpsUrl) {
|
|
96
|
+
this.providerHttps = new web3_1.default.providers.HttpProvider(config === null || config === void 0 ? void 0 : config.blockchainHttpsUrl);
|
|
97
|
+
store_1.default.web3Https = new web3_1.default(this.providerHttps);
|
|
98
|
+
}
|
|
93
99
|
if (this.provider) {
|
|
94
100
|
if (this.provider instanceof web3_1.default.providers.WebsocketProvider) {
|
|
95
101
|
this.provider.reset();
|
|
@@ -308,6 +314,32 @@ var BlockchainConnector = /** @class */ (function () {
|
|
|
308
314
|
BlockchainConnector.getAddressByKey = function (pk) {
|
|
309
315
|
return new ethers_1.Wallet(pk).address;
|
|
310
316
|
};
|
|
317
|
+
BlockchainConnector.executeBatchAsync = function (batch) {
|
|
318
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
319
|
+
return __generator(this, function (_a) {
|
|
320
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
321
|
+
var requests = batch.requests;
|
|
322
|
+
batch.requestManager.sendBatch(requests, function (error, results) {
|
|
323
|
+
if (error)
|
|
324
|
+
return reject(error);
|
|
325
|
+
results = results || [];
|
|
326
|
+
var response = requests.map(function (request, index) {
|
|
327
|
+
return results[index] || {};
|
|
328
|
+
}).map(function (result, index) {
|
|
329
|
+
if (result && result.error) {
|
|
330
|
+
return web3_core_helpers_1.errors.ErrorResponse(result);
|
|
331
|
+
}
|
|
332
|
+
if (!Jsonrpc.isValidResponse(result)) {
|
|
333
|
+
return web3_core_helpers_1.errors.InvalidResponse(result);
|
|
334
|
+
}
|
|
335
|
+
return requests[index].format ? requests[index].format(result.result) : result.result;
|
|
336
|
+
});
|
|
337
|
+
resolve(response);
|
|
338
|
+
});
|
|
339
|
+
})];
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
};
|
|
311
343
|
/**
|
|
312
344
|
* Fetch transactions for specific addresses starting with specific block until last block
|
|
313
345
|
* @param addresses - array of addresses to fetch transactions (from these addresses and to these addresses)
|
|
@@ -322,69 +354,56 @@ var BlockchainConnector = /** @class */ (function () {
|
|
|
322
354
|
BlockchainConnector.getTransactions = function (addresses, startBlock, lastBlock, batchSize) {
|
|
323
355
|
if (batchSize === void 0) { batchSize = constants_1.BLOCK_SIZE_TO_FETCH_TRANSACTION; }
|
|
324
356
|
return __awaiter(this, void 0, void 0, function () {
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
switch (_b.label) {
|
|
357
|
+
var blockchainLastBlock, transactionsByAddress, batch, getBlock, batchLastBlock, blockNumber, blocks;
|
|
358
|
+
return __generator(this, function (_a) {
|
|
359
|
+
switch (_a.label) {
|
|
329
360
|
case 0:
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
activeStep = blocksNumbersToFetch[0];
|
|
343
|
-
for (i = startBlock; i <= endBlock; i++) {
|
|
344
|
-
activeStep.push(i);
|
|
345
|
-
if (activeStep.length >= batchSize) {
|
|
346
|
-
blocksNumbersToFetch.push([]);
|
|
347
|
-
activeStep = blocksNumbersToFetch[blocksNumbersToFetch.length - 1];
|
|
348
|
-
}
|
|
361
|
+
(0, utils_1.checkIfHttpsInitialized)();
|
|
362
|
+
return [4 /*yield*/, store_1.default.web3Https.eth.getBlockNumber()];
|
|
363
|
+
case 1:
|
|
364
|
+
blockchainLastBlock = _a.sent();
|
|
365
|
+
if (lastBlock) {
|
|
366
|
+
lastBlock = Math.min(lastBlock, blockchainLastBlock);
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
lastBlock = blockchainLastBlock;
|
|
370
|
+
}
|
|
371
|
+
if (!startBlock) {
|
|
372
|
+
startBlock = Math.max(lastBlock - 1000, 0);
|
|
349
373
|
}
|
|
350
374
|
transactionsByAddress = {};
|
|
351
375
|
addresses.forEach(function (address) { return (transactionsByAddress[address] = []); });
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
_b.label = 6;
|
|
382
|
-
case 6:
|
|
383
|
-
i++;
|
|
384
|
-
return [3 /*break*/, 4];
|
|
385
|
-
case 7: return [2 /*return*/, {
|
|
376
|
+
_a.label = 2;
|
|
377
|
+
case 2:
|
|
378
|
+
if (!(startBlock <= lastBlock)) return [3 /*break*/, 4];
|
|
379
|
+
batch = new store_1.default.web3Https.eth.BatchRequest();
|
|
380
|
+
getBlock = store_1.default.web3Https.eth.getBlock;
|
|
381
|
+
batchLastBlock = Math.min(startBlock + batchSize - 1, lastBlock);
|
|
382
|
+
for (blockNumber = startBlock; blockNumber <= batchLastBlock; blockNumber++) {
|
|
383
|
+
batch.add(getBlock.request(blockNumber, true));
|
|
384
|
+
}
|
|
385
|
+
return [4 /*yield*/, this.executeBatchAsync(batch)];
|
|
386
|
+
case 3:
|
|
387
|
+
blocks = _a.sent();
|
|
388
|
+
blocks.forEach(function (block) {
|
|
389
|
+
if (!(block === null || block === void 0 ? void 0 : block.transactions))
|
|
390
|
+
return;
|
|
391
|
+
block.transactions.forEach(function (transaction) {
|
|
392
|
+
var address = null;
|
|
393
|
+
if (addresses.includes(transaction.from))
|
|
394
|
+
address = transaction.from;
|
|
395
|
+
else if (transaction.to && addresses.includes(transaction.to))
|
|
396
|
+
address = transaction.to;
|
|
397
|
+
if (address) {
|
|
398
|
+
transactionsByAddress[address].push(__assign(__assign({}, transaction), { timestamp: +block.timestamp * 1000, input: transaction.input }));
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
startBlock = batchLastBlock + 1;
|
|
403
|
+
return [3 /*break*/, 2];
|
|
404
|
+
case 4: return [2 /*return*/, {
|
|
386
405
|
transactionsByAddress: transactionsByAddress,
|
|
387
|
-
lastBlock:
|
|
406
|
+
lastBlock: lastBlock,
|
|
388
407
|
}];
|
|
389
408
|
}
|
|
390
409
|
});
|
|
@@ -393,6 +412,8 @@ var BlockchainConnector = /** @class */ (function () {
|
|
|
393
412
|
BlockchainConnector.disconnect = function () {
|
|
394
413
|
var _a;
|
|
395
414
|
(_a = this.provider) === null || _a === void 0 ? void 0 : _a.disconnect(0, "");
|
|
415
|
+
if (this.providerHttps)
|
|
416
|
+
this.providerHttps.disconnect();
|
|
396
417
|
store_1.default.isInitialized = false;
|
|
397
418
|
store_1.default.web3 = undefined;
|
|
398
419
|
};
|
package/build/TIIGenerator.js
CHANGED
|
@@ -82,7 +82,7 @@ var TIIGenerator = /** @class */ (function () {
|
|
|
82
82
|
mac = encryption.authTag || encryption.mac;
|
|
83
83
|
rawTri = {
|
|
84
84
|
solutionHashes: solutionHashes.map(function (hash) { return ({
|
|
85
|
-
|
|
85
|
+
algo: hash.algo,
|
|
86
86
|
hash: Buffer.from(hash.hash, hash.encoding),
|
|
87
87
|
}); }),
|
|
88
88
|
mrenclave: Buffer.from(linkage.mrenclave, linkage.encoding),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _m0 from "protobufjs/minimal";
|
|
2
2
|
export declare const protobufPackage = "";
|
|
3
3
|
export interface Compression {
|
|
4
4
|
type: Compression_TYPE;
|
|
@@ -20,7 +20,7 @@ export declare const Compression: {
|
|
|
20
20
|
} & {
|
|
21
21
|
type?: Compression_TYPE | undefined;
|
|
22
22
|
data?: Uint8Array | undefined;
|
|
23
|
-
} &
|
|
23
|
+
} & { [K in Exclude<keyof I, keyof Compression>]: never; }>(object: I): Compression;
|
|
24
24
|
};
|
|
25
25
|
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
26
26
|
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
@@ -29,5 +29,7 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
29
29
|
declare type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
30
30
|
export declare type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
31
31
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
32
|
-
} &
|
|
32
|
+
} & {
|
|
33
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
34
|
+
};
|
|
33
35
|
export {};
|
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.Compression = exports.compression_TYPEToJSON = exports.compression_TYPEFromJSON = exports.Compression_TYPE = exports.protobufPackage = void 0;
|
|
30
7
|
/* eslint-disable */
|
|
31
|
-
var
|
|
32
|
-
var _m0 = __importStar(require("protobufjs/minimal"));
|
|
8
|
+
var minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
33
9
|
exports.protobufPackage = "";
|
|
34
10
|
var Compression_TYPE;
|
|
35
11
|
(function (Compression_TYPE) {
|
|
@@ -59,7 +35,7 @@ function createBaseCompression() {
|
|
|
59
35
|
}
|
|
60
36
|
exports.Compression = {
|
|
61
37
|
encode: function (message, writer) {
|
|
62
|
-
if (writer === void 0) { writer =
|
|
38
|
+
if (writer === void 0) { writer = minimal_1.default.Writer.create(); }
|
|
63
39
|
if (message.type !== 0) {
|
|
64
40
|
writer.uint32(8).int32(message.type);
|
|
65
41
|
}
|
|
@@ -69,7 +45,7 @@ exports.Compression = {
|
|
|
69
45
|
return writer;
|
|
70
46
|
},
|
|
71
47
|
decode: function (input, length) {
|
|
72
|
-
var reader = input instanceof
|
|
48
|
+
var reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
73
49
|
var end = length === undefined ? reader.len : reader.pos + length;
|
|
74
50
|
var message = createBaseCompression();
|
|
75
51
|
while (reader.pos < end) {
|
|
@@ -120,26 +96,30 @@ var globalThis = (function () {
|
|
|
120
96
|
return global;
|
|
121
97
|
throw "Unable to locate global object";
|
|
122
98
|
})();
|
|
123
|
-
var atob = globalThis.atob || (function (b64) { return globalThis.Buffer.from(b64, "base64").toString("binary"); });
|
|
124
99
|
function bytesFromBase64(b64) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
100
|
+
if (globalThis.Buffer) {
|
|
101
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
var bin = globalThis.atob(b64);
|
|
105
|
+
var arr = new Uint8Array(bin.length);
|
|
106
|
+
for (var i = 0; i < bin.length; ++i) {
|
|
107
|
+
arr[i] = bin.charCodeAt(i);
|
|
108
|
+
}
|
|
109
|
+
return arr;
|
|
129
110
|
}
|
|
130
|
-
return arr;
|
|
131
111
|
}
|
|
132
|
-
var btoa = globalThis.btoa || (function (bin) { return globalThis.Buffer.from(bin, "binary").toString("base64"); });
|
|
133
112
|
function base64FromBytes(arr) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
113
|
+
if (globalThis.Buffer) {
|
|
114
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
var bin_1 = [];
|
|
118
|
+
arr.forEach(function (byte) {
|
|
119
|
+
bin_1.push(String.fromCharCode(byte));
|
|
120
|
+
});
|
|
121
|
+
return globalThis.btoa(bin_1.join(""));
|
|
122
|
+
}
|
|
143
123
|
}
|
|
144
124
|
function isSet(value) {
|
|
145
125
|
return value !== null && value !== undefined;
|
package/build/proto/TRI.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _m0 from "protobufjs/minimal";
|
|
2
2
|
export declare const protobufPackage = "";
|
|
3
3
|
export interface Encryption {
|
|
4
4
|
algo: string;
|
|
@@ -10,7 +10,7 @@ export interface Encryption {
|
|
|
10
10
|
encoding: string;
|
|
11
11
|
}
|
|
12
12
|
export interface Hash {
|
|
13
|
-
|
|
13
|
+
algo: string;
|
|
14
14
|
hash: Uint8Array;
|
|
15
15
|
}
|
|
16
16
|
export interface TRI {
|
|
@@ -40,7 +40,7 @@ export declare const Encryption: {
|
|
|
40
40
|
iv?: Uint8Array | undefined;
|
|
41
41
|
mac?: Uint8Array | undefined;
|
|
42
42
|
encoding?: string | undefined;
|
|
43
|
-
} &
|
|
43
|
+
} & { [K in Exclude<keyof I, keyof Encryption>]: never; }>(object: I): Encryption;
|
|
44
44
|
};
|
|
45
45
|
export declare const Hash: {
|
|
46
46
|
encode(message: Hash, writer?: _m0.Writer): _m0.Writer;
|
|
@@ -48,12 +48,12 @@ export declare const Hash: {
|
|
|
48
48
|
fromJSON(object: any): Hash;
|
|
49
49
|
toJSON(message: Hash): unknown;
|
|
50
50
|
fromPartial<I extends {
|
|
51
|
-
|
|
51
|
+
algo?: string | undefined;
|
|
52
52
|
hash?: Uint8Array | undefined;
|
|
53
53
|
} & {
|
|
54
|
-
|
|
54
|
+
algo?: string | undefined;
|
|
55
55
|
hash?: Uint8Array | undefined;
|
|
56
|
-
} &
|
|
56
|
+
} & { [K in Exclude<keyof I, keyof Hash>]: never; }>(object: I): Hash;
|
|
57
57
|
};
|
|
58
58
|
export declare const TRI: {
|
|
59
59
|
encode(message: TRI, writer?: _m0.Writer): _m0.Writer;
|
|
@@ -62,7 +62,7 @@ export declare const TRI: {
|
|
|
62
62
|
toJSON(message: TRI): unknown;
|
|
63
63
|
fromPartial<I extends {
|
|
64
64
|
solutionHashes?: {
|
|
65
|
-
|
|
65
|
+
algo?: string | undefined;
|
|
66
66
|
hash?: Uint8Array | undefined;
|
|
67
67
|
}[] | undefined;
|
|
68
68
|
mrenclave?: Uint8Array | undefined;
|
|
@@ -78,18 +78,18 @@ export declare const TRI: {
|
|
|
78
78
|
} | undefined;
|
|
79
79
|
} & {
|
|
80
80
|
solutionHashes?: ({
|
|
81
|
-
|
|
81
|
+
algo?: string | undefined;
|
|
82
82
|
hash?: Uint8Array | undefined;
|
|
83
83
|
}[] & ({
|
|
84
|
-
|
|
84
|
+
algo?: string | undefined;
|
|
85
85
|
hash?: Uint8Array | undefined;
|
|
86
86
|
} & {
|
|
87
|
-
|
|
87
|
+
algo?: string | undefined;
|
|
88
88
|
hash?: Uint8Array | undefined;
|
|
89
|
-
} &
|
|
90
|
-
|
|
89
|
+
} & { [K in Exclude<keyof I["solutionHashes"][number], keyof Hash>]: never; })[] & { [K_1 in Exclude<keyof I["solutionHashes"], keyof {
|
|
90
|
+
algo?: string | undefined;
|
|
91
91
|
hash?: Uint8Array | undefined;
|
|
92
|
-
}[]
|
|
92
|
+
}[]>]: never; }) | undefined;
|
|
93
93
|
mrenclave?: Uint8Array | undefined;
|
|
94
94
|
args?: string | undefined;
|
|
95
95
|
encryption?: ({
|
|
@@ -108,8 +108,8 @@ export declare const TRI: {
|
|
|
108
108
|
iv?: Uint8Array | undefined;
|
|
109
109
|
mac?: Uint8Array | undefined;
|
|
110
110
|
encoding?: string | undefined;
|
|
111
|
-
} &
|
|
112
|
-
} &
|
|
111
|
+
} & { [K_2 in Exclude<keyof I["encryption"], keyof Encryption>]: never; }) | undefined;
|
|
112
|
+
} & { [K_3 in Exclude<keyof I, keyof TRI>]: never; }>(object: I): TRI;
|
|
113
113
|
};
|
|
114
114
|
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
115
115
|
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
@@ -118,5 +118,7 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
118
118
|
declare type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
119
119
|
export declare type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
120
120
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
121
|
-
} &
|
|
121
|
+
} & {
|
|
122
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
123
|
+
};
|
|
122
124
|
export {};
|
package/build/proto/TRI.js
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.TRI = exports.Hash = exports.Encryption = exports.protobufPackage = void 0;
|
|
30
7
|
/* eslint-disable */
|
|
31
|
-
var
|
|
32
|
-
var _m0 = __importStar(require("protobufjs/minimal"));
|
|
8
|
+
var minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
33
9
|
exports.protobufPackage = "";
|
|
34
10
|
function createBaseEncryption() {
|
|
35
11
|
return {
|
|
@@ -44,7 +20,7 @@ function createBaseEncryption() {
|
|
|
44
20
|
}
|
|
45
21
|
exports.Encryption = {
|
|
46
22
|
encode: function (message, writer) {
|
|
47
|
-
if (writer === void 0) { writer =
|
|
23
|
+
if (writer === void 0) { writer = minimal_1.default.Writer.create(); }
|
|
48
24
|
if (message.algo !== "") {
|
|
49
25
|
writer.uint32(10).string(message.algo);
|
|
50
26
|
}
|
|
@@ -69,7 +45,7 @@ exports.Encryption = {
|
|
|
69
45
|
return writer;
|
|
70
46
|
},
|
|
71
47
|
decode: function (input, length) {
|
|
72
|
-
var reader = input instanceof
|
|
48
|
+
var reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
73
49
|
var end = length === undefined ? reader.len : reader.pos + length;
|
|
74
50
|
var message = createBaseEncryption();
|
|
75
51
|
while (reader.pos < end) {
|
|
@@ -140,13 +116,13 @@ exports.Encryption = {
|
|
|
140
116
|
},
|
|
141
117
|
};
|
|
142
118
|
function createBaseHash() {
|
|
143
|
-
return {
|
|
119
|
+
return { algo: "", hash: new Uint8Array() };
|
|
144
120
|
}
|
|
145
121
|
exports.Hash = {
|
|
146
122
|
encode: function (message, writer) {
|
|
147
|
-
if (writer === void 0) { writer =
|
|
148
|
-
if (message.
|
|
149
|
-
writer.uint32(10).string(message.
|
|
123
|
+
if (writer === void 0) { writer = minimal_1.default.Writer.create(); }
|
|
124
|
+
if (message.algo !== "") {
|
|
125
|
+
writer.uint32(10).string(message.algo);
|
|
150
126
|
}
|
|
151
127
|
if (message.hash.length !== 0) {
|
|
152
128
|
writer.uint32(18).bytes(message.hash);
|
|
@@ -154,14 +130,14 @@ exports.Hash = {
|
|
|
154
130
|
return writer;
|
|
155
131
|
},
|
|
156
132
|
decode: function (input, length) {
|
|
157
|
-
var reader = input instanceof
|
|
133
|
+
var reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
158
134
|
var end = length === undefined ? reader.len : reader.pos + length;
|
|
159
135
|
var message = createBaseHash();
|
|
160
136
|
while (reader.pos < end) {
|
|
161
137
|
var tag = reader.uint32();
|
|
162
138
|
switch (tag >>> 3) {
|
|
163
139
|
case 1:
|
|
164
|
-
message.
|
|
140
|
+
message.algo = reader.string();
|
|
165
141
|
break;
|
|
166
142
|
case 2:
|
|
167
143
|
message.hash = reader.bytes();
|
|
@@ -175,13 +151,13 @@ exports.Hash = {
|
|
|
175
151
|
},
|
|
176
152
|
fromJSON: function (object) {
|
|
177
153
|
return {
|
|
178
|
-
|
|
154
|
+
algo: isSet(object.algo) ? String(object.algo) : "",
|
|
179
155
|
hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(),
|
|
180
156
|
};
|
|
181
157
|
},
|
|
182
158
|
toJSON: function (message) {
|
|
183
159
|
var obj = {};
|
|
184
|
-
message.
|
|
160
|
+
message.algo !== undefined && (obj.algo = message.algo);
|
|
185
161
|
message.hash !== undefined &&
|
|
186
162
|
(obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array()));
|
|
187
163
|
return obj;
|
|
@@ -189,7 +165,7 @@ exports.Hash = {
|
|
|
189
165
|
fromPartial: function (object) {
|
|
190
166
|
var _a, _b;
|
|
191
167
|
var message = createBaseHash();
|
|
192
|
-
message.
|
|
168
|
+
message.algo = (_a = object.algo) !== null && _a !== void 0 ? _a : "";
|
|
193
169
|
message.hash = (_b = object.hash) !== null && _b !== void 0 ? _b : new Uint8Array();
|
|
194
170
|
return message;
|
|
195
171
|
},
|
|
@@ -199,7 +175,7 @@ function createBaseTRI() {
|
|
|
199
175
|
}
|
|
200
176
|
exports.TRI = {
|
|
201
177
|
encode: function (message, writer) {
|
|
202
|
-
if (writer === void 0) { writer =
|
|
178
|
+
if (writer === void 0) { writer = minimal_1.default.Writer.create(); }
|
|
203
179
|
for (var _i = 0, _a = message.solutionHashes; _i < _a.length; _i++) {
|
|
204
180
|
var v = _a[_i];
|
|
205
181
|
exports.Hash.encode(v, writer.uint32(10).fork()).ldelim();
|
|
@@ -216,7 +192,7 @@ exports.TRI = {
|
|
|
216
192
|
return writer;
|
|
217
193
|
},
|
|
218
194
|
decode: function (input, length) {
|
|
219
|
-
var reader = input instanceof
|
|
195
|
+
var reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
220
196
|
var end = length === undefined ? reader.len : reader.pos + length;
|
|
221
197
|
var message = createBaseTRI();
|
|
222
198
|
while (reader.pos < end) {
|
|
@@ -290,26 +266,30 @@ var globalThis = (function () {
|
|
|
290
266
|
return global;
|
|
291
267
|
throw "Unable to locate global object";
|
|
292
268
|
})();
|
|
293
|
-
var atob = globalThis.atob || (function (b64) { return globalThis.Buffer.from(b64, "base64").toString("binary"); });
|
|
294
269
|
function bytesFromBase64(b64) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
270
|
+
if (globalThis.Buffer) {
|
|
271
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
var bin = globalThis.atob(b64);
|
|
275
|
+
var arr = new Uint8Array(bin.length);
|
|
276
|
+
for (var i = 0; i < bin.length; ++i) {
|
|
277
|
+
arr[i] = bin.charCodeAt(i);
|
|
278
|
+
}
|
|
279
|
+
return arr;
|
|
299
280
|
}
|
|
300
|
-
return arr;
|
|
301
281
|
}
|
|
302
|
-
var btoa = globalThis.btoa || (function (bin) { return globalThis.Buffer.from(bin, "binary").toString("base64"); });
|
|
303
282
|
function base64FromBytes(arr) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
283
|
+
if (globalThis.Buffer) {
|
|
284
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
var bin_1 = [];
|
|
288
|
+
arr.forEach(function (byte) {
|
|
289
|
+
bin_1.push(String.fromCharCode(byte));
|
|
290
|
+
});
|
|
291
|
+
return globalThis.btoa(bin_1.join(""));
|
|
292
|
+
}
|
|
313
293
|
}
|
|
314
294
|
function isSet(value) {
|
|
315
295
|
return value !== null && value !== undefined;
|