apenft-js-tron 2.1.2 → 2.1.3-beta.1
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 +8 -31
- package/dist/src/config.js +30 -34
- package/dist/src/queryAPI/graphql/accountApi.js +42 -141
- package/dist/src/queryAPI/graphql/assetApi.js +66 -193
- package/dist/src/queryAPI/graphql/base.js +34 -46
- package/dist/src/queryAPI/graphql/collectionApi.js +42 -141
- package/dist/src/queryAPI/graphql/gql/account.js +153 -16
- package/dist/src/queryAPI/graphql/gql/asset.js +281 -20
- package/dist/src/queryAPI/graphql/gql/collection.js +173 -16
- package/dist/src/queryAPI/graphql/gql/fragments.js +230 -17
- package/dist/src/queryAPI/graphql/gql/ranking.js +60 -11
- package/dist/src/queryAPI/graphql/index.js +10 -16
- package/dist/src/queryAPI/graphql/rankingApi.js +12 -76
- package/dist/src/queryAPI/index.js +391 -743
- package/dist/src/queryAPI/restful/base.js +102 -185
- package/dist/src/queryAPI/restful/index.js +1 -2
- package/dist/src/queryAPI/restful/queryAPI.js +15 -37
- package/dist/src/schemas/common/ERC1155/index.js +46 -87
- package/dist/src/schemas/common/ERC20/index.js +43 -84
- package/dist/src/schemas/common/ERC721/index.js +42 -83
- package/dist/src/schemas/common/Element/exchange.js +19 -22
- package/dist/src/schemas/common/Element/registry.js +12 -15
- package/dist/src/schemas/common/ens.js +10 -18
- package/dist/src/schemas/index.js +48 -60
- package/dist/src/schemas/schemasFunctions.js +62 -85
- package/dist/src/schemas/shasta/index.js +4 -7
- package/dist/src/schemas/tron/index.js +4 -7
- package/dist/src/tokens/index.js +5 -8
- package/dist/src/tokens/shasta/index.js +1 -4
- package/dist/src/tokens/tron/index.js +1 -4
- package/dist/src/tradeAPI/account.js +309 -525
- package/dist/src/tradeAPI/approve.js +45 -104
- package/dist/src/tradeAPI/base.js +91 -178
- package/dist/src/tradeAPI/contractSchemas.js +215 -302
- package/dist/src/tradeAPI/contracts.js +53 -78
- package/dist/src/tradeAPI/index.js +179 -338
- package/dist/src/tradeAPI/nft.js +123 -255
- package/dist/src/tradeAPI/orders.js +108 -238
- package/dist/src/tradeAPI/ordersApi.js +78 -208
- package/dist/src/utils/Abi.js +79 -96
- package/dist/src/utils/PromiEvent.js +10 -15
- package/dist/src/utils/check.js +290 -554
- package/dist/src/utils/constants.js +29 -36
- package/dist/src/utils/error.js +14 -37
- package/dist/src/utils/fees.js +81 -90
- package/dist/src/utils/helper.js +193 -319
- package/dist/src/utils/makeOrder.js +282 -410
- package/dist/src/utils/types.js +46 -52
- package/dist/src/utils/utils.js +5 -12
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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; } });
|
|
1
|
+
export { APENFTOrders } from './src/tradeAPI/index';
|
|
2
|
+
export { APENFTQuery } from './src/queryAPI/index';
|
|
3
|
+
export { initApprove } from './src/tradeAPI/approve';
|
|
4
|
+
export { Network, MakeOrderType, APENFTSchemaName, OrderSide, AssetSortBy, CollectionTradeTrendFilterDays, EventType, CollectionSortBy, AssetListCollectionTypes, AssetStatus, Category, } from './src/utils/types';
|
|
5
|
+
export { AssetFactory } from './src/tradeAPI/nft';
|
|
24
6
|
// for APENFT market
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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; } });
|
|
7
|
+
export { toBaseUnitAmount, getSchemaList, makeBigNumber, } from './src/utils/helper';
|
|
8
|
+
export { NULL_ADDRESS } from './src/utils/constants';
|
|
9
|
+
export { APENFTError } from './src/utils/error';
|
package/dist/src/config.js
CHANGED
|
@@ -1,48 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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,
|
|
1
|
+
import { Network } from './utils/types';
|
|
2
|
+
export const CHAIN_ID = {
|
|
3
|
+
[Network.Tron]: 728126428,
|
|
4
|
+
[Network.Shasta]: 2494104990, //0x94a9059e
|
|
13
5
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
export const HOST_CHAINNAME = {
|
|
7
|
+
'https://api.trongrid.io': Network.Tron,
|
|
8
|
+
'https://api.shasta.trongrid.io': Network.Shasta,
|
|
17
9
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
export const ID_CHAINNAME = {
|
|
11
|
+
728126428: Network.Tron,
|
|
12
|
+
2494104990: Network.Shasta,
|
|
13
|
+
};
|
|
14
|
+
export const CHAIN = {
|
|
15
|
+
[Network.Tron]: 'tron',
|
|
16
|
+
[Network.Shasta]: 'tron',
|
|
17
|
+
};
|
|
18
|
+
export const API_BASE_URL = {
|
|
19
|
+
[Network.Tron]: {
|
|
24
20
|
api: 'https://api.apenft.io',
|
|
25
21
|
api2: 'https://api.apenft.io',
|
|
26
22
|
key: 'rV9UjZwMSK4zqkKEWOUnUXXY2zNgPJ8i',
|
|
27
23
|
secret: 'X6nsVJtRzySGjXvsfRN5RAweKtFtLKBZ',
|
|
28
24
|
apenftBaseApiUrl: 'https://api-gateway.apenft.io'
|
|
29
25
|
},
|
|
30
|
-
|
|
26
|
+
[Network.Shasta]: {
|
|
31
27
|
api: 'https://api-testnet.apenft.io',
|
|
32
28
|
api2: 'https://api-testnet.apenft.io',
|
|
33
29
|
key: 'ewSLIdRTSkss2oFsBFdCuO113l0zXX2K',
|
|
34
30
|
secret: 'Km8wDTfjIF5lwJl4qpouzeqNMrd78K1w',
|
|
35
31
|
apenftBaseApiUrl: 'https://api-gateway-dev.apenft.io'
|
|
36
32
|
},
|
|
37
|
-
|
|
33
|
+
};
|
|
38
34
|
// base58
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
export const NULL_ADDRESS = 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb';
|
|
36
|
+
export const GasPrice_NOW = {
|
|
41
37
|
url: 'https://www.gasnow.org/api/v3/gas/price',
|
|
42
38
|
type: 'fast' //standard
|
|
43
39
|
};
|
|
44
|
-
|
|
45
|
-
var TRON_CONTRACTS_ADDRESSES_BASE58;
|
|
40
|
+
export const GasLimitOffset = 1.18;
|
|
41
|
+
export var TRON_CONTRACTS_ADDRESSES_BASE58;
|
|
46
42
|
(function (TRON_CONTRACTS_ADDRESSES_BASE58) {
|
|
47
43
|
TRON_CONTRACTS_ADDRESSES_BASE58["ERC20AssetProxy"] = "TRgSk4foxSg4JaV2EjNz8qzaNrBhUtWUnz";
|
|
48
44
|
TRON_CONTRACTS_ADDRESSES_BASE58["ERC721AssetProxy"] = "TRJ54KCbg29a4nb8LVPgNp61o2ity2WkDu";
|
|
@@ -53,8 +49,8 @@ var TRON_CONTRACTS_ADDRESSES_BASE58;
|
|
|
53
49
|
TRON_CONTRACTS_ADDRESSES_BASE58["APENFTSharedAsset"] = "TG8UTFQfcmyqb3bSjqK1svTtzrn2mLcUXS";
|
|
54
50
|
TRON_CONTRACTS_ADDRESSES_BASE58["FeeRecipientAddress"] = "TLRt2GZrfxBsYWjsh7wjmZbXT3WKMoEws9";
|
|
55
51
|
TRON_CONTRACTS_ADDRESSES_BASE58["WTRX"] = "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR";
|
|
56
|
-
})(TRON_CONTRACTS_ADDRESSES_BASE58
|
|
57
|
-
var SHASTA_CONTRACTS_ADDRESSES_BASE58;
|
|
52
|
+
})(TRON_CONTRACTS_ADDRESSES_BASE58 || (TRON_CONTRACTS_ADDRESSES_BASE58 = {}));
|
|
53
|
+
export var SHASTA_CONTRACTS_ADDRESSES_BASE58;
|
|
58
54
|
(function (SHASTA_CONTRACTS_ADDRESSES_BASE58) {
|
|
59
55
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ERC20AssetProxy"] = "TC7G2nApC3WKGkkkrppUJSmNSnj7KYkaiq";
|
|
60
56
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ERC721AssetProxy"] = "TVDuLb8zE9mcMJqMtUD1gMTnFKRZduwhb7";
|
|
@@ -69,8 +65,8 @@ var SHASTA_CONTRACTS_ADDRESSES_BASE58;
|
|
|
69
65
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ERC20Asset"] = "TTRjXLinU9FAZETtL5TDNsQGd7sc7Hu26T";
|
|
70
66
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ERC1155Asset"] = "TD34cLBPdDhjRHDgiWkG42LnbCZk5fP2fP";
|
|
71
67
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["FactoryContract"] = ""; // Leaving blank does not initialize the contract
|
|
72
|
-
})(SHASTA_CONTRACTS_ADDRESSES_BASE58
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
})(SHASTA_CONTRACTS_ADDRESSES_BASE58 || (SHASTA_CONTRACTS_ADDRESSES_BASE58 = {}));
|
|
69
|
+
export const CONTRACTS_ADDRESSES = {
|
|
70
|
+
[Network.Tron]: TRON_CONTRACTS_ADDRESSES_BASE58,
|
|
71
|
+
[Network.Shasta]: SHASTA_CONTRACTS_ADDRESSES_BASE58
|
|
72
|
+
};
|
|
@@ -1,148 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 };
|
|
1
|
+
import { getUser, getUsers, getCollections, getUserSentOffers, getUserReceivedOffers, getAssets, } from "./gql/account";
|
|
2
|
+
import { GraphqlApi } from "./base";
|
|
3
|
+
export class AccountApi extends GraphqlApi {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
super(config);
|
|
51
6
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var AccountApi = /** @class */ (function (_super) {
|
|
58
|
-
__extends(AccountApi, _super);
|
|
59
|
-
function AccountApi(config) {
|
|
60
|
-
return _super.call(this, config) || this;
|
|
61
|
-
}
|
|
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
|
-
});
|
|
7
|
+
async getUser(params) {
|
|
8
|
+
return await this.blockChainRequest({
|
|
9
|
+
funcName: "getUser",
|
|
10
|
+
gql: getUser,
|
|
11
|
+
params,
|
|
74
12
|
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
funcName: "getUsers",
|
|
82
|
-
gql: account_1.getUsers,
|
|
83
|
-
params: params,
|
|
84
|
-
})];
|
|
85
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
86
|
-
}
|
|
87
|
-
});
|
|
13
|
+
}
|
|
14
|
+
async getUsers(params) {
|
|
15
|
+
return await this.blockChainRequest({
|
|
16
|
+
funcName: "getUsers",
|
|
17
|
+
gql: getUsers,
|
|
18
|
+
params,
|
|
88
19
|
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
funcName: "getCollections",
|
|
96
|
-
gql: account_1.getCollections,
|
|
97
|
-
params: params,
|
|
98
|
-
})];
|
|
99
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
100
|
-
}
|
|
101
|
-
});
|
|
20
|
+
}
|
|
21
|
+
async getCollections(params) {
|
|
22
|
+
return await this.blockChainRequest({
|
|
23
|
+
funcName: "getCollections",
|
|
24
|
+
gql: getCollections,
|
|
25
|
+
params,
|
|
102
26
|
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
funcName: "getUserSentOffers",
|
|
110
|
-
gql: account_1.getUserSentOffers,
|
|
111
|
-
params: params,
|
|
112
|
-
})];
|
|
113
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
114
|
-
}
|
|
115
|
-
});
|
|
27
|
+
}
|
|
28
|
+
async getUserSentOffers(params) {
|
|
29
|
+
return await this.blockChainRequest({
|
|
30
|
+
funcName: "getUserSentOffers",
|
|
31
|
+
gql: getUserSentOffers,
|
|
32
|
+
params,
|
|
116
33
|
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
funcName: "getUserReceivedOffers",
|
|
124
|
-
gql: account_1.getUserReceivedOffers,
|
|
125
|
-
params: params,
|
|
126
|
-
})];
|
|
127
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
34
|
+
}
|
|
35
|
+
async getUserReceivedOffers(params) {
|
|
36
|
+
return await this.blockChainRequest({
|
|
37
|
+
funcName: "getUserReceivedOffers",
|
|
38
|
+
gql: getUserReceivedOffers,
|
|
39
|
+
params,
|
|
130
40
|
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
funcName: "getAssets",
|
|
138
|
-
gql: account_1.getAssets,
|
|
139
|
-
params: params,
|
|
140
|
-
})];
|
|
141
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
142
|
-
}
|
|
143
|
-
});
|
|
41
|
+
}
|
|
42
|
+
async getAssets(params) {
|
|
43
|
+
return await this.blockChainRequest({
|
|
44
|
+
funcName: "getAssets",
|
|
45
|
+
gql: getAssets,
|
|
46
|
+
params,
|
|
144
47
|
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
}(base_1.GraphqlApi));
|
|
148
|
-
exports.AccountApi = AccountApi;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,204 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 };
|
|
1
|
+
import { getAssetListings, getAssetOffers, getAssetDetail, getAssetTradingHistory, getAssetMoreCollection, getAssetListingInfo, getAssetSales, getAssetBids, getCurrencies, getAllAssets, } from "./gql/asset";
|
|
2
|
+
import { GraphqlApi } from "./base";
|
|
3
|
+
export class AssetApi extends GraphqlApi {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
super(config);
|
|
51
6
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var AssetApi = /** @class */ (function (_super) {
|
|
58
|
-
__extends(AssetApi, _super);
|
|
59
|
-
function AssetApi(config) {
|
|
60
|
-
return _super.call(this, config) || this;
|
|
61
|
-
}
|
|
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
|
-
});
|
|
7
|
+
async getAssetListings(params) {
|
|
8
|
+
return await this.blockChainRequest({
|
|
9
|
+
funcName: "getAssetListings",
|
|
10
|
+
gql: getAssetListings,
|
|
11
|
+
params,
|
|
74
12
|
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
funcName: "getAssetOffers",
|
|
82
|
-
gql: asset_1.getAssetOffers,
|
|
83
|
-
params: params,
|
|
84
|
-
})];
|
|
85
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
86
|
-
}
|
|
87
|
-
});
|
|
13
|
+
}
|
|
14
|
+
async getAssetOffers(params) {
|
|
15
|
+
return await this.blockChainRequest({
|
|
16
|
+
funcName: "getAssetOffers",
|
|
17
|
+
gql: getAssetOffers,
|
|
18
|
+
params,
|
|
88
19
|
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
funcName: "getAssetDetail",
|
|
96
|
-
gql: asset_1.getAssetDetail,
|
|
97
|
-
params: params,
|
|
98
|
-
})];
|
|
99
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
100
|
-
}
|
|
101
|
-
});
|
|
20
|
+
}
|
|
21
|
+
async getAssetDetail(params) {
|
|
22
|
+
return await this.blockChainRequest({
|
|
23
|
+
funcName: "getAssetDetail",
|
|
24
|
+
gql: getAssetDetail,
|
|
25
|
+
params,
|
|
102
26
|
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
funcName: "getAssetTradingHistory",
|
|
110
|
-
gql: asset_1.getAssetTradingHistory,
|
|
111
|
-
params: params,
|
|
112
|
-
})];
|
|
113
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
114
|
-
}
|
|
115
|
-
});
|
|
27
|
+
}
|
|
28
|
+
async getAssetTradingHistory(params) {
|
|
29
|
+
return await this.blockChainRequest({
|
|
30
|
+
funcName: "getAssetTradingHistory",
|
|
31
|
+
gql: getAssetTradingHistory,
|
|
32
|
+
params,
|
|
116
33
|
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
funcName: "getAssetMoreCollection",
|
|
124
|
-
gql: asset_1.getAssetMoreCollection,
|
|
125
|
-
params: params,
|
|
126
|
-
})];
|
|
127
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
34
|
+
}
|
|
35
|
+
async getAssetMoreCollection(params) {
|
|
36
|
+
return await this.blockChainRequest({
|
|
37
|
+
funcName: "getAssetMoreCollection",
|
|
38
|
+
gql: getAssetMoreCollection,
|
|
39
|
+
params,
|
|
130
40
|
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
funcName: "getAssetListingInfo",
|
|
138
|
-
gql: asset_1.getAssetListingInfo,
|
|
139
|
-
params: params,
|
|
140
|
-
})];
|
|
141
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
142
|
-
}
|
|
143
|
-
});
|
|
41
|
+
}
|
|
42
|
+
async getAssetListingInfo(params) {
|
|
43
|
+
return await this.blockChainRequest({
|
|
44
|
+
funcName: "getAssetListingInfo",
|
|
45
|
+
gql: getAssetListingInfo,
|
|
46
|
+
params,
|
|
144
47
|
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
funcName: "getAssetSales",
|
|
152
|
-
gql: asset_1.getAssetSales,
|
|
153
|
-
params: params,
|
|
154
|
-
})];
|
|
155
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
156
|
-
}
|
|
157
|
-
});
|
|
48
|
+
}
|
|
49
|
+
async getAssetSales(params) {
|
|
50
|
+
return await this.blockChainRequest({
|
|
51
|
+
funcName: "getAssetSales",
|
|
52
|
+
gql: getAssetSales,
|
|
53
|
+
params,
|
|
158
54
|
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
funcName: "getAssetBids",
|
|
166
|
-
gql: asset_1.getAssetBids,
|
|
167
|
-
params: params,
|
|
168
|
-
})];
|
|
169
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
170
|
-
}
|
|
171
|
-
});
|
|
55
|
+
}
|
|
56
|
+
async getAssetBids(params) {
|
|
57
|
+
return await this.blockChainRequest({
|
|
58
|
+
funcName: "getAssetBids",
|
|
59
|
+
gql: getAssetBids,
|
|
60
|
+
params,
|
|
172
61
|
});
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
funcName: "getCurrencies",
|
|
180
|
-
gql: asset_1.getCurrencies,
|
|
181
|
-
params: {},
|
|
182
|
-
})];
|
|
183
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
184
|
-
}
|
|
185
|
-
});
|
|
62
|
+
}
|
|
63
|
+
async getCurrencies() {
|
|
64
|
+
return await this.blockChainRequest({
|
|
65
|
+
funcName: "getCurrencies",
|
|
66
|
+
gql: getCurrencies,
|
|
67
|
+
params: {},
|
|
186
68
|
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
funcName: "getAllAssets",
|
|
194
|
-
gql: asset_1.getAllAssets,
|
|
195
|
-
params: params,
|
|
196
|
-
})];
|
|
197
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
198
|
-
}
|
|
199
|
-
});
|
|
69
|
+
}
|
|
70
|
+
async getAllAssets(params) {
|
|
71
|
+
return await this.blockChainRequest({
|
|
72
|
+
funcName: "getAllAssets",
|
|
73
|
+
gql: getAllAssets,
|
|
74
|
+
params,
|
|
200
75
|
});
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
}(base_1.GraphqlApi));
|
|
204
|
-
exports.AssetApi = AssetApi;
|
|
76
|
+
}
|
|
77
|
+
}
|