apenft-js-tron 2.1.0 → 2.1.2-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.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/src/config.d.ts +2 -2
- package/dist/src/config.js +2 -2
- package/dist/src/queryAPI/graphql/assetApi.d.ts +3 -1
- package/dist/src/queryAPI/graphql/assetApi.js +15 -1
- package/dist/src/queryAPI/graphql/collectionApi.d.ts +2 -1
- package/dist/src/queryAPI/graphql/collectionApi.js +8 -1
- package/dist/src/queryAPI/graphql/gql/asset.d.ts +2 -0
- package/dist/src/queryAPI/graphql/gql/asset.js +56 -0
- package/dist/src/queryAPI/graphql/gql/collection.d.ts +1 -0
- package/dist/src/queryAPI/graphql/gql/collection.js +38 -0
- package/dist/src/queryAPI/graphql/gql/fragments.js +4 -0
- package/dist/src/queryAPI/graphql/gql/ranking.d.ts +1 -0
- package/dist/src/queryAPI/graphql/gql/ranking.js +60 -0
- package/dist/src/queryAPI/graphql/index.d.ts +3 -1
- package/dist/src/queryAPI/graphql/index.js +3 -1
- package/dist/src/queryAPI/graphql/rankingApi.d.ts +6 -0
- package/dist/src/queryAPI/graphql/rankingApi.js +14 -0
- package/dist/src/queryAPI/index.d.ts +15 -2
- package/dist/src/queryAPI/index.js +57 -0
- package/dist/src/tradeAPI/contractSchemas.js +14 -11
- package/dist/src/utils/check.js +0 -2
- package/dist/src/utils/types.d.ts +81 -4
- package/dist/src/utils/types.js +35 -0
- package/package.json +57 -56
- package/tsconfig.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { APENFTOrders } from './src/tradeAPI';
|
|
2
|
-
export { APENFTQuery } from './src/queryAPI';
|
|
1
|
+
export { APENFTOrders } from './src/tradeAPI/index';
|
|
2
|
+
export { APENFTQuery } from './src/queryAPI/index';
|
|
3
3
|
export { initApprove } from './src/tradeAPI/approve';
|
|
4
|
-
export { Network, MakeOrderType, APENFTSchemaName, OrderSide } from './src/utils/types';
|
|
4
|
+
export { Network, MakeOrderType, APENFTSchemaName, OrderSide, AssetSortBy, CollectionTradeTrendFilterDays, EventType, CollectionSortBy, AssetListCollectionTypes, AssetStatus, Category, } from './src/utils/types';
|
|
5
5
|
export { AssetFactory } from './src/tradeAPI/nft';
|
|
6
6
|
export type { APIConfig } from './src/utils/types';
|
|
7
7
|
export { toBaseUnitAmount, getSchemaList, makeBigNumber, } from './src/utils/helper';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { APENFTOrders } from './src/tradeAPI/index';
|
|
2
2
|
export { APENFTQuery } from './src/queryAPI/index';
|
|
3
3
|
export { initApprove } from './src/tradeAPI/approve';
|
|
4
|
-
export { Network, MakeOrderType, APENFTSchemaName, OrderSide } from './src/utils/types';
|
|
4
|
+
export { Network, MakeOrderType, APENFTSchemaName, OrderSide, AssetSortBy, CollectionTradeTrendFilterDays, EventType, CollectionSortBy, AssetListCollectionTypes, AssetStatus, Category, } from './src/utils/types';
|
|
5
5
|
export { AssetFactory } from './src/tradeAPI/nft';
|
|
6
6
|
// for APENFT market
|
|
7
7
|
export { toBaseUnitAmount, getSchemaList, makeBigNumber, } from './src/utils/helper';
|
package/dist/src/config.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare enum TRON_CONTRACTS_ADDRESSES_BASE58 {
|
|
|
34
34
|
ExchangeHelper = "TYxaWsBNMtE9L1bsUUdXCKm99Ab2jziEbA",
|
|
35
35
|
APENFTExchangeKeeper = "TEQAs54FPKYQdTZAPyT3okfbq2MH4dEeP1",
|
|
36
36
|
APENFTSharedAsset = "TG8UTFQfcmyqb3bSjqK1svTtzrn2mLcUXS",
|
|
37
|
-
FeeRecipientAddress = "
|
|
37
|
+
FeeRecipientAddress = "TLRt2GZrfxBsYWjsh7wjmZbXT3WKMoEws9",
|
|
38
38
|
WTRX = "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR"
|
|
39
39
|
}
|
|
40
40
|
export declare enum SHASTA_CONTRACTS_ADDRESSES_BASE58 {
|
|
@@ -45,7 +45,7 @@ export declare enum SHASTA_CONTRACTS_ADDRESSES_BASE58 {
|
|
|
45
45
|
ExchangeHelper = "TCWuXtzPEqKJ2MLygtCr27i1ehYFJKDBdT",
|
|
46
46
|
APENFTExchangeKeeper = "TEdP593yFJkAiBzwdT56JrXW1pohsTA4ag",
|
|
47
47
|
APENFTSharedAsset = "TG8UTFQfcmyqb3bSjqK1svTtzrn2mLcUXS",
|
|
48
|
-
FeeRecipientAddress = "
|
|
48
|
+
FeeRecipientAddress = "TLRt2GZrfxBsYWjsh7wjmZbXT3WKMoEws9",
|
|
49
49
|
WTRX = "TF2ipqRnrDzuPrANJCJggmaM753FCE1ZWE",
|
|
50
50
|
ERC721Asset = "TKGSPEk2FLrEod8bTLCxxS9AbeXvYe21aC",
|
|
51
51
|
ERC20Asset = "TTRjXLinU9FAZETtL5TDNsQGd7sc7Hu26T",
|
package/dist/src/config.js
CHANGED
|
@@ -47,7 +47,7 @@ export var TRON_CONTRACTS_ADDRESSES_BASE58;
|
|
|
47
47
|
TRON_CONTRACTS_ADDRESSES_BASE58["ExchangeHelper"] = "TYxaWsBNMtE9L1bsUUdXCKm99Ab2jziEbA";
|
|
48
48
|
TRON_CONTRACTS_ADDRESSES_BASE58["APENFTExchangeKeeper"] = "TEQAs54FPKYQdTZAPyT3okfbq2MH4dEeP1";
|
|
49
49
|
TRON_CONTRACTS_ADDRESSES_BASE58["APENFTSharedAsset"] = "TG8UTFQfcmyqb3bSjqK1svTtzrn2mLcUXS";
|
|
50
|
-
TRON_CONTRACTS_ADDRESSES_BASE58["FeeRecipientAddress"] = "
|
|
50
|
+
TRON_CONTRACTS_ADDRESSES_BASE58["FeeRecipientAddress"] = "TLRt2GZrfxBsYWjsh7wjmZbXT3WKMoEws9";
|
|
51
51
|
TRON_CONTRACTS_ADDRESSES_BASE58["WTRX"] = "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR";
|
|
52
52
|
})(TRON_CONTRACTS_ADDRESSES_BASE58 || (TRON_CONTRACTS_ADDRESSES_BASE58 = {}));
|
|
53
53
|
export var SHASTA_CONTRACTS_ADDRESSES_BASE58;
|
|
@@ -59,7 +59,7 @@ export var SHASTA_CONTRACTS_ADDRESSES_BASE58;
|
|
|
59
59
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ExchangeHelper"] = "TCWuXtzPEqKJ2MLygtCr27i1ehYFJKDBdT";
|
|
60
60
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["APENFTExchangeKeeper"] = "TEdP593yFJkAiBzwdT56JrXW1pohsTA4ag";
|
|
61
61
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["APENFTSharedAsset"] = "TG8UTFQfcmyqb3bSjqK1svTtzrn2mLcUXS";
|
|
62
|
-
SHASTA_CONTRACTS_ADDRESSES_BASE58["FeeRecipientAddress"] = "
|
|
62
|
+
SHASTA_CONTRACTS_ADDRESSES_BASE58["FeeRecipientAddress"] = "TLRt2GZrfxBsYWjsh7wjmZbXT3WKMoEws9";
|
|
63
63
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["WTRX"] = "TF2ipqRnrDzuPrANJCJggmaM753FCE1ZWE";
|
|
64
64
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ERC721Asset"] = "TKGSPEk2FLrEod8bTLCxxS9AbeXvYe21aC";
|
|
65
65
|
SHASTA_CONTRACTS_ADDRESSES_BASE58["ERC20Asset"] = "TTRjXLinU9FAZETtL5TDNsQGd7sc7Hu26T";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIConfig, AssetListingsParams, AssetDetailParams, AssetMoreParams, AssetTradingHistory } from "../../utils/types";
|
|
1
|
+
import { APIConfig, AssetListingsParams, AssetDetailParams, AssetMoreParams, AssetTradingHistory, AssetQueryParams } from "../../utils/types";
|
|
2
2
|
import { GraphqlApi } from "./base";
|
|
3
3
|
export declare class AssetApi extends GraphqlApi {
|
|
4
4
|
constructor(config: APIConfig);
|
|
@@ -10,4 +10,6 @@ export declare class AssetApi extends GraphqlApi {
|
|
|
10
10
|
getAssetListingInfo(params: AssetDetailParams): Promise<any>;
|
|
11
11
|
getAssetSales(params: AssetDetailParams): Promise<any>;
|
|
12
12
|
getAssetBids(params: AssetDetailParams): Promise<any>;
|
|
13
|
+
getCurrencies(): Promise<any>;
|
|
14
|
+
getAllAssets(params: AssetQueryParams): Promise<any>;
|
|
13
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAssetListings, getAssetOffers, getAssetDetail, getAssetTradingHistory, getAssetMoreCollection, getAssetListingInfo, getAssetSales, getAssetBids, } from "./gql/asset";
|
|
1
|
+
import { getAssetListings, getAssetOffers, getAssetDetail, getAssetTradingHistory, getAssetMoreCollection, getAssetListingInfo, getAssetSales, getAssetBids, getCurrencies, getAllAssets, } from "./gql/asset";
|
|
2
2
|
import { GraphqlApi } from "./base";
|
|
3
3
|
export class AssetApi extends GraphqlApi {
|
|
4
4
|
constructor(config) {
|
|
@@ -60,4 +60,18 @@ export class AssetApi extends GraphqlApi {
|
|
|
60
60
|
params,
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
+
async getCurrencies() {
|
|
64
|
+
return await this.blockChainRequest({
|
|
65
|
+
funcName: "getCurrencies",
|
|
66
|
+
gql: getCurrencies,
|
|
67
|
+
params: {},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async getAllAssets(params) {
|
|
71
|
+
return await this.blockChainRequest({
|
|
72
|
+
funcName: "getAllAssets",
|
|
73
|
+
gql: getAllAssets,
|
|
74
|
+
params,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
63
77
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIConfig, CollectionTradeTrendParams, AddressParams, CollectionTradingHistoryParams, HotCollectionsParams } from "../../utils/types";
|
|
1
|
+
import { APIConfig, CollectionTradeTrendParams, AddressParams, CollectionTradingHistoryParams, HotCollectionsParams, CollectionListParams } from "../../utils/types";
|
|
2
2
|
import { GraphqlApi } from "./base";
|
|
3
3
|
export declare class CollectionApi extends GraphqlApi {
|
|
4
4
|
constructor(config: APIConfig);
|
|
@@ -7,4 +7,5 @@ export declare class CollectionApi extends GraphqlApi {
|
|
|
7
7
|
getSingleCollectionAttributes(params: AddressParams): Promise<any>;
|
|
8
8
|
getCollectionTradingHistory(params: CollectionTradingHistoryParams): Promise<any>;
|
|
9
9
|
getHotCollections(params: HotCollectionsParams): Promise<any>;
|
|
10
|
+
getAllCollections(params: CollectionListParams): Promise<any>;
|
|
10
11
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSingleCollectionInfo, getCollectionTradeTrend, getSingleCollectionAttributes, getCollectionTradingHistory, getHotCollections, } from "./gql/collection";
|
|
1
|
+
import { getSingleCollectionInfo, getCollectionTradeTrend, getSingleCollectionAttributes, getCollectionTradingHistory, getHotCollections, getAllCollections } from "./gql/collection";
|
|
2
2
|
import { GraphqlApi } from "./base";
|
|
3
3
|
export class CollectionApi extends GraphqlApi {
|
|
4
4
|
constructor(config) {
|
|
@@ -39,4 +39,11 @@ export class CollectionApi extends GraphqlApi {
|
|
|
39
39
|
params,
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
+
async getAllCollections(params) {
|
|
43
|
+
return await this.blockChainRequest({
|
|
44
|
+
funcName: "getAllCollections",
|
|
45
|
+
gql: getAllCollections,
|
|
46
|
+
params,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
42
49
|
}
|
|
@@ -6,3 +6,5 @@ export declare const getAssetMoreCollection: string;
|
|
|
6
6
|
export declare const getAssetListingInfo: string;
|
|
7
7
|
export declare const getAssetSales: string;
|
|
8
8
|
export declare const getAssetBids: string;
|
|
9
|
+
export declare const getCurrencies: string;
|
|
10
|
+
export declare const getAllAssets: string;
|
|
@@ -223,3 +223,59 @@ export const getAssetBids = gql `
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
`;
|
|
226
|
+
export const getCurrencies = gql `
|
|
227
|
+
query getCurrencyList {
|
|
228
|
+
ui_filters {
|
|
229
|
+
explore_currencies {
|
|
230
|
+
address
|
|
231
|
+
icon
|
|
232
|
+
symbol
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
`;
|
|
237
|
+
export const getAllAssets = gql `
|
|
238
|
+
${PAGINATION_FIELDS}
|
|
239
|
+
${ASSETS_FIELDS}
|
|
240
|
+
query getAssets(
|
|
241
|
+
$pagination: Pagination
|
|
242
|
+
$sort: AssetSortBy
|
|
243
|
+
$price: PriceRangeFilter
|
|
244
|
+
$statuses: [AssetStatus]
|
|
245
|
+
$collections: [String]
|
|
246
|
+
$user_account: String
|
|
247
|
+
$owners: [String]
|
|
248
|
+
$creators: [String]
|
|
249
|
+
$attributes: [AttributesFilter]
|
|
250
|
+
$search: String
|
|
251
|
+
$categories: [String]
|
|
252
|
+
$currencies: [String]
|
|
253
|
+
$is_recommend: Boolean,
|
|
254
|
+
$collection_types: [assetListCollectionTypes]
|
|
255
|
+
) {
|
|
256
|
+
assets(
|
|
257
|
+
sort: $sort
|
|
258
|
+
pagination: $pagination
|
|
259
|
+
price: $price
|
|
260
|
+
statuses: $statuses
|
|
261
|
+
collections: $collections
|
|
262
|
+
user_account: $user_account
|
|
263
|
+
owners: $owners
|
|
264
|
+
creators: $creators
|
|
265
|
+
attributes: $attributes
|
|
266
|
+
search: $search
|
|
267
|
+
categories: $categories
|
|
268
|
+
currencies: $currencies
|
|
269
|
+
is_recommend: $is_recommend,
|
|
270
|
+
collection_types: $collection_types
|
|
271
|
+
) {
|
|
272
|
+
items {
|
|
273
|
+
...assetsFields,
|
|
274
|
+
}
|
|
275
|
+
pagination {
|
|
276
|
+
...paginationFields
|
|
277
|
+
total
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
`;
|
|
@@ -133,3 +133,41 @@ export const getHotCollections = gql `
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
`;
|
|
136
|
+
export const getAllCollections = gql `
|
|
137
|
+
${PAGINATION_FIELDS}
|
|
138
|
+
query getCollections(
|
|
139
|
+
$pagination: Pagination
|
|
140
|
+
$sort: CollectionSortBy
|
|
141
|
+
$search: String
|
|
142
|
+
$owners: [String]
|
|
143
|
+
$asset_owners: [String]
|
|
144
|
+
$asset_creators: [String]
|
|
145
|
+
$event_involved: [String]
|
|
146
|
+
$collection_types: [collectionListCollectionTypes]
|
|
147
|
+
) {
|
|
148
|
+
collections(
|
|
149
|
+
pagination: $pagination
|
|
150
|
+
sort: $sort
|
|
151
|
+
search: $search
|
|
152
|
+
owners: $owners
|
|
153
|
+
asset_owners: $asset_owners
|
|
154
|
+
asset_creators: $asset_creators
|
|
155
|
+
event_involved: $event_involved,
|
|
156
|
+
collection_types: $collection_types
|
|
157
|
+
) {
|
|
158
|
+
items {
|
|
159
|
+
name
|
|
160
|
+
image_url
|
|
161
|
+
contract_address
|
|
162
|
+
is_verified
|
|
163
|
+
object_count
|
|
164
|
+
stat {
|
|
165
|
+
floor_price
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
pagination {
|
|
169
|
+
...paginationFields
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getRankingDetail: string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { gql } from 'graphql-request';
|
|
2
|
+
import { PAGINATION_FIELDS } from "./fragments";
|
|
3
|
+
export const getRankingDetail = gql `
|
|
4
|
+
${PAGINATION_FIELDS}
|
|
5
|
+
query rankingDetail(
|
|
6
|
+
$sort: CollectionSortBy
|
|
7
|
+
$categories: [String]
|
|
8
|
+
$sort_asc: Boolean
|
|
9
|
+
$pagination: Pagination
|
|
10
|
+
$is_rank_disabled: Boolean
|
|
11
|
+
$has_listing_asset: Boolean
|
|
12
|
+
) {
|
|
13
|
+
collections(
|
|
14
|
+
sort: $sort
|
|
15
|
+
categories: $categories
|
|
16
|
+
sort_asc: $sort_asc
|
|
17
|
+
pagination: $pagination
|
|
18
|
+
is_rank_disabled: $is_rank_disabled,
|
|
19
|
+
has_listing_asset: $has_listing_asset,
|
|
20
|
+
) {
|
|
21
|
+
items {
|
|
22
|
+
image_url
|
|
23
|
+
name
|
|
24
|
+
contract_address
|
|
25
|
+
is_verified
|
|
26
|
+
stat {
|
|
27
|
+
volume_total
|
|
28
|
+
avg_price_ratio_24h
|
|
29
|
+
avg_price_ratio_7d
|
|
30
|
+
avg_price_24h
|
|
31
|
+
floor_price
|
|
32
|
+
owners_total
|
|
33
|
+
assets_total
|
|
34
|
+
volume_24h
|
|
35
|
+
volume_30d
|
|
36
|
+
volume_7d
|
|
37
|
+
volume_ratio_24h
|
|
38
|
+
volume_ratio_30d
|
|
39
|
+
volume_ratio_7d
|
|
40
|
+
floor_price_24h
|
|
41
|
+
floor_price_30d
|
|
42
|
+
floor_price_7d
|
|
43
|
+
floor_price_ratio_24h
|
|
44
|
+
floor_price_ratio_30d
|
|
45
|
+
floor_price_ratio_7d
|
|
46
|
+
top_price_24h
|
|
47
|
+
top_price_30d
|
|
48
|
+
top_price_7d
|
|
49
|
+
top_price_ratio_24h
|
|
50
|
+
top_price_ratio_30d
|
|
51
|
+
top_price_ratio_7d
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
pagination {
|
|
55
|
+
total
|
|
56
|
+
...paginationFields
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CollectionApi } from "./collectionApi";
|
|
2
2
|
import { AssetApi } from "./assetApi";
|
|
3
3
|
import { AccountApi } from "./accountApi";
|
|
4
|
+
import { RankingApi } from "./rankingApi";
|
|
4
5
|
export declare const GqlApi: {
|
|
5
6
|
collectionApi: typeof CollectionApi;
|
|
6
7
|
assetApi: typeof AssetApi;
|
|
7
8
|
accountApi: typeof AccountApi;
|
|
9
|
+
rankingApi: typeof RankingApi;
|
|
8
10
|
};
|
|
9
|
-
export { CollectionApi, AssetApi, AccountApi };
|
|
11
|
+
export { CollectionApi, AssetApi, AccountApi, RankingApi };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CollectionApi } from "./collectionApi";
|
|
2
2
|
import { AssetApi } from "./assetApi";
|
|
3
3
|
import { AccountApi } from "./accountApi";
|
|
4
|
+
import { RankingApi } from "./rankingApi";
|
|
4
5
|
export const GqlApi = {
|
|
5
6
|
collectionApi: CollectionApi,
|
|
6
7
|
assetApi: AssetApi,
|
|
7
8
|
accountApi: AccountApi,
|
|
9
|
+
rankingApi: RankingApi,
|
|
8
10
|
};
|
|
9
|
-
export { CollectionApi, AssetApi, AccountApi };
|
|
11
|
+
export { CollectionApi, AssetApi, AccountApi, RankingApi };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getRankingDetail } from './gql/ranking';
|
|
2
|
+
import { GraphqlApi } from './base';
|
|
3
|
+
export class RankingApi extends GraphqlApi {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
super(config);
|
|
6
|
+
}
|
|
7
|
+
async getRankingDetail(params) {
|
|
8
|
+
return await this.blockChainRequest({
|
|
9
|
+
funcName: 'getRankingDetail',
|
|
10
|
+
gql: getRankingDetail,
|
|
11
|
+
params,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { QueryAPI } from "./restful/queryAPI";
|
|
2
|
-
import { CollectionApi, AssetApi, AccountApi } from "./graphql";
|
|
2
|
+
import { CollectionApi, AssetApi, AccountApi, RankingApi } from "./graphql/index";
|
|
3
3
|
import TronWeb from "tronweb";
|
|
4
|
-
import { APIConfig, AddressParams, CollectionTradeTrendParams, CollectionTradingHistoryParams, HotCollectionsParams, FixPriceOrderParams, EnglishAuctionOrderParams, LowerPriceOrderParams, Pagination } from "../utils/types";
|
|
4
|
+
import { APIConfig, AddressParams, CollectionTradeTrendParams, CollectionTradingHistoryParams, HotCollectionsParams, AssetSortBy, FixPriceOrderParams, EnglishAuctionOrderParams, LowerPriceOrderParams, Pagination, AssetQueryFilters, CollectionSortBy, CollectionListFilterObj, RankingDetailParams } from "../utils/types";
|
|
5
5
|
export declare class APENFTQuery extends QueryAPI {
|
|
6
6
|
gqlApi: {
|
|
7
7
|
collectionApi: CollectionApi;
|
|
8
8
|
assetApi: AssetApi;
|
|
9
9
|
accountApi: AccountApi;
|
|
10
|
+
rankingApi: RankingApi;
|
|
10
11
|
};
|
|
11
12
|
walletProvider: TronWeb;
|
|
12
13
|
accountAddress: string;
|
|
@@ -42,4 +43,16 @@ export declare class APENFTQuery extends QueryAPI {
|
|
|
42
43
|
getSentOffers(account: string, pagination?: Pagination): Promise<any>;
|
|
43
44
|
getReceivedOffers(account: string, pagination?: Pagination): Promise<any>;
|
|
44
45
|
getCollections(account: string, pagination?: Pagination): Promise<any>;
|
|
46
|
+
getAllCollections(params: {
|
|
47
|
+
sort?: CollectionSortBy;
|
|
48
|
+
pagination?: Pagination;
|
|
49
|
+
filters?: CollectionListFilterObj;
|
|
50
|
+
}): Promise<any>;
|
|
51
|
+
getCurrencies(): Promise<any>;
|
|
52
|
+
getAllAssets(params: {
|
|
53
|
+
sort: AssetSortBy;
|
|
54
|
+
pagination?: Pagination;
|
|
55
|
+
filters?: AssetQueryFilters;
|
|
56
|
+
}): Promise<any>;
|
|
57
|
+
getRankingNFTs(params: RankingDetailParams): Promise<any>;
|
|
45
58
|
}
|
|
@@ -27,6 +27,10 @@ export class APENFTQuery extends QueryAPI {
|
|
|
27
27
|
networkName,
|
|
28
28
|
account: this.accountAddress,
|
|
29
29
|
}),
|
|
30
|
+
rankingApi: new GqlApi.rankingApi({
|
|
31
|
+
networkName,
|
|
32
|
+
account: this.accountAddress,
|
|
33
|
+
}),
|
|
30
34
|
};
|
|
31
35
|
this.walletProvider = walletProvider;
|
|
32
36
|
}
|
|
@@ -358,4 +362,57 @@ export class APENFTQuery extends QueryAPI {
|
|
|
358
362
|
const data = await this.gqlApi.accountApi.getCollections(params);
|
|
359
363
|
return data === null || data === void 0 ? void 0 : data.collections;
|
|
360
364
|
}
|
|
365
|
+
async getAllCollections(params) {
|
|
366
|
+
const { sort, pagination, filters } = params || {};
|
|
367
|
+
const _params = {
|
|
368
|
+
pagination: {
|
|
369
|
+
first: (pagination === null || pagination === void 0 ? void 0 : pagination.first) || 100,
|
|
370
|
+
cursor: (pagination === null || pagination === void 0 ? void 0 : pagination.cursor) || '',
|
|
371
|
+
},
|
|
372
|
+
};
|
|
373
|
+
if (sort) {
|
|
374
|
+
_params.sort = sort;
|
|
375
|
+
}
|
|
376
|
+
if (filters) {
|
|
377
|
+
const { search, owners } = filters || {};
|
|
378
|
+
_params.search = search;
|
|
379
|
+
_params.owners = owners;
|
|
380
|
+
}
|
|
381
|
+
const data = await this.gqlApi.collectionApi.getAllCollections(_params);
|
|
382
|
+
return data;
|
|
383
|
+
}
|
|
384
|
+
async getCurrencies() {
|
|
385
|
+
var _a;
|
|
386
|
+
const data = await this.gqlApi.assetApi.getCurrencies();
|
|
387
|
+
return ((_a = data === null || data === void 0 ? void 0 : data.ui_filters) === null || _a === void 0 ? void 0 : _a.explore_currencies) || [];
|
|
388
|
+
}
|
|
389
|
+
async getAllAssets(params) {
|
|
390
|
+
const { sort, pagination, filters } = params || {};
|
|
391
|
+
const _params = {
|
|
392
|
+
sort,
|
|
393
|
+
pagination: {
|
|
394
|
+
first: (pagination === null || pagination === void 0 ? void 0 : pagination.first) || 100,
|
|
395
|
+
cursor: (pagination === null || pagination === void 0 ? void 0 : pagination.cursor) || "",
|
|
396
|
+
},
|
|
397
|
+
...(filters || {}),
|
|
398
|
+
};
|
|
399
|
+
const data = await this.gqlApi.assetApi.getAllAssets(_params);
|
|
400
|
+
return data === null || data === void 0 ? void 0 : data.assets;
|
|
401
|
+
}
|
|
402
|
+
async getRankingNFTs(params) {
|
|
403
|
+
const { sort, sort_asc, categories, is_rank_disabled, has_listing_asset, pagination } = params || {};
|
|
404
|
+
const _params = {
|
|
405
|
+
sort,
|
|
406
|
+
sort_asc,
|
|
407
|
+
pagination: {
|
|
408
|
+
first: (pagination === null || pagination === void 0 ? void 0 : pagination.first) || 100,
|
|
409
|
+
cursor: (pagination === null || pagination === void 0 ? void 0 : pagination.cursor) || '',
|
|
410
|
+
},
|
|
411
|
+
categories,
|
|
412
|
+
is_rank_disabled,
|
|
413
|
+
has_listing_asset,
|
|
414
|
+
};
|
|
415
|
+
const data = await this.gqlApi.rankingApi.getRankingDetail(_params);
|
|
416
|
+
return data;
|
|
417
|
+
}
|
|
361
418
|
}
|
|
@@ -203,19 +203,22 @@ export class ContractSchemas extends EventEmitter {
|
|
|
203
203
|
const latestBlockNumber = latestBlock.block_header.raw_data.number;
|
|
204
204
|
const txBlockNumber = output.blockNumber;
|
|
205
205
|
const confirmationNumber = latestBlockNumber - txBlockNumber;
|
|
206
|
-
// if(output.receipt && output.receipt.result === 'SUCCESS'){
|
|
207
|
-
if (confirmationNumber > 4) {
|
|
206
|
+
// // if(output.receipt && output.receipt.result === 'SUCCESS'){
|
|
207
|
+
// if (confirmationNumber > 4) {
|
|
208
|
+
// defer.eventEmitter.emit('confirmation', confirmationNumber, output, signedTransaction)
|
|
209
|
+
// if ('contract_address' in output) {
|
|
210
|
+
// output['contract_address'] = this.web3.address.fromHex(output['contract_address'])
|
|
211
|
+
// return defer.resolve(output)
|
|
212
|
+
// }
|
|
213
|
+
// }
|
|
214
|
+
// defer.eventEmitter.emit('confirming', confirmationNumber, output, signedTransaction)
|
|
215
|
+
// setTimeout(() => {
|
|
216
|
+
// checkResult(index + 1)
|
|
217
|
+
// }, 2000)
|
|
218
|
+
// // }
|
|
219
|
+
if (output.receipt && output.receipt.result === 'SUCCESS') {
|
|
208
220
|
defer.eventEmitter.emit('confirmation', confirmationNumber, output, signedTransaction);
|
|
209
|
-
if ('contract_address' in output) {
|
|
210
|
-
output['contract_address'] = this.web3.address.fromHex(output['contract_address']);
|
|
211
|
-
return defer.resolve(output);
|
|
212
|
-
}
|
|
213
221
|
}
|
|
214
|
-
defer.eventEmitter.emit('confirming', confirmationNumber, output, signedTransaction);
|
|
215
|
-
setTimeout(() => {
|
|
216
|
-
checkResult(index + 1);
|
|
217
|
-
}, 2000);
|
|
218
|
-
// }
|
|
219
222
|
};
|
|
220
223
|
if (!broadcast.code) {
|
|
221
224
|
checkResult();
|
package/dist/src/utils/check.js
CHANGED
|
@@ -76,8 +76,6 @@ export async function checkUnhashedOrder(contract, order) {
|
|
|
76
76
|
const erc20Contract = contract.erc20.clone();
|
|
77
77
|
erc20Contract.deployed = true;
|
|
78
78
|
const metadata = order.metadata;
|
|
79
|
-
console.log("order.side", order.side, OrderSide.Sell, OrderSide.Buy);
|
|
80
|
-
debugger;
|
|
81
79
|
if (order.side == OrderSide.Sell) {
|
|
82
80
|
const sell = order;
|
|
83
81
|
await checkAssetApprove(contract, sell);
|
|
@@ -416,10 +416,10 @@ export declare enum EventType {
|
|
|
416
416
|
}
|
|
417
417
|
export interface CollectionTradingHistoryParams {
|
|
418
418
|
pagination?: Pagination;
|
|
419
|
-
event_types
|
|
420
|
-
currencies
|
|
421
|
-
collections
|
|
422
|
-
user
|
|
419
|
+
event_types?: EventType[];
|
|
420
|
+
currencies?: string[];
|
|
421
|
+
collections?: string[];
|
|
422
|
+
user?: string;
|
|
423
423
|
}
|
|
424
424
|
export interface HotCollectionsParams {
|
|
425
425
|
chain: string;
|
|
@@ -462,3 +462,80 @@ export interface LowerPriceOrderParams {
|
|
|
462
462
|
id: string;
|
|
463
463
|
price: string;
|
|
464
464
|
}
|
|
465
|
+
export declare enum CollectionSortBy {
|
|
466
|
+
Volume7d = "Volume7d",
|
|
467
|
+
Volume24h = "Volume24h",
|
|
468
|
+
Volume30d = "Volume30d",
|
|
469
|
+
VolumeTotal = "VolumeTotal"
|
|
470
|
+
}
|
|
471
|
+
export declare enum CollectionListCollectionTypes {
|
|
472
|
+
MYSTERY_BOX = "MYSTERY_BOX"
|
|
473
|
+
}
|
|
474
|
+
export interface CollectionListFilters {
|
|
475
|
+
search?: string;
|
|
476
|
+
owners?: string[];
|
|
477
|
+
asset_owners?: string[];
|
|
478
|
+
asset_creators?: string[];
|
|
479
|
+
event_involved?: string[];
|
|
480
|
+
collection_types?: CollectionListCollectionTypes[];
|
|
481
|
+
}
|
|
482
|
+
export interface CollectionListFilterObj {
|
|
483
|
+
search?: string;
|
|
484
|
+
owners?: string[];
|
|
485
|
+
}
|
|
486
|
+
export interface CollectionListParams extends CollectionListFilters {
|
|
487
|
+
sort?: CollectionSortBy;
|
|
488
|
+
pagination: Pagination;
|
|
489
|
+
}
|
|
490
|
+
export interface AssetQueryParams extends AssetQueryFilters {
|
|
491
|
+
sort: AssetSortBy;
|
|
492
|
+
pagination: Pagination;
|
|
493
|
+
}
|
|
494
|
+
export interface PriceRangeFilter {
|
|
495
|
+
min?: number | string;
|
|
496
|
+
max?: number | string;
|
|
497
|
+
currency: 'TRX' | 'USD';
|
|
498
|
+
}
|
|
499
|
+
export interface AssetQueryFilters {
|
|
500
|
+
search?: string;
|
|
501
|
+
price?: PriceRangeFilter;
|
|
502
|
+
statuses?: AssetStatus[];
|
|
503
|
+
collections?: string[];
|
|
504
|
+
user_account?: string;
|
|
505
|
+
owners?: string[];
|
|
506
|
+
creators?: string[];
|
|
507
|
+
categories?: Category[];
|
|
508
|
+
currencies?: string[];
|
|
509
|
+
is_recommend?: boolean;
|
|
510
|
+
collection_types?: AssetListCollectionTypes[];
|
|
511
|
+
}
|
|
512
|
+
export declare enum AssetListCollectionTypes {
|
|
513
|
+
NORMAL = "NORMAL",
|
|
514
|
+
MYSTERY_BOX = "MYSTERY_BOX"
|
|
515
|
+
}
|
|
516
|
+
export declare enum AssetStatus {
|
|
517
|
+
BUY_NOW = "BUY_NOW",
|
|
518
|
+
ON_AUCTION = "ON_AUCTION",
|
|
519
|
+
VERIFIED = "VERIFIED",
|
|
520
|
+
HAS_OFFERS = "HAS_OFFERS"
|
|
521
|
+
}
|
|
522
|
+
export declare enum Category {
|
|
523
|
+
ART = "art",
|
|
524
|
+
COLLECTIBLES = "collectibles",
|
|
525
|
+
VIRTUAL_WORLD = "virtual-world",
|
|
526
|
+
MUSIC = "music",
|
|
527
|
+
UTILITY = "utility",
|
|
528
|
+
SPORTS = "sports",
|
|
529
|
+
TRADING_CARDS = "trading-cards",
|
|
530
|
+
DOMAIN_NAMES = "domain-names"
|
|
531
|
+
}
|
|
532
|
+
export interface RankingDetailParams extends Partial<RankingDetailFilters> {
|
|
533
|
+
sort: CollectionSortBy;
|
|
534
|
+
sort_asc: boolean;
|
|
535
|
+
pagination: Pagination;
|
|
536
|
+
}
|
|
537
|
+
export interface RankingDetailFilters {
|
|
538
|
+
categories: Category[];
|
|
539
|
+
is_rank_disabled: boolean;
|
|
540
|
+
has_listing_asset: boolean;
|
|
541
|
+
}
|
package/dist/src/utils/types.js
CHANGED
|
@@ -124,3 +124,38 @@ export var EventType;
|
|
|
124
124
|
EventType["Burn"] = "Burn";
|
|
125
125
|
EventType["Sale"] = "Sale";
|
|
126
126
|
})(EventType || (EventType = {}));
|
|
127
|
+
// 24h, 7d, 30d, Total
|
|
128
|
+
export var CollectionSortBy;
|
|
129
|
+
(function (CollectionSortBy) {
|
|
130
|
+
CollectionSortBy["Volume7d"] = "Volume7d";
|
|
131
|
+
CollectionSortBy["Volume24h"] = "Volume24h";
|
|
132
|
+
CollectionSortBy["Volume30d"] = "Volume30d";
|
|
133
|
+
CollectionSortBy["VolumeTotal"] = "VolumeTotal";
|
|
134
|
+
})(CollectionSortBy || (CollectionSortBy = {}));
|
|
135
|
+
export var CollectionListCollectionTypes;
|
|
136
|
+
(function (CollectionListCollectionTypes) {
|
|
137
|
+
CollectionListCollectionTypes["MYSTERY_BOX"] = "MYSTERY_BOX";
|
|
138
|
+
})(CollectionListCollectionTypes || (CollectionListCollectionTypes = {}));
|
|
139
|
+
export var AssetListCollectionTypes;
|
|
140
|
+
(function (AssetListCollectionTypes) {
|
|
141
|
+
AssetListCollectionTypes["NORMAL"] = "NORMAL";
|
|
142
|
+
AssetListCollectionTypes["MYSTERY_BOX"] = "MYSTERY_BOX";
|
|
143
|
+
})(AssetListCollectionTypes || (AssetListCollectionTypes = {}));
|
|
144
|
+
export var AssetStatus;
|
|
145
|
+
(function (AssetStatus) {
|
|
146
|
+
AssetStatus["BUY_NOW"] = "BUY_NOW";
|
|
147
|
+
AssetStatus["ON_AUCTION"] = "ON_AUCTION";
|
|
148
|
+
AssetStatus["VERIFIED"] = "VERIFIED";
|
|
149
|
+
AssetStatus["HAS_OFFERS"] = "HAS_OFFERS";
|
|
150
|
+
})(AssetStatus || (AssetStatus = {}));
|
|
151
|
+
export var Category;
|
|
152
|
+
(function (Category) {
|
|
153
|
+
Category["ART"] = "art";
|
|
154
|
+
Category["COLLECTIBLES"] = "collectibles";
|
|
155
|
+
Category["VIRTUAL_WORLD"] = "virtual-world";
|
|
156
|
+
Category["MUSIC"] = "music";
|
|
157
|
+
Category["UTILITY"] = "utility";
|
|
158
|
+
Category["SPORTS"] = "sports";
|
|
159
|
+
Category["TRADING_CARDS"] = "trading-cards";
|
|
160
|
+
Category["DOMAIN_NAMES"] = "domain-names";
|
|
161
|
+
})(Category || (Category = {}));
|
package/package.json
CHANGED
|
@@ -1,58 +1,59 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
2
|
+
"name": "apenft-js-tron",
|
|
3
|
+
"version": "2.1.2-beta.1",
|
|
4
|
+
"description": "Javascript SDK for the APENFT ",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"author": "Project APENFT Developers",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "rm -rf dist",
|
|
9
|
+
"dev": "npm run clean && tsc -w -p tsconfig.dev.json",
|
|
10
|
+
"eslint": "eslint --fix src --ext .ts --max-warnings=0",
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"webpack": "webpack --mode production",
|
|
13
|
+
"test": "jest"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@babel/core": "^7.17.5",
|
|
17
|
+
"@babel/preset-env": "^7.16.11",
|
|
18
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
19
|
+
"@types/crypto-js": "^4.0.2",
|
|
20
|
+
"babel-jest": "^27.5.1",
|
|
21
|
+
"bignumber.js": "^9.0.1",
|
|
22
|
+
"crypto-js": "^4.1.1",
|
|
23
|
+
"dotenv": "^16.0.0",
|
|
24
|
+
"ethereumjs-util": "^7.1.0",
|
|
25
|
+
"graphql": "^15.5.1",
|
|
26
|
+
"graphql-request": "^3.5.0",
|
|
27
|
+
"isomorphic-unfetch": "^3.1.0",
|
|
28
|
+
"node-polyfill-webpack-plugin": "^2.0.1",
|
|
29
|
+
"tronweb": "^4.3.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@maticnetwork/maticjs": "^2.0.45",
|
|
33
|
+
"@types/chai": "^4.2.21",
|
|
34
|
+
"@types/jest": "^27.4.1",
|
|
35
|
+
"@types/node": "^12.12.6",
|
|
36
|
+
"@types/node-fetch": "^2.5.10",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^4.29.2",
|
|
38
|
+
"@typescript-eslint/parser": "^4.29.2",
|
|
39
|
+
"chai": "^4.3.4",
|
|
40
|
+
"eslint": "^7.32.0",
|
|
41
|
+
"https-proxy-agent": "^5.0.0",
|
|
42
|
+
"jest": "^27.5.1",
|
|
43
|
+
"mocha": "^9.0.3",
|
|
44
|
+
"mocha-typescript": "^1.1.17",
|
|
45
|
+
"node-fetch": "^2.6.1",
|
|
46
|
+
"prettier": "^2.2.1",
|
|
47
|
+
"tronweb-typings": "^1.0.1",
|
|
48
|
+
"ts-loader": "^9.4.2",
|
|
49
|
+
"ts-node": "^9.1.1",
|
|
50
|
+
"typescript": "^4.9.5",
|
|
51
|
+
"webpack": "^5.75.0",
|
|
52
|
+
"webpack-cli": "^5.0.1"
|
|
53
|
+
},
|
|
54
|
+
"jest": {
|
|
55
|
+
"testEnvironment": "node",
|
|
56
|
+
"testTimeout": 1000000
|
|
57
|
+
},
|
|
58
|
+
"license": "MIT"
|
|
58
59
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"include": ["**/*.ts"],
|
|
3
3
|
"exclude": [
|
|
4
|
-
"node_modules"
|
|
4
|
+
"node_modules",
|
|
5
|
+
"dist"
|
|
5
6
|
],
|
|
6
7
|
"compilerOptions": {
|
|
7
8
|
"outDir": "dist",
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
"strict": true,
|
|
14
15
|
"esModuleInterop": true,
|
|
15
16
|
"skipLibCheck": true,
|
|
16
|
-
"forceConsistentCasingInFileNames": true
|
|
17
|
+
"forceConsistentCasingInFileNames": true,
|
|
18
|
+
"moduleResolution": "node"
|
|
17
19
|
}
|
|
18
20
|
}
|