@super-protocol/sdk-js 0.7.1-beta.4 → 0.7.1-beta.7
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.
|
@@ -30,6 +30,13 @@ declare class BlockchainConnector {
|
|
|
30
30
|
* Returns balance of blockchain platform tokens in wei
|
|
31
31
|
*/
|
|
32
32
|
static transfer(to: string, amount: string, transactionOptions?: TransactionOptions): Promise<TransactionReceipt>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns transactions count
|
|
35
|
+
* @param address - wallet address
|
|
36
|
+
* @returns {Promise<number>} - Transactions count
|
|
37
|
+
*/
|
|
38
|
+
static getTransactionCount(address: string, status?: string): Promise<number>;
|
|
39
|
+
static getAddressByKey(pk: string): string;
|
|
33
40
|
/**
|
|
34
41
|
* Fetch transactions for specific addresses starting with specific block until last block
|
|
35
42
|
* @param addresses - array of addresses to fetch transactions (from these addresses and to these addresses)
|
|
@@ -59,6 +59,7 @@ var Superpro_1 = __importDefault(require("./staticModels/Superpro"));
|
|
|
59
59
|
var SuperproToken_1 = __importDefault(require("./staticModels/SuperproToken"));
|
|
60
60
|
var TxManager_1 = __importDefault(require("./utils/TxManager"));
|
|
61
61
|
var app_json_1 = __importDefault(require("./contracts/app.json"));
|
|
62
|
+
var ethers_1 = require("ethers");
|
|
62
63
|
var BlockchainConnector = /** @class */ (function () {
|
|
63
64
|
function BlockchainConnector() {
|
|
64
65
|
}
|
|
@@ -209,6 +210,28 @@ var BlockchainConnector = /** @class */ (function () {
|
|
|
209
210
|
});
|
|
210
211
|
});
|
|
211
212
|
};
|
|
213
|
+
/**
|
|
214
|
+
* Returns transactions count
|
|
215
|
+
* @param address - wallet address
|
|
216
|
+
* @returns {Promise<number>} - Transactions count
|
|
217
|
+
*/
|
|
218
|
+
BlockchainConnector.getTransactionCount = function (address, status) {
|
|
219
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
+
return __generator(this, function (_a) {
|
|
221
|
+
(0, utils_1.checkIfInitialized)();
|
|
222
|
+
if (status) {
|
|
223
|
+
return [2 /*return*/, store_1.default.web3.eth.getTransactionCount(address, status)];
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
return [2 /*return*/, store_1.default.web3.eth.getTransactionCount(address)];
|
|
227
|
+
}
|
|
228
|
+
return [2 /*return*/];
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
BlockchainConnector.getAddressByKey = function (pk) {
|
|
233
|
+
return new ethers_1.Wallet(pk).address;
|
|
234
|
+
};
|
|
212
235
|
/**
|
|
213
236
|
* Fetch transactions for specific addresses starting with specific block until last block
|
|
214
237
|
* @param addresses - array of addresses to fetch transactions (from these addresses and to these addresses)
|
|
@@ -42,7 +42,7 @@ declare class OrdersFactory {
|
|
|
42
42
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
43
43
|
* @returns {Promise<void>} - Does not return id of created order!
|
|
44
44
|
*/
|
|
45
|
-
static createWorkflow(perentOrderInfo: OrderInfo, subOrdersInfo: OrderInfo[], holdDeposit
|
|
45
|
+
static createWorkflow(perentOrderInfo: OrderInfo, subOrdersInfo: OrderInfo[], holdDeposit?: string, externalId?: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
46
46
|
/**
|
|
47
47
|
* Function for refilling order deposit
|
|
48
48
|
* @param orderId - order id
|
|
@@ -141,7 +141,7 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
141
141
|
* @returns {Promise<void>} - Does not return id of created order!
|
|
142
142
|
*/
|
|
143
143
|
OrdersFactory.createOrder = function (orderInfo, holdDeposit, suspended, externalId, transactionOptions) {
|
|
144
|
-
if (holdDeposit === void 0) { holdDeposit =
|
|
144
|
+
if (holdDeposit === void 0) { holdDeposit = "0"; }
|
|
145
145
|
if (suspended === void 0) { suspended = false; }
|
|
146
146
|
if (externalId === void 0) { externalId = "default"; }
|
|
147
147
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -178,8 +178,8 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
178
178
|
notFound = {
|
|
179
179
|
consumer: consumer,
|
|
180
180
|
externalId: externalId,
|
|
181
|
-
offerId:
|
|
182
|
-
orderId:
|
|
181
|
+
offerId: "-1",
|
|
182
|
+
orderId: "-1",
|
|
183
183
|
};
|
|
184
184
|
response = foundIds.length > 0 ? foundIds[0].returnValues : notFound;
|
|
185
185
|
return [2 /*return*/, response];
|
|
@@ -196,6 +196,7 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
196
196
|
* @returns {Promise<void>} - Does not return id of created order!
|
|
197
197
|
*/
|
|
198
198
|
OrdersFactory.createWorkflow = function (perentOrderInfo, subOrdersInfo, holdDeposit, externalId, transactionOptions) {
|
|
199
|
+
if (holdDeposit === void 0) { holdDeposit = "0"; }
|
|
199
200
|
if (externalId === void 0) { externalId = "default"; }
|
|
200
201
|
return __awaiter(this, void 0, void 0, function () {
|
|
201
202
|
var contract, perentOrderInfoArgs, formattedExternalId, subOrdersInfoArgs;
|