@super-protocol/sdk-js 0.7.1-beta.7 → 0.8.0-beta.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/build/BlockchainConnector.d.ts +14 -1
- package/build/BlockchainConnector.js +39 -0
- package/build/staticModels/OffersFactory.d.ts +4 -4
- package/build/staticModels/OffersFactory.js +12 -3
- package/build/staticModels/OrdersFactory.d.ts +13 -13
- package/build/staticModels/OrdersFactory.js +48 -12
- package/build/staticModels/ProviderRegistry.d.ts +6 -6
- package/build/staticModels/ProviderRegistry.js +20 -5
- package/build/staticModels/TeeOffersFactory.d.ts +3 -3
- package/build/staticModels/TeeOffersFactory.js +9 -3
- package/build/types/Web3.d.ts +6 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TransactionOptions, EventData } from "./types/Web3";
|
|
1
|
+
import { TransactionOptions, EventData, BlockInfo } from "./types/Web3";
|
|
2
2
|
import BlockchainTransaction from "./types/blockchainConnector/StorageAccess";
|
|
3
3
|
import { TransactionReceipt } from "web3-core";
|
|
4
4
|
declare class BlockchainConnector {
|
|
@@ -26,6 +26,18 @@ declare class BlockchainConnector {
|
|
|
26
26
|
* @returns {Promise<EventData[]>} - Transaction events info
|
|
27
27
|
*/
|
|
28
28
|
static getTransactionEvents(txHash: string): Promise<EventData[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Function for adding event listeners on TEE offer created event in TEE offers factory contract
|
|
31
|
+
* @param callback - function for processing created TEE offer
|
|
32
|
+
* @return unsubscribe - unsubscribe function from event
|
|
33
|
+
*/
|
|
34
|
+
static getLastBlockInfo(): Promise<BlockInfo>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns transactions reciept
|
|
37
|
+
* @param txHash - transaction hash
|
|
38
|
+
* @returns {Promise<TransactionReceipt>} - Transaction reciept
|
|
39
|
+
*/
|
|
40
|
+
static getTransactionReceipt(txHash: string): Promise<TransactionReceipt>;
|
|
29
41
|
/**
|
|
30
42
|
* Returns balance of blockchain platform tokens in wei
|
|
31
43
|
*/
|
|
@@ -51,6 +63,7 @@ declare class BlockchainConnector {
|
|
|
51
63
|
static getTransactions(addresses: string[], startBlock?: number, lastBlock?: number, batchSize?: number): Promise<BlockchainTransaction>;
|
|
52
64
|
static disconnect(): void;
|
|
53
65
|
}
|
|
66
|
+
export declare type onNewBlockCallback = (blockInfo: BlockInfo) => void;
|
|
54
67
|
export declare type Config = {
|
|
55
68
|
contractAddress: string;
|
|
56
69
|
blockchainUrl?: string;
|
|
@@ -193,6 +193,45 @@ var BlockchainConnector = /** @class */ (function () {
|
|
|
193
193
|
});
|
|
194
194
|
});
|
|
195
195
|
};
|
|
196
|
+
/**
|
|
197
|
+
* Function for adding event listeners on TEE offer created event in TEE offers factory contract
|
|
198
|
+
* @param callback - function for processing created TEE offer
|
|
199
|
+
* @return unsubscribe - unsubscribe function from event
|
|
200
|
+
*/
|
|
201
|
+
BlockchainConnector.getLastBlockInfo = function () {
|
|
202
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
203
|
+
var index, hash;
|
|
204
|
+
return __generator(this, function (_a) {
|
|
205
|
+
switch (_a.label) {
|
|
206
|
+
case 0:
|
|
207
|
+
(0, utils_1.checkIfInitialized)();
|
|
208
|
+
return [4 /*yield*/, store_1.default.web3.eth.getBlockNumber()];
|
|
209
|
+
case 1:
|
|
210
|
+
index = _a.sent();
|
|
211
|
+
return [4 /*yield*/, store_1.default.web3.eth.getBlock(index)];
|
|
212
|
+
case 2:
|
|
213
|
+
hash = (_a.sent()).hash;
|
|
214
|
+
return [2 /*return*/, {
|
|
215
|
+
index: index,
|
|
216
|
+
hash: hash,
|
|
217
|
+
}];
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Returns transactions reciept
|
|
224
|
+
* @param txHash - transaction hash
|
|
225
|
+
* @returns {Promise<TransactionReceipt>} - Transaction reciept
|
|
226
|
+
*/
|
|
227
|
+
BlockchainConnector.getTransactionReceipt = function (txHash) {
|
|
228
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
229
|
+
return __generator(this, function (_a) {
|
|
230
|
+
(0, utils_1.checkIfInitialized)();
|
|
231
|
+
return [2 /*return*/, store_1.default.web3.eth.getTransactionReceipt(txHash)];
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
};
|
|
196
235
|
/**
|
|
197
236
|
* Returns balance of blockchain platform tokens in wei
|
|
198
237
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OfferInfoV1, OfferType } from "../types/Offer";
|
|
2
|
-
import { TransactionOptions } from "../types/Web3";
|
|
2
|
+
import { BlockInfo, TransactionOptions } from "../types/Web3";
|
|
3
3
|
import { OfferCreatedEvent } from "../types/Events";
|
|
4
4
|
declare class OffersFactory {
|
|
5
5
|
private static contract;
|
|
@@ -31,7 +31,7 @@ declare class OffersFactory {
|
|
|
31
31
|
static onOfferEnabled(callback: onOfferEnabledCallback): () => void;
|
|
32
32
|
static onOfferDisabled(callback: onOfferDisbledCallback): () => void;
|
|
33
33
|
}
|
|
34
|
-
export declare type onOfferCreatedCallback = (id: string, creator: string, externalId: string) => void;
|
|
35
|
-
export declare type onOfferEnabledCallback = (providerAuth: string, id: string, offerType: OfferType) => void;
|
|
36
|
-
export declare type onOfferDisbledCallback = (providerAuth: string, id: string, offerType: OfferType) => void;
|
|
34
|
+
export declare type onOfferCreatedCallback = (id: string, creator: string, externalId: string, block?: BlockInfo) => void;
|
|
35
|
+
export declare type onOfferEnabledCallback = (providerAuth: string, id: string, offerType: OfferType, block?: BlockInfo) => void;
|
|
36
|
+
export declare type onOfferDisbledCallback = (providerAuth: string, id: string, offerType: OfferType, block?: BlockInfo) => void;
|
|
37
37
|
export default OffersFactory;
|
|
@@ -173,7 +173,10 @@ var OffersFactory = /** @class */ (function () {
|
|
|
173
173
|
.OfferCreated()
|
|
174
174
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
175
175
|
return __generator(this, function (_a) {
|
|
176
|
-
callback(event.returnValues.offerId, event.returnValues.creator, event.returnValues.externalId
|
|
176
|
+
callback(event.returnValues.offerId, event.returnValues.creator, event.returnValues.externalId, {
|
|
177
|
+
index: event.blockNumber,
|
|
178
|
+
hash: event.blockHash,
|
|
179
|
+
});
|
|
177
180
|
return [2 /*return*/];
|
|
178
181
|
});
|
|
179
182
|
}); })
|
|
@@ -192,7 +195,10 @@ var OffersFactory = /** @class */ (function () {
|
|
|
192
195
|
.OfferEnabled()
|
|
193
196
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
194
197
|
return __generator(this, function (_a) {
|
|
195
|
-
callback(event.returnValues.providerAuth, event.returnValues.offerId, event.returnValues.offerType
|
|
198
|
+
callback(event.returnValues.providerAuth, event.returnValues.offerId, event.returnValues.offerType, {
|
|
199
|
+
index: event.blockNumber,
|
|
200
|
+
hash: event.blockHash,
|
|
201
|
+
});
|
|
196
202
|
return [2 /*return*/];
|
|
197
203
|
});
|
|
198
204
|
}); })
|
|
@@ -211,7 +217,10 @@ var OffersFactory = /** @class */ (function () {
|
|
|
211
217
|
.OfferEnabled()
|
|
212
218
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
213
219
|
return __generator(this, function (_a) {
|
|
214
|
-
callback(event.returnValues.providerAuth, event.returnValues.offerId, event.returnValues.offerType
|
|
220
|
+
callback(event.returnValues.providerAuth, event.returnValues.offerId, event.returnValues.offerType, {
|
|
221
|
+
index: event.blockNumber,
|
|
222
|
+
hash: event.blockHash,
|
|
223
|
+
});
|
|
215
224
|
return [2 /*return*/];
|
|
216
225
|
});
|
|
217
226
|
}); })
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OrderInfo, OrderStatus } from "../types/Order";
|
|
2
|
-
import { TransactionOptions } from "../types/Web3";
|
|
2
|
+
import { BlockInfo, TransactionOptions } from "../types/Web3";
|
|
3
3
|
import { OrderCreatedEvent } from "../types/Events";
|
|
4
4
|
declare class OrdersFactory {
|
|
5
5
|
private static contract;
|
|
@@ -138,16 +138,16 @@ declare class OrdersFactory {
|
|
|
138
138
|
*/
|
|
139
139
|
static onOrderEncryptedResultUpdated(callback: onOrderEncryptedResultUpdatedCallback, consumer?: string, orderId?: string): () => void;
|
|
140
140
|
}
|
|
141
|
-
export declare type
|
|
142
|
-
export declare type
|
|
143
|
-
export declare type
|
|
144
|
-
export declare type
|
|
145
|
-
export declare type
|
|
146
|
-
export declare type
|
|
147
|
-
export declare type onOrderChangedWithdrawnCallback = (orderId: string, consumer: string, change: string) => void;
|
|
148
|
-
export declare type onOrderProfitWithdrawnCallback = (orderId: string, tokenReceiver: string, profit: string) => void;
|
|
149
|
-
export declare type onOrderDepositSpentChangedCallback = (orderId: string, consumer: string, spent: string) => void;
|
|
150
|
-
export declare type onOrderAwaitingPaymentChangedCallback = (orderId: string, consumer: string, awaitingPaymentFlag: boolean) => void;
|
|
151
|
-
export declare type onOrderEncryptedResultUpdatedCallback = (orderId: string, consumer: string, encryptedResult: string) => void;
|
|
152
|
-
export declare type onWorkflowCreatedCallback = (consumer: string, externalId: string, offerId: string, orderId: string) => void;
|
|
141
|
+
export declare type onSubOrderCreatedCallback = (parentOrderId: string, subOrderId: string, block?: BlockInfo) => void;
|
|
142
|
+
export declare type onOrderStartedCallback = (orderId: string, consumer: string, block?: BlockInfo) => void;
|
|
143
|
+
export declare type onOrdersStatusUpdatedCallback = (orderId: string, status: OrderStatus, block?: BlockInfo) => void;
|
|
144
|
+
export declare type onOrderPriceUpdatedCallback = (orderId: string, price: string, block?: BlockInfo) => void;
|
|
145
|
+
export declare type onOrderCreatedCallback = (consumer: string, externalId: string, offerId: string, orderId: string, block?: BlockInfo) => void;
|
|
146
|
+
export declare type onOrderDepositRefilledCallback = (orderId: string, consumer: string, amount: string, block?: BlockInfo) => void;
|
|
147
|
+
export declare type onOrderChangedWithdrawnCallback = (orderId: string, consumer: string, change: string, block?: BlockInfo) => void;
|
|
148
|
+
export declare type onOrderProfitWithdrawnCallback = (orderId: string, tokenReceiver: string, profit: string, block?: BlockInfo) => void;
|
|
149
|
+
export declare type onOrderDepositSpentChangedCallback = (orderId: string, consumer: string, spent: string, block?: BlockInfo) => void;
|
|
150
|
+
export declare type onOrderAwaitingPaymentChangedCallback = (orderId: string, consumer: string, awaitingPaymentFlag: boolean, block?: BlockInfo) => void;
|
|
151
|
+
export declare type onOrderEncryptedResultUpdatedCallback = (orderId: string, consumer: string, encryptedResult: string, block?: BlockInfo) => void;
|
|
152
|
+
export declare type onWorkflowCreatedCallback = (consumer: string, externalId: string, offerId: string, orderId: string, block?: BlockInfo) => void;
|
|
153
153
|
export default OrdersFactory;
|
|
@@ -252,7 +252,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
252
252
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
253
253
|
return __generator(this, function (_a) {
|
|
254
254
|
//consumer: string, externalId: string, offerId: string, orderId: string
|
|
255
|
-
callback(event.returnValues.consumer, (0, utils_2.parseBytes32String)(event.returnValues.externalId), event.returnValues.offerId, event.returnValues.orderId
|
|
255
|
+
callback(event.returnValues.consumer, (0, utils_2.parseBytes32String)(event.returnValues.externalId), event.returnValues.offerId, event.returnValues.orderId, {
|
|
256
|
+
index: event.blockNumber,
|
|
257
|
+
hash: event.blockHash,
|
|
258
|
+
});
|
|
256
259
|
return [2 /*return*/];
|
|
257
260
|
});
|
|
258
261
|
}); })
|
|
@@ -277,7 +280,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
277
280
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
278
281
|
return __generator(this, function (_a) {
|
|
279
282
|
//consumer: string, externalId: string, offerId: string, orderId: string
|
|
280
|
-
callback(event.returnValues.consumer, (0, utils_2.parseBytes32String)(event.returnValues.externalId), event.returnValues.offerId, event.returnValues.orderId
|
|
283
|
+
callback(event.returnValues.consumer, (0, utils_2.parseBytes32String)(event.returnValues.externalId), event.returnValues.offerId, event.returnValues.orderId, {
|
|
284
|
+
index: event.blockNumber,
|
|
285
|
+
hash: event.blockHash,
|
|
286
|
+
});
|
|
281
287
|
return [2 /*return*/];
|
|
282
288
|
});
|
|
283
289
|
}); })
|
|
@@ -305,7 +311,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
305
311
|
if (parentOrderId && event.returnValues.parentOrderId != parentOrderId) {
|
|
306
312
|
return [2 /*return*/];
|
|
307
313
|
}
|
|
308
|
-
callback(event.returnValues.parentOrderId, event.returnValues.subOrderId
|
|
314
|
+
callback(event.returnValues.parentOrderId, event.returnValues.subOrderId, {
|
|
315
|
+
index: event.blockNumber,
|
|
316
|
+
hash: event.blockHash,
|
|
317
|
+
});
|
|
309
318
|
return [2 /*return*/];
|
|
310
319
|
});
|
|
311
320
|
}); })
|
|
@@ -333,7 +342,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
333
342
|
if (orderId && event.returnValues.orderId != orderId) {
|
|
334
343
|
return [2 /*return*/];
|
|
335
344
|
}
|
|
336
|
-
callback(event.returnValues.orderId, event.returnValues.consumer
|
|
345
|
+
callback(event.returnValues.orderId, event.returnValues.consumer, {
|
|
346
|
+
index: event.blockNumber,
|
|
347
|
+
hash: event.blockHash,
|
|
348
|
+
});
|
|
337
349
|
return [2 /*return*/];
|
|
338
350
|
});
|
|
339
351
|
}); })
|
|
@@ -361,7 +373,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
361
373
|
if (orderId && event.returnValues.orderId != orderId) {
|
|
362
374
|
return [2 /*return*/];
|
|
363
375
|
}
|
|
364
|
-
callback(event.returnValues.orderId, event.returnValues.status
|
|
376
|
+
callback(event.returnValues.orderId, event.returnValues.status, {
|
|
377
|
+
index: event.blockNumber,
|
|
378
|
+
hash: event.blockHash,
|
|
379
|
+
});
|
|
365
380
|
return [2 /*return*/];
|
|
366
381
|
});
|
|
367
382
|
}); })
|
|
@@ -393,7 +408,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
393
408
|
if (consumer && event.returnValues.consumer != consumer) {
|
|
394
409
|
return [2 /*return*/];
|
|
395
410
|
}
|
|
396
|
-
callback(event.returnValues.orderId, event.returnValues.consumer, event.returnValues.amount
|
|
411
|
+
callback(event.returnValues.orderId, event.returnValues.consumer, event.returnValues.amount, {
|
|
412
|
+
index: event.blockNumber,
|
|
413
|
+
hash: event.blockHash,
|
|
414
|
+
});
|
|
397
415
|
return [2 /*return*/];
|
|
398
416
|
});
|
|
399
417
|
}); })
|
|
@@ -421,7 +439,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
421
439
|
if (orderId && event.returnValues.orderId != orderId) {
|
|
422
440
|
return [2 /*return*/];
|
|
423
441
|
}
|
|
424
|
-
callback(event.returnValues.orderId, event.returnValues.price
|
|
442
|
+
callback(event.returnValues.orderId, event.returnValues.price, {
|
|
443
|
+
index: event.blockNumber,
|
|
444
|
+
hash: event.blockHash,
|
|
445
|
+
});
|
|
425
446
|
return [2 /*return*/];
|
|
426
447
|
});
|
|
427
448
|
}); })
|
|
@@ -449,7 +470,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
449
470
|
if (orderId && event.returnValues.orderId != orderId) {
|
|
450
471
|
return [2 /*return*/];
|
|
451
472
|
}
|
|
452
|
-
callback(event.returnValues.orderId, event.returnValues.consumer, event.returnValues.change
|
|
473
|
+
callback(event.returnValues.orderId, event.returnValues.consumer, event.returnValues.change, {
|
|
474
|
+
index: event.blockNumber,
|
|
475
|
+
hash: event.blockHash,
|
|
476
|
+
});
|
|
453
477
|
return [2 /*return*/];
|
|
454
478
|
});
|
|
455
479
|
}); })
|
|
@@ -481,7 +505,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
481
505
|
if (tokenReceiver && event.returnValues.tokenReceiver != tokenReceiver) {
|
|
482
506
|
return [2 /*return*/];
|
|
483
507
|
}
|
|
484
|
-
callback(event.returnValues.orderId, event.returnValues.tokenReceiver, event.returnValues.profit
|
|
508
|
+
callback(event.returnValues.orderId, event.returnValues.tokenReceiver, event.returnValues.profit, {
|
|
509
|
+
index: event.blockNumber,
|
|
510
|
+
hash: event.blockHash,
|
|
511
|
+
});
|
|
485
512
|
return [2 /*return*/];
|
|
486
513
|
});
|
|
487
514
|
}); })
|
|
@@ -513,7 +540,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
513
540
|
if (consumer && event.returnValues.consumer != consumer) {
|
|
514
541
|
return [2 /*return*/];
|
|
515
542
|
}
|
|
516
|
-
callback(event.returnValues.orderId, event.returnValues.consumer, event.returnValues.awaitingPayment
|
|
543
|
+
callback(event.returnValues.orderId, event.returnValues.consumer, event.returnValues.awaitingPayment, {
|
|
544
|
+
index: event.blockNumber,
|
|
545
|
+
hash: event.blockHash,
|
|
546
|
+
});
|
|
517
547
|
return [2 /*return*/];
|
|
518
548
|
});
|
|
519
549
|
}); })
|
|
@@ -545,7 +575,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
545
575
|
if (consumer && event.returnValues.consumer != consumer) {
|
|
546
576
|
return [2 /*return*/];
|
|
547
577
|
}
|
|
548
|
-
callback(event.returnValues.orderId, event.returnValues.consumer, event.returnValues.value
|
|
578
|
+
callback(event.returnValues.orderId, event.returnValues.consumer, event.returnValues.value, {
|
|
579
|
+
index: event.blockNumber,
|
|
580
|
+
hash: event.blockHash,
|
|
581
|
+
});
|
|
549
582
|
return [2 /*return*/];
|
|
550
583
|
});
|
|
551
584
|
}); })
|
|
@@ -577,7 +610,10 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
577
610
|
if (consumer && event.returnValues.consumer != consumer) {
|
|
578
611
|
return [2 /*return*/];
|
|
579
612
|
}
|
|
580
|
-
callback(event.returnValues.orderId, event.returnValues.consumer, event.returnValues.encryptedResult
|
|
613
|
+
callback(event.returnValues.orderId, event.returnValues.consumer, event.returnValues.encryptedResult, {
|
|
614
|
+
index: event.blockNumber,
|
|
615
|
+
hash: event.blockHash,
|
|
616
|
+
});
|
|
581
617
|
return [2 /*return*/];
|
|
582
618
|
});
|
|
583
619
|
}); })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProviderInfo } from "../types/Provider";
|
|
2
2
|
import { BigNumber } from "ethers";
|
|
3
|
-
import { TransactionOptions } from "../types/Web3";
|
|
3
|
+
import { BlockInfo, TransactionOptions } from "../types/Web3";
|
|
4
4
|
declare class ProviderRegistry {
|
|
5
5
|
private static contract;
|
|
6
6
|
private static logger;
|
|
@@ -74,9 +74,9 @@ declare class ProviderRegistry {
|
|
|
74
74
|
*/
|
|
75
75
|
static onProviderSecurityDepoUnlocked(callback: onProviderSecurityDepoUnlockedCallback): () => void;
|
|
76
76
|
}
|
|
77
|
-
export declare type onProviderRegisteredCallback = (address: string) => void;
|
|
78
|
-
export declare type onProviderModifiedCallback = (address: string) => void;
|
|
79
|
-
export declare type
|
|
80
|
-
export declare type
|
|
81
|
-
export declare type
|
|
77
|
+
export declare type onProviderRegisteredCallback = (address: string, block?: BlockInfo) => void;
|
|
78
|
+
export declare type onProviderModifiedCallback = (address: string, block?: BlockInfo) => void;
|
|
79
|
+
export declare type onProviderSecurityDepoRefilledCallback = (address: string, amount: string, block?: BlockInfo) => void;
|
|
80
|
+
export declare type onProviderSecurityDepoUnlockedCallback = (address: string, amount: string, block?: BlockInfo) => void;
|
|
81
|
+
export declare type onProviderViolationRateIncrementedCallback = (address: string, newViolationRate: BigNumber, block?: BlockInfo) => void;
|
|
82
82
|
export default ProviderRegistry;
|
|
@@ -210,7 +210,10 @@ var ProviderRegistry = /** @class */ (function () {
|
|
|
210
210
|
.ProviderRegistred()
|
|
211
211
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
212
212
|
return __generator(this, function (_a) {
|
|
213
|
-
callback(event.returnValues.providerInfo
|
|
213
|
+
callback(event.returnValues.providerInfo, {
|
|
214
|
+
index: event.blockNumber,
|
|
215
|
+
hash: event.blockHash,
|
|
216
|
+
});
|
|
214
217
|
return [2 /*return*/];
|
|
215
218
|
});
|
|
216
219
|
}); })
|
|
@@ -234,7 +237,10 @@ var ProviderRegistry = /** @class */ (function () {
|
|
|
234
237
|
.ProviderModified()
|
|
235
238
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
236
239
|
return __generator(this, function (_a) {
|
|
237
|
-
callback(event.returnValues.auth
|
|
240
|
+
callback(event.returnValues.auth, {
|
|
241
|
+
index: event.blockNumber,
|
|
242
|
+
hash: event.blockHash,
|
|
243
|
+
});
|
|
238
244
|
return [2 /*return*/];
|
|
239
245
|
});
|
|
240
246
|
}); })
|
|
@@ -258,7 +264,10 @@ var ProviderRegistry = /** @class */ (function () {
|
|
|
258
264
|
.ProviderViolationRateIncremented()
|
|
259
265
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
260
266
|
return __generator(this, function (_a) {
|
|
261
|
-
callback(event.returnValues.auth, event.returnValues.newViolationRate
|
|
267
|
+
callback(event.returnValues.auth, event.returnValues.newViolationRate, {
|
|
268
|
+
index: event.blockNumber,
|
|
269
|
+
hash: event.blockHash,
|
|
270
|
+
});
|
|
262
271
|
return [2 /*return*/];
|
|
263
272
|
});
|
|
264
273
|
}); })
|
|
@@ -282,7 +291,10 @@ var ProviderRegistry = /** @class */ (function () {
|
|
|
282
291
|
.ProviderSecurityDepoRefilled()
|
|
283
292
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
284
293
|
return __generator(this, function (_a) {
|
|
285
|
-
callback(event.returnValues.auth, event.returnValues.amount
|
|
294
|
+
callback(event.returnValues.auth, event.returnValues.amount, {
|
|
295
|
+
index: event.blockNumber,
|
|
296
|
+
hash: event.blockHash,
|
|
297
|
+
});
|
|
286
298
|
return [2 /*return*/];
|
|
287
299
|
});
|
|
288
300
|
}); })
|
|
@@ -306,7 +318,10 @@ var ProviderRegistry = /** @class */ (function () {
|
|
|
306
318
|
.ProviderSecurityDepoUnlocked()
|
|
307
319
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
308
320
|
return __generator(this, function (_a) {
|
|
309
|
-
callback(event.returnValues.auth, event.returnValues.amount
|
|
321
|
+
callback(event.returnValues.auth, event.returnValues.amount, {
|
|
322
|
+
index: event.blockNumber,
|
|
323
|
+
hash: event.blockHash,
|
|
324
|
+
});
|
|
310
325
|
return [2 /*return*/];
|
|
311
326
|
});
|
|
312
327
|
}); })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TransactionOptions } from "../types/Web3";
|
|
1
|
+
import { BlockInfo, TransactionOptions } from "../types/Web3";
|
|
2
2
|
import { TeeOfferInfo } from "../types/TeeOffer";
|
|
3
3
|
import { OfferType } from "../types/Offer";
|
|
4
4
|
import { OfferCreatedEvent } from "../types/Events";
|
|
@@ -31,6 +31,6 @@ declare class TeeOffersFactory {
|
|
|
31
31
|
static onTeeOfferCreated(callback: onTeeOfferCreatedCallback): () => void;
|
|
32
32
|
static onTeeOfferViolationRateChanged(callback: onTeeOfferViolationRateChangedCallback): () => void;
|
|
33
33
|
}
|
|
34
|
-
export declare type onTeeOfferCreatedCallback = (offerId: string, providerAuth: string, offerType: OfferType) => void;
|
|
35
|
-
export declare type onTeeOfferViolationRateChangedCallback = (offerId: string, providerAuth: string, violationRate: number) => void;
|
|
34
|
+
export declare type onTeeOfferCreatedCallback = (offerId: string, providerAuth: string, offerType: OfferType, block?: BlockInfo) => void;
|
|
35
|
+
export declare type onTeeOfferViolationRateChangedCallback = (offerId: string, providerAuth: string, violationRate: number, block?: BlockInfo) => void;
|
|
36
36
|
export default TeeOffersFactory;
|
|
@@ -171,7 +171,10 @@ var TeeOffersFactory = /** @class */ (function () {
|
|
|
171
171
|
.OfferCreated()
|
|
172
172
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
173
173
|
return __generator(this, function (_a) {
|
|
174
|
-
callback(event.returnValues.offerId, event.returnValues.providerAuth, event.returnValues.offerType
|
|
174
|
+
callback(event.returnValues.offerId, event.returnValues.providerAuth, event.returnValues.offerType, {
|
|
175
|
+
index: event.blockNumber,
|
|
176
|
+
hash: event.blockHash,
|
|
177
|
+
});
|
|
175
178
|
return [2 /*return*/];
|
|
176
179
|
});
|
|
177
180
|
}); })
|
|
@@ -187,10 +190,13 @@ var TeeOffersFactory = /** @class */ (function () {
|
|
|
187
190
|
this.checkInit();
|
|
188
191
|
var logger = this.logger.child({ method: "onTeeOfferViolationRateChanged" });
|
|
189
192
|
var subscription = this.contract.events
|
|
190
|
-
.
|
|
193
|
+
.TeeOfferViolationRateChanged()
|
|
191
194
|
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
192
195
|
return __generator(this, function (_a) {
|
|
193
|
-
callback(event.returnValues.offerId, event.returnValues.providerAuth, event.returnValues.violationRate
|
|
196
|
+
callback(event.returnValues.offerId, event.returnValues.providerAuth, event.returnValues.violationRate, {
|
|
197
|
+
index: event.blockNumber,
|
|
198
|
+
hash: event.blockHash,
|
|
199
|
+
});
|
|
194
200
|
return [2 /*return*/];
|
|
195
201
|
});
|
|
196
202
|
}); })
|
package/build/types/Web3.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import Web3 from "web3";
|
|
2
2
|
export declare type ContractEvent = {
|
|
3
|
+
blockHash: string;
|
|
4
|
+
blockNumber: number;
|
|
3
5
|
returnValues: {
|
|
4
6
|
[key: string]: unknown;
|
|
5
7
|
};
|
|
6
8
|
};
|
|
9
|
+
export declare type BlockInfo = {
|
|
10
|
+
index: number;
|
|
11
|
+
hash: string;
|
|
12
|
+
};
|
|
7
13
|
export declare type EventData = {
|
|
8
14
|
contract: string;
|
|
9
15
|
name: string;
|