apenft-js-tron 2.1.4 → 2.1.5-beta.2
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/dist/index.js +31 -8
- package/dist/src/config.js +34 -30
- package/dist/src/queryAPI/graphql/accountApi.js +141 -42
- package/dist/src/queryAPI/graphql/assetApi.js +193 -66
- package/dist/src/queryAPI/graphql/base.js +46 -34
- package/dist/src/queryAPI/graphql/collectionApi.js +141 -42
- package/dist/src/queryAPI/graphql/gql/account.js +16 -153
- package/dist/src/queryAPI/graphql/gql/asset.js +20 -281
- package/dist/src/queryAPI/graphql/gql/collection.js +16 -173
- package/dist/src/queryAPI/graphql/gql/fragments.js +17 -230
- package/dist/src/queryAPI/graphql/gql/ranking.js +11 -60
- package/dist/src/queryAPI/graphql/index.js +16 -10
- package/dist/src/queryAPI/graphql/rankingApi.js +76 -12
- package/dist/src/queryAPI/index.js +743 -390
- package/dist/src/queryAPI/restful/base.js +185 -102
- package/dist/src/queryAPI/restful/index.js +2 -1
- package/dist/src/queryAPI/restful/queryAPI.js +37 -15
- package/dist/src/schemas/common/ERC1155/index.js +87 -46
- package/dist/src/schemas/common/ERC20/index.js +84 -43
- package/dist/src/schemas/common/ERC721/index.js +83 -42
- package/dist/src/schemas/common/Element/exchange.js +22 -19
- package/dist/src/schemas/common/Element/registry.js +15 -12
- package/dist/src/schemas/common/ens.js +18 -10
- package/dist/src/schemas/index.js +60 -48
- package/dist/src/schemas/schemasFunctions.js +85 -62
- package/dist/src/schemas/shasta/index.js +7 -4
- package/dist/src/schemas/tron/index.js +7 -4
- package/dist/src/tokens/index.js +8 -5
- package/dist/src/tokens/shasta/index.js +4 -1
- package/dist/src/tokens/tron/index.js +4 -1
- package/dist/src/tradeAPI/account.js +525 -309
- package/dist/src/tradeAPI/approve.js +104 -45
- package/dist/src/tradeAPI/base.js +178 -91
- package/dist/src/tradeAPI/contractSchemas.js +302 -215
- package/dist/src/tradeAPI/contracts.js +78 -53
- package/dist/src/tradeAPI/index.js +338 -179
- package/dist/src/tradeAPI/nft.js +255 -123
- package/dist/src/tradeAPI/orders.js +238 -108
- package/dist/src/tradeAPI/ordersApi.js +208 -78
- package/dist/src/utils/Abi.js +96 -79
- package/dist/src/utils/PromiEvent.js +15 -10
- package/dist/src/utils/check.js +554 -290
- package/dist/src/utils/constants.js +36 -29
- package/dist/src/utils/error.js +37 -14
- package/dist/src/utils/fees.js +90 -81
- package/dist/src/utils/helper.js +319 -193
- package/dist/src/utils/makeOrder.js +410 -282
- package/dist/src/utils/types.js +52 -46
- package/dist/src/utils/utils.js +12 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APENFTError = exports.NULL_ADDRESS = exports.makeBigNumber = exports.getSchemaList = exports.toBaseUnitAmount = exports.AssetFactory = exports.Category = exports.AssetStatus = exports.AssetListCollectionTypes = exports.CollectionSortBy = exports.EventType = exports.CollectionTradeTrendFilterDays = exports.AssetSortBy = exports.OrderSide = exports.APENFTSchemaName = exports.MakeOrderType = exports.Network = exports.initApprove = exports.APENFTQuery = exports.APENFTOrders = void 0;
|
|
4
|
+
var index_1 = require("./src/tradeAPI/index");
|
|
5
|
+
Object.defineProperty(exports, "APENFTOrders", { enumerable: true, get: function () { return index_1.APENFTOrders; } });
|
|
6
|
+
var index_2 = require("./src/queryAPI/index");
|
|
7
|
+
Object.defineProperty(exports, "APENFTQuery", { enumerable: true, get: function () { return index_2.APENFTQuery; } });
|
|
8
|
+
var approve_1 = require("./src/tradeAPI/approve");
|
|
9
|
+
Object.defineProperty(exports, "initApprove", { enumerable: true, get: function () { return approve_1.initApprove; } });
|
|
10
|
+
var types_1 = require("./src/utils/types");
|
|
11
|
+
Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return types_1.Network; } });
|
|
12
|
+
Object.defineProperty(exports, "MakeOrderType", { enumerable: true, get: function () { return types_1.MakeOrderType; } });
|
|
13
|
+
Object.defineProperty(exports, "APENFTSchemaName", { enumerable: true, get: function () { return types_1.APENFTSchemaName; } });
|
|
14
|
+
Object.defineProperty(exports, "OrderSide", { enumerable: true, get: function () { return types_1.OrderSide; } });
|
|
15
|
+
Object.defineProperty(exports, "AssetSortBy", { enumerable: true, get: function () { return types_1.AssetSortBy; } });
|
|
16
|
+
Object.defineProperty(exports, "CollectionTradeTrendFilterDays", { enumerable: true, get: function () { return types_1.CollectionTradeTrendFilterDays; } });
|
|
17
|
+
Object.defineProperty(exports, "EventType", { enumerable: true, get: function () { return types_1.EventType; } });
|
|
18
|
+
Object.defineProperty(exports, "CollectionSortBy", { enumerable: true, get: function () { return types_1.CollectionSortBy; } });
|
|
19
|
+
Object.defineProperty(exports, "AssetListCollectionTypes", { enumerable: true, get: function () { return types_1.AssetListCollectionTypes; } });
|
|
20
|
+
Object.defineProperty(exports, "AssetStatus", { enumerable: true, get: function () { return types_1.AssetStatus; } });
|
|
21
|
+
Object.defineProperty(exports, "Category", { enumerable: true, get: function () { return types_1.Category; } });
|
|
22
|
+
var nft_1 = require("./src/tradeAPI/nft");
|
|
23
|
+
Object.defineProperty(exports, "AssetFactory", { enumerable: true, get: function () { return nft_1.AssetFactory; } });
|
|
6
24
|
// for APENFT market
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
var helper_1 = require("./src/utils/helper");
|
|
26
|
+
Object.defineProperty(exports, "toBaseUnitAmount", { enumerable: true, get: function () { return helper_1.toBaseUnitAmount; } });
|
|
27
|
+
Object.defineProperty(exports, "getSchemaList", { enumerable: true, get: function () { return helper_1.getSchemaList; } });
|
|
28
|
+
Object.defineProperty(exports, "makeBigNumber", { enumerable: true, get: function () { return helper_1.makeBigNumber; } });
|
|
29
|
+
var constants_1 = require("./src/utils/constants");
|
|
30
|
+
Object.defineProperty(exports, "NULL_ADDRESS", { enumerable: true, get: function () { return constants_1.NULL_ADDRESS; } });
|
|
31
|
+
var error_1 = require("./src/utils/error");
|
|
32
|
+
Object.defineProperty(exports, "APENFTError", { enumerable: true, get: function () { return error_1.APENFTError; } });
|
package/dist/src/config.js
CHANGED
|
@@ -1,44 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a, _b, _c, _d;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CONTRACTS_ADDRESSES = exports.SHASTA_CONTRACTS_ADDRESSES_BASE58 = exports.TRON_CONTRACTS_ADDRESSES_BASE58 = exports.GasLimitOffset = exports.GasPrice_NOW = exports.NULL_ADDRESS = exports.API_BASE_URL = exports.CHAIN = exports.ID_CHAINNAME = exports.HOST_CHAINNAME = exports.CHAIN_ID = void 0;
|
|
5
|
+
var types_1 = require("./utils/types");
|
|
6
|
+
exports.CHAIN_ID = (_a = {},
|
|
7
|
+
_a[types_1.Network.Tron] = 728126428,
|
|
8
|
+
_a[types_1.Network.Shasta] = 2494104990,
|
|
9
|
+
_a);
|
|
10
|
+
exports.HOST_CHAINNAME = {
|
|
11
|
+
'https://api.trongrid.io': types_1.Network.Tron,
|
|
12
|
+
'https://api.shasta.trongrid.io': types_1.Network.Shasta,
|
|
5
13
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
exports.ID_CHAINNAME = {
|
|
15
|
+
728126428: types_1.Network.Tron,
|
|
16
|
+
2494104990: types_1.Network.Shasta,
|
|
9
17
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
[Network.Tron]
|
|
16
|
-
[Network.Shasta]: 'tron',
|
|
17
|
-
};
|
|
18
|
-
export const API_BASE_URL = {
|
|
19
|
-
[Network.Tron]: {
|
|
18
|
+
exports.CHAIN = (_b = {},
|
|
19
|
+
_b[types_1.Network.Tron] = 'tron',
|
|
20
|
+
_b[types_1.Network.Shasta] = 'tron',
|
|
21
|
+
_b);
|
|
22
|
+
exports.API_BASE_URL = (_c = {},
|
|
23
|
+
_c[types_1.Network.Tron] = {
|
|
20
24
|
api: 'https://api.apenft.io',
|
|
21
25
|
api2: 'https://api.apenft.io',
|
|
22
26
|
key: 'rV9UjZwMSK4zqkKEWOUnUXXY2zNgPJ8i',
|
|
23
27
|
secret: 'X6nsVJtRzySGjXvsfRN5RAweKtFtLKBZ',
|
|
24
28
|
apenftBaseApiUrl: 'https://api-gateway.apenft.io'
|
|
25
29
|
},
|
|
26
|
-
[Network.Shasta]
|
|
30
|
+
_c[types_1.Network.Shasta] = {
|
|
27
31
|
api: 'https://api-testnet.apenft.io',
|
|
28
32
|
api2: 'https://api-testnet.apenft.io',
|
|
29
33
|
key: 'ewSLIdRTSkss2oFsBFdCuO113l0zXX2K',
|
|
30
34
|
secret: 'Km8wDTfjIF5lwJl4qpouzeqNMrd78K1w',
|
|
31
35
|
apenftBaseApiUrl: 'https://api-gateway-dev.apenft.io'
|
|
32
36
|
},
|
|
33
|
-
|
|
37
|
+
_c);
|
|
34
38
|
// base58
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
exports.NULL_ADDRESS = 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb';
|
|
40
|
+
exports.GasPrice_NOW = {
|
|
37
41
|
url: 'https://www.gasnow.org/api/v3/gas/price',
|
|
38
42
|
type: 'fast' //standard
|
|
39
43
|
};
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
exports.GasLimitOffset = 1.18;
|
|
45
|
+
var TRON_CONTRACTS_ADDRESSES_BASE58;
|
|
42
46
|
(function (TRON_CONTRACTS_ADDRESSES_BASE58) {
|
|
43
47
|
TRON_CONTRACTS_ADDRESSES_BASE58["ERC20AssetProxy"] = "TRgSk4foxSg4JaV2EjNz8qzaNrBhUtWUnz";
|
|
44
48
|
TRON_CONTRACTS_ADDRESSES_BASE58["ERC721AssetProxy"] = "TRJ54KCbg29a4nb8LVPgNp61o2ity2WkDu";
|
|
@@ -49,8 +53,8 @@ export var TRON_CONTRACTS_ADDRESSES_BASE58;
|
|
|
49
53
|
TRON_CONTRACTS_ADDRESSES_BASE58["APENFTSharedAsset"] = "TG8UTFQfcmyqb3bSjqK1svTtzrn2mLcUXS";
|
|
50
54
|
TRON_CONTRACTS_ADDRESSES_BASE58["FeeRecipientAddress"] = "TLRt2GZrfxBsYWjsh7wjmZbXT3WKMoEws9";
|
|
51
55
|
TRON_CONTRACTS_ADDRESSES_BASE58["WTRX"] = "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR";
|
|
52
|
-
})(TRON_CONTRACTS_ADDRESSES_BASE58 || (TRON_CONTRACTS_ADDRESSES_BASE58 = {}));
|
|
53
|
-
|
|
56
|
+
})(TRON_CONTRACTS_ADDRESSES_BASE58 = exports.TRON_CONTRACTS_ADDRESSES_BASE58 || (exports.TRON_CONTRACTS_ADDRESSES_BASE58 = {}));
|
|
57
|
+
var SHASTA_CONTRACTS_ADDRESSES_BASE58;
|
|
54
58
|
(function (SHASTA_CONTRACTS_ADDRESSES_BASE58) {
|
|
55
59
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ERC20AssetProxy"] = "TC7G2nApC3WKGkkkrppUJSmNSnj7KYkaiq";
|
|
56
60
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ERC721AssetProxy"] = "TVDuLb8zE9mcMJqMtUD1gMTnFKRZduwhb7";
|
|
@@ -65,8 +69,8 @@ export var SHASTA_CONTRACTS_ADDRESSES_BASE58;
|
|
|
65
69
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ERC20Asset"] = "TTRjXLinU9FAZETtL5TDNsQGd7sc7Hu26T";
|
|
66
70
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ERC1155Asset"] = "TD34cLBPdDhjRHDgiWkG42LnbCZk5fP2fP";
|
|
67
71
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["FactoryContract"] = ""; // Leaving blank does not initialize the contract
|
|
68
|
-
})(SHASTA_CONTRACTS_ADDRESSES_BASE58 || (SHASTA_CONTRACTS_ADDRESSES_BASE58 = {}));
|
|
69
|
-
|
|
70
|
-
[Network.Tron]
|
|
71
|
-
[Network.Shasta]
|
|
72
|
-
|
|
72
|
+
})(SHASTA_CONTRACTS_ADDRESSES_BASE58 = exports.SHASTA_CONTRACTS_ADDRESSES_BASE58 || (exports.SHASTA_CONTRACTS_ADDRESSES_BASE58 = {}));
|
|
73
|
+
exports.CONTRACTS_ADDRESSES = (_d = {},
|
|
74
|
+
_d[types_1.Network.Tron] = TRON_CONTRACTS_ADDRESSES_BASE58,
|
|
75
|
+
_d[types_1.Network.Shasta] = SHASTA_CONTRACTS_ADDRESSES_BASE58,
|
|
76
|
+
_d);
|
|
@@ -1,49 +1,148 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
6
51
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.AccountApi = void 0;
|
|
55
|
+
var account_1 = require("./gql/account");
|
|
56
|
+
var base_1 = require("./base");
|
|
57
|
+
var AccountApi = /** @class */ (function (_super) {
|
|
58
|
+
__extends(AccountApi, _super);
|
|
59
|
+
function AccountApi(config) {
|
|
60
|
+
return _super.call(this, config) || this;
|
|
13
61
|
}
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
62
|
+
AccountApi.prototype.getUser = function (params) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
switch (_a.label) {
|
|
66
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
67
|
+
funcName: "getUser",
|
|
68
|
+
gql: account_1.getUser,
|
|
69
|
+
params: params,
|
|
70
|
+
})];
|
|
71
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
19
74
|
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
75
|
+
};
|
|
76
|
+
AccountApi.prototype.getUsers = function (params) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
switch (_a.label) {
|
|
80
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
81
|
+
funcName: "getUsers",
|
|
82
|
+
gql: account_1.getUsers,
|
|
83
|
+
params: params,
|
|
84
|
+
})];
|
|
85
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
26
88
|
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
89
|
+
};
|
|
90
|
+
AccountApi.prototype.getCollections = function (params) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
95
|
+
funcName: "getCollections",
|
|
96
|
+
gql: account_1.getCollections,
|
|
97
|
+
params: params,
|
|
98
|
+
})];
|
|
99
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
33
102
|
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
103
|
+
};
|
|
104
|
+
AccountApi.prototype.getUserSentOffers = function (params) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
switch (_a.label) {
|
|
108
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
109
|
+
funcName: "getUserSentOffers",
|
|
110
|
+
gql: account_1.getUserSentOffers,
|
|
111
|
+
params: params,
|
|
112
|
+
})];
|
|
113
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
40
116
|
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
117
|
+
};
|
|
118
|
+
AccountApi.prototype.getUserReceivedOffers = function (params) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
120
|
+
return __generator(this, function (_a) {
|
|
121
|
+
switch (_a.label) {
|
|
122
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
123
|
+
funcName: "getUserReceivedOffers",
|
|
124
|
+
gql: account_1.getUserReceivedOffers,
|
|
125
|
+
params: params,
|
|
126
|
+
})];
|
|
127
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
47
130
|
});
|
|
48
|
-
}
|
|
49
|
-
|
|
131
|
+
};
|
|
132
|
+
AccountApi.prototype.getAssets = function (params) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
switch (_a.label) {
|
|
136
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
137
|
+
funcName: "getAssets",
|
|
138
|
+
gql: account_1.getAssets,
|
|
139
|
+
params: params,
|
|
140
|
+
})];
|
|
141
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
return AccountApi;
|
|
147
|
+
}(base_1.GraphqlApi));
|
|
148
|
+
exports.AccountApi = AccountApi;
|
|
@@ -1,77 +1,204 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
6
51
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.AssetApi = void 0;
|
|
55
|
+
var asset_1 = require("./gql/asset");
|
|
56
|
+
var base_1 = require("./base");
|
|
57
|
+
var AssetApi = /** @class */ (function (_super) {
|
|
58
|
+
__extends(AssetApi, _super);
|
|
59
|
+
function AssetApi(config) {
|
|
60
|
+
return _super.call(this, config) || this;
|
|
13
61
|
}
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
62
|
+
AssetApi.prototype.getAssetListings = function (params) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
switch (_a.label) {
|
|
66
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
67
|
+
funcName: "getAssetListings",
|
|
68
|
+
gql: asset_1.getAssetListings,
|
|
69
|
+
params: params,
|
|
70
|
+
})];
|
|
71
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
19
74
|
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
75
|
+
};
|
|
76
|
+
AssetApi.prototype.getAssetOffers = function (params) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
switch (_a.label) {
|
|
80
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
81
|
+
funcName: "getAssetOffers",
|
|
82
|
+
gql: asset_1.getAssetOffers,
|
|
83
|
+
params: params,
|
|
84
|
+
})];
|
|
85
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
26
88
|
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
89
|
+
};
|
|
90
|
+
AssetApi.prototype.getAssetDetail = function (params) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
95
|
+
funcName: "getAssetDetail",
|
|
96
|
+
gql: asset_1.getAssetDetail,
|
|
97
|
+
params: params,
|
|
98
|
+
})];
|
|
99
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
33
102
|
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
103
|
+
};
|
|
104
|
+
AssetApi.prototype.getAssetTradingHistory = function (params) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
switch (_a.label) {
|
|
108
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
109
|
+
funcName: "getAssetTradingHistory",
|
|
110
|
+
gql: asset_1.getAssetTradingHistory,
|
|
111
|
+
params: params,
|
|
112
|
+
})];
|
|
113
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
40
116
|
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
117
|
+
};
|
|
118
|
+
AssetApi.prototype.getAssetMoreCollection = function (params) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
120
|
+
return __generator(this, function (_a) {
|
|
121
|
+
switch (_a.label) {
|
|
122
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
123
|
+
funcName: "getAssetMoreCollection",
|
|
124
|
+
gql: asset_1.getAssetMoreCollection,
|
|
125
|
+
params: params,
|
|
126
|
+
})];
|
|
127
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
47
130
|
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
131
|
+
};
|
|
132
|
+
AssetApi.prototype.getAssetListingInfo = function (params) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
switch (_a.label) {
|
|
136
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
137
|
+
funcName: "getAssetListingInfo",
|
|
138
|
+
gql: asset_1.getAssetListingInfo,
|
|
139
|
+
params: params,
|
|
140
|
+
})];
|
|
141
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
54
144
|
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
145
|
+
};
|
|
146
|
+
AssetApi.prototype.getAssetSales = function (params) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
+
return __generator(this, function (_a) {
|
|
149
|
+
switch (_a.label) {
|
|
150
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
151
|
+
funcName: "getAssetSales",
|
|
152
|
+
gql: asset_1.getAssetSales,
|
|
153
|
+
params: params,
|
|
154
|
+
})];
|
|
155
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
61
158
|
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
159
|
+
};
|
|
160
|
+
AssetApi.prototype.getAssetBids = function (params) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
switch (_a.label) {
|
|
164
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
165
|
+
funcName: "getAssetBids",
|
|
166
|
+
gql: asset_1.getAssetBids,
|
|
167
|
+
params: params,
|
|
168
|
+
})];
|
|
169
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
68
172
|
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
173
|
+
};
|
|
174
|
+
AssetApi.prototype.getCurrencies = function () {
|
|
175
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
176
|
+
return __generator(this, function (_a) {
|
|
177
|
+
switch (_a.label) {
|
|
178
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
179
|
+
funcName: "getCurrencies",
|
|
180
|
+
gql: asset_1.getCurrencies,
|
|
181
|
+
params: {},
|
|
182
|
+
})];
|
|
183
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
184
|
+
}
|
|
185
|
+
});
|
|
75
186
|
});
|
|
76
|
-
}
|
|
77
|
-
|
|
187
|
+
};
|
|
188
|
+
AssetApi.prototype.getAllAssets = function (params) {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
190
|
+
return __generator(this, function (_a) {
|
|
191
|
+
switch (_a.label) {
|
|
192
|
+
case 0: return [4 /*yield*/, this.blockChainRequest({
|
|
193
|
+
funcName: "getAllAssets",
|
|
194
|
+
gql: asset_1.getAllAssets,
|
|
195
|
+
params: params,
|
|
196
|
+
})];
|
|
197
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
return AssetApi;
|
|
203
|
+
}(base_1.GraphqlApi));
|
|
204
|
+
exports.AssetApi = AssetApi;
|