apenft-js-tron 1.0.0

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.
Files changed (55) hide show
  1. package/README.md +1141 -0
  2. package/babel.config.js +4 -0
  3. package/dist/bundle.js +2 -0
  4. package/dist/bundle.js.LICENSE.txt +28 -0
  5. package/dist/index.d.ts +9 -0
  6. package/dist/src/config.d.ts +57 -0
  7. package/dist/src/queryAPI/graphql/accountApi.d.ts +11 -0
  8. package/dist/src/queryAPI/graphql/assetApi.d.ts +13 -0
  9. package/dist/src/queryAPI/graphql/base.d.ts +37 -0
  10. package/dist/src/queryAPI/graphql/collectionApi.d.ts +10 -0
  11. package/dist/src/queryAPI/graphql/gql/account.d.ts +6 -0
  12. package/dist/src/queryAPI/graphql/gql/asset.d.ts +8 -0
  13. package/dist/src/queryAPI/graphql/gql/collection.d.ts +5 -0
  14. package/dist/src/queryAPI/graphql/gql/fragments.d.ts +8 -0
  15. package/dist/src/queryAPI/graphql/index.d.ts +9 -0
  16. package/dist/src/queryAPI/index.d.ts +45 -0
  17. package/dist/src/queryAPI/restful/base.d.ts +50 -0
  18. package/dist/src/queryAPI/restful/index.d.ts +1 -0
  19. package/dist/src/queryAPI/restful/queryAPI.d.ts +26 -0
  20. package/dist/src/schemas/common/ERC1155/index.d.ts +7 -0
  21. package/dist/src/schemas/common/ERC20/index.d.ts +6 -0
  22. package/dist/src/schemas/common/ERC721/index.d.ts +5 -0
  23. package/dist/src/schemas/common/Element/exchange.d.ts +9 -0
  24. package/dist/src/schemas/common/Element/registry.d.ts +4 -0
  25. package/dist/src/schemas/common/ens.d.ts +7 -0
  26. package/dist/src/schemas/index.d.ts +18 -0
  27. package/dist/src/schemas/schemasFunctions.d.ts +24 -0
  28. package/dist/src/schemas/shasta/index.d.ts +1 -0
  29. package/dist/src/schemas/tron/index.d.ts +1 -0
  30. package/dist/src/tokens/index.d.ts +4 -0
  31. package/dist/src/tokens/shasta/index.d.ts +1 -0
  32. package/dist/src/tokens/tron/index.d.ts +1 -0
  33. package/dist/src/tradeAPI/account.d.ts +33 -0
  34. package/dist/src/tradeAPI/approve.d.ts +3 -0
  35. package/dist/src/tradeAPI/base.d.ts +40 -0
  36. package/dist/src/tradeAPI/contractSchemas.d.ts +28 -0
  37. package/dist/src/tradeAPI/contracts.d.ts +29 -0
  38. package/dist/src/tradeAPI/index.d.ts +25 -0
  39. package/dist/src/tradeAPI/nft.d.ts +42 -0
  40. package/dist/src/tradeAPI/orders.d.ts +69 -0
  41. package/dist/src/tradeAPI/ordersApi.d.ts +54 -0
  42. package/dist/src/utils/Abi.d.ts +18 -0
  43. package/dist/src/utils/PromiEvent.d.ts +21 -0
  44. package/dist/src/utils/check.d.ts +25 -0
  45. package/dist/src/utils/constants.d.ts +22 -0
  46. package/dist/src/utils/error.d.ts +20 -0
  47. package/dist/src/utils/fees.d.ts +40 -0
  48. package/dist/src/utils/helper.d.ts +23 -0
  49. package/dist/src/utils/makeOrder.d.ts +80 -0
  50. package/dist/src/utils/types.d.ts +464 -0
  51. package/dist/src/utils/utils.d.ts +1 -0
  52. package/index.ts +15 -0
  53. package/package.json +58 -0
  54. package/tsconfig.json +18 -0
  55. package/webpack.config.js +33 -0
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * The buffer module from node.js, for the browser.
3
+ *
4
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
5
+ * @license MIT
6
+ */
7
+
8
+ /*!
9
+ * The buffer module from node.js, for the browser.
10
+ *
11
+ * @author Feross Aboukhadijeh <https://feross.org>
12
+ * @license MIT
13
+ */
14
+
15
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
16
+
17
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
18
+
19
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
20
+
21
+ /**
22
+ * [js-sha3]{@link https://github.com/emn178/js-sha3}
23
+ *
24
+ * @version 0.8.0
25
+ * @author Chen, Yi-Cyuan [emn178@gmail.com]
26
+ * @copyright Chen, Yi-Cyuan 2015-2018
27
+ * @license MIT
28
+ */
@@ -0,0 +1,9 @@
1
+ export { APENFTOrders } from './src/tradeAPI';
2
+ export { APENFTQuery } from './src/queryAPI';
3
+ export { initApprove } from './src/tradeAPI/approve';
4
+ export { Network, MakeOrderType, APENFTSchemaName, OrderSide } from './src/utils/types';
5
+ export { AssetFactory } from './src/tradeAPI/nft';
6
+ export type { APIConfig } from './src/utils/types';
7
+ export { toBaseUnitAmount, getSchemaList, makeBigNumber, } from './src/utils/helper';
8
+ export { NULL_ADDRESS } from './src/utils/constants';
9
+ export { APENFTError } from './src/utils/error';
@@ -0,0 +1,57 @@
1
+ import { Network } from './utils/types';
2
+ export declare const CHAIN_ID: {
3
+ [key: string]: number;
4
+ };
5
+ export declare const HOST_CHAINNAME: {
6
+ [key: string]: Network;
7
+ };
8
+ export declare const ID_CHAINNAME: {
9
+ [key: number]: Network;
10
+ };
11
+ export declare const CHAIN: {
12
+ [key: string]: string;
13
+ };
14
+ export declare const API_BASE_URL: {
15
+ [key: string]: {
16
+ api: string;
17
+ key: string;
18
+ secret: string;
19
+ api2: string;
20
+ apenftBaseApiUrl: string;
21
+ };
22
+ };
23
+ export declare const NULL_ADDRESS = "T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb";
24
+ export declare const GasPrice_NOW: {
25
+ url: string;
26
+ type: string;
27
+ };
28
+ export declare const GasLimitOffset = 1.18;
29
+ export declare enum TRON_CONTRACTS_ADDRESSES_BASE58 {
30
+ ERC20AssetProxy = "TRgSk4foxSg4JaV2EjNz8qzaNrBhUtWUnz",
31
+ ERC721AssetProxy = "TRJ54KCbg29a4nb8LVPgNp61o2ity2WkDu",
32
+ ERC1155AssetProxy = "TQPdK4DutVPkFhcWP6KqshpyRBT95zS2CE",
33
+ APENFTExchange = "TQr5axvJzETeHsUiXv6QjBEh1BKH571AZu",
34
+ ExchangeHelper = "TYxaWsBNMtE9L1bsUUdXCKm99Ab2jziEbA",
35
+ APENFTExchangeKeeper = "TEQAs54FPKYQdTZAPyT3okfbq2MH4dEeP1",
36
+ APENFTSharedAsset = "TG8UTFQfcmyqb3bSjqK1svTtzrn2mLcUXS",
37
+ FeeRecipientAddress = "TPyjyZfsYaXStgz2NmAraF1uZcMtkgNan5",
38
+ WTRX = "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR"
39
+ }
40
+ export declare enum SHASTA_CONTRACTS_ADDRESSES_BASE58 {
41
+ ERC20AssetProxy = "TC7G2nApC3WKGkkkrppUJSmNSnj7KYkaiq",
42
+ ERC721AssetProxy = "TVDuLb8zE9mcMJqMtUD1gMTnFKRZduwhb7",
43
+ ERC1155AssetProxy = "TEHxYWo9AkzMy2CFAghQQgBNCgBMqtZGKa",
44
+ APENFTExchange = "TYnuR3ripQNZUYUvjkjzbwQ48zHKdAtzis",
45
+ ExchangeHelper = "TCWuXtzPEqKJ2MLygtCr27i1ehYFJKDBdT",
46
+ APENFTExchangeKeeper = "TEdP593yFJkAiBzwdT56JrXW1pohsTA4ag",
47
+ APENFTSharedAsset = "TG8UTFQfcmyqb3bSjqK1svTtzrn2mLcUXS",
48
+ FeeRecipientAddress = "TRxMn4k6ZpPhHLEqVojaXRzr3PP3p3B9KE",
49
+ WTRX = "TF2ipqRnrDzuPrANJCJggmaM753FCE1ZWE",
50
+ ERC721Asset = "TKGSPEk2FLrEod8bTLCxxS9AbeXvYe21aC",
51
+ ERC20Asset = "TTRjXLinU9FAZETtL5TDNsQGd7sc7Hu26T",
52
+ ERC1155Asset = "TD34cLBPdDhjRHDgiWkG42LnbCZk5fP2fP",
53
+ FactoryContract = ""
54
+ }
55
+ export declare const CONTRACTS_ADDRESSES: {
56
+ [key: string]: any;
57
+ };
@@ -0,0 +1,11 @@
1
+ import { APIConfig, AddressParams, SearchParams, UserAssetOffersParams, UserAssetParams } from "../../utils/types";
2
+ import { GraphqlApi } from "./base";
3
+ export declare class AccountApi extends GraphqlApi {
4
+ constructor(config: APIConfig);
5
+ getUser(params: AddressParams): Promise<any>;
6
+ getUsers(params: SearchParams): Promise<any>;
7
+ getCollections(params: UserAssetParams): Promise<any>;
8
+ getUserSentOffers(params: UserAssetOffersParams): Promise<any>;
9
+ getUserReceivedOffers(params: UserAssetOffersParams): Promise<any>;
10
+ getAssets(params: UserAssetParams): Promise<any>;
11
+ }
@@ -0,0 +1,13 @@
1
+ import { APIConfig, AssetListingsParams, AssetDetailParams, AssetMoreParams, AssetTradingHistory } from "../../utils/types";
2
+ import { GraphqlApi } from "./base";
3
+ export declare class AssetApi extends GraphqlApi {
4
+ constructor(config: APIConfig);
5
+ getAssetListings(params: AssetListingsParams): Promise<any>;
6
+ getAssetOffers(params: AssetListingsParams): Promise<any>;
7
+ getAssetDetail(params: AssetDetailParams): Promise<any>;
8
+ getAssetTradingHistory(params: AssetTradingHistory): Promise<any>;
9
+ getAssetMoreCollection(params: AssetMoreParams): Promise<any>;
10
+ getAssetListingInfo(params: AssetDetailParams): Promise<any>;
11
+ getAssetSales(params: AssetDetailParams): Promise<any>;
12
+ getAssetBids(params: AssetDetailParams): Promise<any>;
13
+ }
@@ -0,0 +1,37 @@
1
+ import { GraphQLClient } from 'graphql-request';
2
+ import { Network, APIConfig, Token } from '../../utils/types';
3
+ export declare class GraphqlApi implements APIConfig {
4
+ networkName: Network;
5
+ account: string;
6
+ /**
7
+ * Base url for the API
8
+ */
9
+ readonly apiBaseUrl: string;
10
+ gqlClient: GraphQLClient;
11
+ /**
12
+ * Logger function to use when debugging
13
+ */
14
+ private appKey;
15
+ private appSecret;
16
+ chain: string;
17
+ private chainId;
18
+ walletChainId: string;
19
+ /**
20
+ * Create an instance of the APENFT API
21
+ * @param config APIConfig for setting up the API, including an optional API key, network name, and base URL
22
+ * @param logger Optional function for logging debug strings before and after requests are made
23
+ */
24
+ constructor(config: APIConfig);
25
+ paymentTokens?: Token[] | undefined;
26
+ private getAPISign;
27
+ blockChainRequest({ funcName, gql, params }: {
28
+ funcName: string;
29
+ gql: string;
30
+ params: any;
31
+ }): Promise<any>;
32
+ putRequest({ funcName, gql, params }: {
33
+ funcName: string;
34
+ gql: string;
35
+ params: any;
36
+ }): Promise<any>;
37
+ }
@@ -0,0 +1,10 @@
1
+ import { APIConfig, CollectionTradeTrendParams, AddressParams, CollectionTradingHistoryParams, HotCollectionsParams } from "../../utils/types";
2
+ import { GraphqlApi } from "./base";
3
+ export declare class CollectionApi extends GraphqlApi {
4
+ constructor(config: APIConfig);
5
+ getSingleCollectionInfo(params: AddressParams): Promise<any>;
6
+ getCollectionTradeTrend(params: CollectionTradeTrendParams): Promise<any>;
7
+ getSingleCollectionAttributes(params: AddressParams): Promise<any>;
8
+ getCollectionTradingHistory(params: CollectionTradingHistoryParams): Promise<any>;
9
+ getHotCollections(params: HotCollectionsParams): Promise<any>;
10
+ }
@@ -0,0 +1,6 @@
1
+ export declare const getUser: string;
2
+ export declare const getUsers: string;
3
+ export declare const getCollections: string;
4
+ export declare const getUserSentOffers: string;
5
+ export declare const getUserReceivedOffers: string;
6
+ export declare const getAssets: string;
@@ -0,0 +1,8 @@
1
+ export declare const getAssetDetail: string;
2
+ export declare const getAssetListings: string;
3
+ export declare const getAssetOffers: string;
4
+ export declare const getAssetTradingHistory: string;
5
+ export declare const getAssetMoreCollection: string;
6
+ export declare const getAssetListingInfo: string;
7
+ export declare const getAssetSales: string;
8
+ export declare const getAssetBids: string;
@@ -0,0 +1,5 @@
1
+ export declare const getCollectionTradeTrend: string;
2
+ export declare const getSingleCollectionAttributes: string;
3
+ export declare const getSingleCollectionInfo: string;
4
+ export declare const getCollectionTradingHistory: string;
5
+ export declare const getHotCollections: string;
@@ -0,0 +1,8 @@
1
+ export declare const PAGINATION_FIELDS: string;
2
+ export declare const USER_FIELDS: string;
3
+ export declare const CURRENCY_FIELDS: string;
4
+ export declare const ASKS_FIELDS: string;
5
+ export declare const BIDS_FIELDS: string;
6
+ export declare const SALES_FIELDS: string;
7
+ export declare const ASSETS_FIELDS: string;
8
+ export declare const ORDER_FIELDS: string;
@@ -0,0 +1,9 @@
1
+ import { CollectionApi } from "./collectionApi";
2
+ import { AssetApi } from "./assetApi";
3
+ import { AccountApi } from "./accountApi";
4
+ export declare const GqlApi: {
5
+ collectionApi: typeof CollectionApi;
6
+ assetApi: typeof AssetApi;
7
+ accountApi: typeof AccountApi;
8
+ };
9
+ export { CollectionApi, AssetApi, AccountApi };
@@ -0,0 +1,45 @@
1
+ import { QueryAPI } from "./restful/queryAPI";
2
+ import { CollectionApi, AssetApi, AccountApi } from "./graphql";
3
+ import TronWeb from "tronweb";
4
+ import { APIConfig, AddressParams, CollectionTradeTrendParams, CollectionTradingHistoryParams, HotCollectionsParams, FixPriceOrderParams, EnglishAuctionOrderParams, LowerPriceOrderParams, Pagination } from "../utils/types";
5
+ export declare class APENFTQuery extends QueryAPI {
6
+ gqlApi: {
7
+ collectionApi: CollectionApi;
8
+ assetApi: AssetApi;
9
+ accountApi: AccountApi;
10
+ };
11
+ walletProvider: TronWeb;
12
+ accountAddress: string;
13
+ constructor(walletProvider: TronWeb, apiConfig: APIConfig, walletAccount?: {
14
+ address?: string;
15
+ privateKey?: string;
16
+ });
17
+ getSingleCollectionInfo(address: string): Promise<any>;
18
+ getCollectionTradeTrend({ days, collection, }: CollectionTradeTrendParams): Promise<any>;
19
+ getSingleCollectionAttributes({ address, }: AddressParams): Promise<any>;
20
+ getCollectionTradingHistory({ pagination, event_types, currencies, collections, user, }: CollectionTradingHistoryParams): Promise<any>;
21
+ getHotCollections({ chain, is_recommend, }: HotCollectionsParams): Promise<any>;
22
+ getAssetListingOrders(collection: string, id: string, pagination?: Pagination): Promise<any>;
23
+ getAssetOffers(collection: string, id: string, pagination?: Pagination): Promise<any>;
24
+ getAssetDetail(collection: string, id: string): Promise<any>;
25
+ getAssetTradingHistory(collection: string, id: string, pagination?: Pagination): Promise<any>;
26
+ getCollectionAssetsList(collection: string, pagination?: Pagination): Promise<any>;
27
+ getAssetBestAskOrderInfo(collection: string, id: string): Promise<any>;
28
+ getAssetBidInfo(collection: string, id: string): Promise<any>;
29
+ getAssetBidOrderParams(collection: string, id: string, price?: number, currencyUnit?: string): Promise<any>;
30
+ getEnglishAuctionOrderParams({ collection, id, bidPrice, reservePrice, currency, expirationTime, }: EnglishAuctionOrderParams): Promise<any>;
31
+ getFixPriceOrderParams({ collection, id, price, currency, expirationTime, buyerAddress, }: FixPriceOrderParams): Promise<any>;
32
+ getEnglishAuctionBiddingOrderParams({ collection, id, price, currency, }: FixPriceOrderParams): Promise<any>;
33
+ getLowerPriceOrderParams({ collection, id, price, }: LowerPriceOrderParams): Promise<any>;
34
+ getMakeOfferOrderOrderParams({ collection, id, price, currency, expirationTime, }: FixPriceOrderParams): Promise<any>;
35
+ getTransferParams(collection: string, id: string): Promise<any>;
36
+ private getAssetFormatData;
37
+ getAssetSaleInfo(collection: string, id: string): Promise<any>;
38
+ getAssetSales(collection: string, id: string): Promise<any>;
39
+ getAssetBids(collection: string, id: string): Promise<any>;
40
+ getAssetListings(collection: string, id: string): Promise<any>;
41
+ getAssetsList(account: string, pagination?: Pagination): Promise<any>;
42
+ getSentOffers(account: string, pagination?: Pagination): Promise<any>;
43
+ getReceivedOffers(account: string, pagination?: Pagination): Promise<any>;
44
+ getCollections(account: string, pagination?: Pagination): Promise<any>;
45
+ }
@@ -0,0 +1,50 @@
1
+ import { APIConfig } from '../../utils/types';
2
+ export declare class Fetch {
3
+ /**
4
+ * Page size to use for fetching orders
5
+ */
6
+ apiBaseUrl: string;
7
+ authToken: string;
8
+ chain: string;
9
+ /**
10
+ * Logger function to use when debugging
11
+ */
12
+ logger: (arg: string) => void;
13
+ constructor(url: string, config: APIConfig, logger?: (arg: string) => void);
14
+ /**
15
+ * Get JSON data from API, sending auth token in headers
16
+ * @param url Path to URL endpoint under API
17
+ * @param body Data to send. Will be stringified using QueryString
18
+ */
19
+ get(url: string, body?: {
20
+ [key: string]: any;
21
+ }): Promise<any>;
22
+ /**
23
+ * POST JSON data to API, sending auth token in headers
24
+ * @param apiPath Path to URL endpoint under API
25
+ * @param body Data to send. Will be JSON.stringified
26
+ * @param opts RequestInit opts, similar to Fetch API. If it contains
27
+ * a body, it won't be stringified.
28
+ */
29
+ post(apiPath: string, body?: {
30
+ [key: string]: any;
31
+ }, opts?: RequestInit): Promise<any>;
32
+ /**
33
+ * PUT JSON data to API, sending auth token in headers
34
+ * @param apiPath Path to URL endpoint under API
35
+ * @param body Data to send
36
+ * @param opts RequestInit opts, similar to Fetch API. If it contains
37
+ * a body, it won't be stringified.
38
+ */
39
+ put(apiPath: string, body?: {
40
+ [key: string]: any;
41
+ }, opts?: RequestInit): Promise<any>;
42
+ /**
43
+ * Get from an API Endpoint, sending auth token in headers
44
+ * @param apiPath Path to URL endpoint under API
45
+ * @param opts RequestInit opts, similar to Fetch API
46
+ */
47
+ private _fetch;
48
+ private _handleApiResponse;
49
+ throwOrContinue(error: any, retries: number): void;
50
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import { APIConfig, OrderType } from '../../utils/types';
2
+ import { Fetch } from './base';
3
+ export interface ChainInfo {
4
+ chain?: string;
5
+ chainId?: string;
6
+ }
7
+ export interface OrderQueryParams extends ChainInfo {
8
+ assetContractAddress: string;
9
+ tokenId: string;
10
+ orderType: OrderType;
11
+ }
12
+ export declare class QueryAPI extends Fetch {
13
+ /**
14
+ * Page size to use for fetching orders
15
+ */
16
+ pageSize: number;
17
+ /**
18
+ * Logger function to use when debugging
19
+ */
20
+ logger: (arg: string) => void;
21
+ chain: string;
22
+ chainId: number;
23
+ walletChainId: string;
24
+ chainInfo: ChainInfo;
25
+ constructor(config: APIConfig, logger?: (arg: string) => void);
26
+ }
@@ -0,0 +1,7 @@
1
+ export interface SemiFungibleTradeType {
2
+ id: string;
3
+ address: string;
4
+ quantity: string;
5
+ data: string;
6
+ }
7
+ export declare const ERC1155Schema: any;
@@ -0,0 +1,6 @@
1
+ export interface FungibleTradeType {
2
+ address: string;
3
+ account: string;
4
+ quantity: string;
5
+ }
6
+ export declare const ERC20Schema: any;
@@ -0,0 +1,5 @@
1
+ export interface NonFungibleContractType {
2
+ id: string;
3
+ address: string;
4
+ }
5
+ export declare const ERC721Schema: any;
@@ -0,0 +1,9 @@
1
+ export interface Exchange {
2
+ address: string;
3
+ sell?: Array<any>;
4
+ sellSig?: Array<any>;
5
+ buy?: Array<any>;
6
+ buySig?: Array<any>;
7
+ metadata?: string;
8
+ }
9
+ export declare const APENFTExchangeSchemas: any;
@@ -0,0 +1,4 @@
1
+ export interface Registry {
2
+ address: string;
3
+ }
4
+ export declare const APENFTRegistrySchemas: any;
@@ -0,0 +1,7 @@
1
+ export interface ENSName {
2
+ nodeHash: string;
3
+ nameHash: string;
4
+ name: string;
5
+ }
6
+ export declare const namehash: (name: string) => string;
7
+ export declare const nodehash: (name: string) => string;
@@ -0,0 +1,18 @@
1
+ import { ExchangeMetadata } from '../utils/types';
2
+ import { encodeBuy, encodeSell, encodeCall, encodeWeb3Call, encodeParamsCall, getParams } from './schemasFunctions';
3
+ export { encodeBuy, encodeSell, encodeCall, encodeWeb3Call, encodeParamsCall, getParams };
4
+ export declare const schemas: {
5
+ tron: any[];
6
+ shasta: any[];
7
+ };
8
+ export declare const common: {
9
+ APENFTRegistrySchemas: any;
10
+ APENFTExchangeSchemas: any;
11
+ ERC20Schema: any;
12
+ ERC721Schema: any;
13
+ ERC1155Schema: any;
14
+ };
15
+ export declare function getBalanceSchemas(metadata: ExchangeMetadata): any;
16
+ export declare function getIsApproveSchemas(metadata: ExchangeMetadata): any;
17
+ export declare function getApproveSchemas(metadata: ExchangeMetadata): any;
18
+ export declare function getTransferSchemas(metadata: ExchangeMetadata): any;
@@ -0,0 +1,24 @@
1
+ import { AnnotatedFunctionABI, FunctionInputKind, OfferType } from '../utils/types';
2
+ export declare const encodeReplacementPattern: ReplacementEncoder;
3
+ export declare const encodeCall: (abi: AnnotatedFunctionABI, parameters: Array<any>) => string;
4
+ export declare const encodeWeb3Call: (abi: AnnotatedFunctionABI, parameters: Array<any>) => string;
5
+ export declare const getParams: (abi: AnnotatedFunctionABI, { owner, replace }: {
6
+ owner?: string | undefined;
7
+ replace?: string | boolean | undefined;
8
+ }) => any[];
9
+ export declare const encodeParamsCall: (abi: AnnotatedFunctionABI, { owner, replace }: {
10
+ owner?: string | undefined;
11
+ replace?: string | boolean | undefined;
12
+ }) => string;
13
+ export interface CallSpec {
14
+ target: string;
15
+ dataToCall: string;
16
+ replacementPattern: string;
17
+ }
18
+ export type SellEncoder<T> = (schema: any, asset: T, address: string) => CallSpec;
19
+ export declare const encodeSell: SellEncoder<any>;
20
+ export type BuyEncoder<T> = (schema: any, asset: T, address: string, type?: OfferType) => CallSpec;
21
+ export declare const encodeBuy: BuyEncoder<any>;
22
+ export type DefaultCallEncoder = (abi: AnnotatedFunctionABI, address: string) => string;
23
+ export declare const encodeDefaultCall: DefaultCallEncoder;
24
+ export type ReplacementEncoder = (abi: AnnotatedFunctionABI, kind?: FunctionInputKind) => string;
@@ -0,0 +1 @@
1
+ export declare const shastaSchemas: Array<any>;
@@ -0,0 +1 @@
1
+ export declare const tronSchemas: Array<any>;
@@ -0,0 +1,4 @@
1
+ export declare const tokens: {
2
+ tron: any;
3
+ shasta: any;
4
+ };
@@ -0,0 +1 @@
1
+ export declare const shastaTokens: any;
@@ -0,0 +1 @@
1
+ export declare const tronTokens: any;
@@ -0,0 +1,33 @@
1
+ import { TronWeb, BuyOrderApprove, APIConfig, ExchangeMetadata, OrderSide, SellOrderApprove } from '../utils/types';
2
+ import { BigNumber } from '../utils/constants';
3
+ import { CreateOrderParams } from '../utils/types';
4
+ import { ContractSchemas } from './contractSchemas';
5
+ import { Contracts } from './contracts';
6
+ export declare class Account extends ContractSchemas {
7
+ account: string;
8
+ accountProxy: string;
9
+ contracts: Contracts;
10
+ constructor(web3: TronWeb, apiConfig: APIConfig);
11
+ private getTokenApprove;
12
+ private getAssetApprove;
13
+ private orderApprove;
14
+ getOrderApproveStep(params: CreateOrderParams, side: OrderSide, startAmount: number): Promise<SellOrderApprove | BuyOrderApprove>;
15
+ private orderApproveCalldata;
16
+ getAccountProxy(schemaName: string): Promise<string>;
17
+ checkTokenTransferProxy(to: string): Promise<BigNumber>;
18
+ getTokenBalances(to: string, account?: string): Promise<string>;
19
+ getAssetBalances(metadata: ExchangeMetadata, account?: string): Promise<string>;
20
+ approveTokenTransferProxy(tokenAddr: string): Promise<any>;
21
+ approveTokenTransferProxyCalldata(tokenAddr: string): any;
22
+ checkAssetTransferProxy(metadata: ExchangeMetadata): Promise<boolean>;
23
+ approveAssetTransferProxy(metadata: ExchangeMetadata): Promise<any>;
24
+ approveAssetTransferProxyCalldata(metadata: ExchangeMetadata, operator: string): any;
25
+ orderMatch({ buy, sell, metadata }: {
26
+ buy: any;
27
+ sell: any;
28
+ metadata?: string;
29
+ }): Promise<any>;
30
+ orderCancel(order: any): Promise<any>;
31
+ assetTransfer(metadata: ExchangeMetadata, to: string): Promise<any>;
32
+ accountApprove(error: any): Promise<any>;
33
+ }
@@ -0,0 +1,3 @@
1
+ export declare const isSellOrderHandle: (orderType: any) => boolean;
2
+ export declare const isBuyOrderHandle: (orderType: any) => boolean;
3
+ export declare const initApprove: ({ APENFTOrders, orderType, orderParams }: any) => Promise<boolean>;
@@ -0,0 +1,40 @@
1
+ export declare class Fetch {
2
+ /**
3
+ * Page size to use for fetching orders
4
+ */
5
+ apiBaseUrl: string;
6
+ authToken: string;
7
+ constructor(url: string);
8
+ /**
9
+ * Get JSON data from API, sending auth token in headers
10
+ * @param apiPath Path to URL endpoint under API
11
+ * @param query Data to send. Will be stringified using QueryString
12
+ */
13
+ get(url: string): Promise<any>;
14
+ /**
15
+ * POST JSON data to API, sending auth token in headers
16
+ * @param apiPath Path to URL endpoint under API
17
+ * @param body Data to send. Will be JSON.stringified
18
+ * @param opts RequestInit opts, similar to Fetch API. If it contains
19
+ * a body, it won't be stringified.
20
+ */
21
+ post(apiPath: string, body?: {
22
+ [key: string]: any;
23
+ }, opts?: RequestInit): Promise<any>;
24
+ /**
25
+ * PUT JSON data to API, sending auth token in headers
26
+ * @param apiPath Path to URL endpoint under API
27
+ * @param body Data to send
28
+ * @param opts RequestInit opts, similar to Fetch API. If it contains
29
+ * a body, it won't be stringified.
30
+ */
31
+ put(apiPath: string, body: any, opts?: RequestInit): Promise<any>;
32
+ /**
33
+ * Get from an API Endpoint, sending auth token in headers
34
+ * @param apiPath Path to URL endpoint under API
35
+ * @param opts RequestInit opts, similar to Fetch API
36
+ */
37
+ private _fetch;
38
+ private _handleApiResponse;
39
+ throwOrContinue(error: any, retries: number): void;
40
+ }
@@ -0,0 +1,28 @@
1
+ /// <reference types="node" />
2
+ import TronWeb from "tronweb";
3
+ import { EventEmitter } from 'events';
4
+ import { Token } from "../utils/types";
5
+ export declare class ContractSchemas extends EventEmitter {
6
+ web3: TronWeb;
7
+ networkName: string;
8
+ chainId: number;
9
+ contractsAddr: any;
10
+ WTRXAddr: string;
11
+ APENFTSharedAssetAddr: string;
12
+ APENFTExchangeKeeperAddr: string;
13
+ feeRecipientAddress: string;
14
+ APENFTExchange: string;
15
+ erc20AssetProxy: string;
16
+ erc721AssetProxy: string;
17
+ erc1155AssetProxy: string;
18
+ WTRXToken: Token;
19
+ paymentTokenList: Array<Token>;
20
+ TRX: Token;
21
+ Erc20Func: any;
22
+ APENFTRegistryFunc: any;
23
+ APENFTExchangeFunc: any;
24
+ constructor(web3: any, apiConfig: any);
25
+ getGasPrice(): Promise<number>;
26
+ tronCall(transactionConfig: any, outputs: any[]): Promise<any>;
27
+ tronSend(transactionConfig: any, from: string): Promise<any>;
28
+ }
@@ -0,0 +1,29 @@
1
+ /// <reference types="node" />
2
+ import { APIConfig, Token, TronWeb } from '../utils/types';
3
+ import { EventEmitter } from 'events';
4
+ export declare class Contracts extends EventEmitter {
5
+ web3: any;
6
+ networkName: string;
7
+ contractsAddr: any;
8
+ WTRXAddr: string;
9
+ APENFTSharedAssetAddr: string;
10
+ APENFTExchangeKeeperAddr: string;
11
+ feeRecipientAddress: string;
12
+ erc20AssetProxyAddr: string;
13
+ erc721AssetProxyAddr: string;
14
+ erc1155AssetProxyAddr: string;
15
+ factoryContractAddr: string;
16
+ erc20: any;
17
+ erc721: any;
18
+ erc1155: any;
19
+ authenticatedProxy: any;
20
+ exchange: any;
21
+ exchangeHelper: any;
22
+ APENFTSharedAsset: any;
23
+ erc20AssetProxy: any;
24
+ factoryContract: any;
25
+ WTRXToken: Token;
26
+ paymentTokenList: Array<Token>;
27
+ TRX: Token;
28
+ constructor(web3: TronWeb, apiConfig: APIConfig);
29
+ }
@@ -0,0 +1,25 @@
1
+ import TronWeb from "tronweb";
2
+ import { OrdersAPI } from './ordersApi';
3
+ import { Orders } from './orders';
4
+ import { Account } from './account';
5
+ import { AssetFactory } from './nft';
6
+ import { APIConfig, Asset, SellOrderParams, EnglishAuctionOrderParams, BiddingOrderParams, BuyOrderParams, OrderJSON } from "../utils/types";
7
+ export declare class APENFTOrders extends OrdersAPI {
8
+ orders: Orders;
9
+ account: Account;
10
+ assetFactory: AssetFactory;
11
+ walletProvider: TronWeb;
12
+ accountAddress: string;
13
+ constructor(walletProvider: TronWeb, apiConfig: APIConfig, walletAccount?: {
14
+ address?: string;
15
+ privateKey?: string;
16
+ });
17
+ ordersCancelSign(hash: string): Promise<any>;
18
+ getAssetOrderVersion(assetData: Asset): Promise<any>;
19
+ createSellOrder({ asset, quantity, paymentToken, listingTime, expirationTime, startAmount, endAmount, buyerAddress }: SellOrderParams): Promise<any>;
20
+ createAuctionOrder({ asset, quantity, paymentToken, expirationTime, startAmount, englishAuctionReservePrice }: EnglishAuctionOrderParams): Promise<any>;
21
+ createBiddingOrder({ asset, quantity, paymentToken, startAmount, bestAsk }: BiddingOrderParams): Promise<any>;
22
+ createBuyOrder({ asset, quantity, paymentToken, expirationTime, startAmount }: BuyOrderParams): Promise<any>;
23
+ createLowerPriceOrder({ oldOrder, parameter, asset }: any): Promise<any>;
24
+ acceptOrder(bestOrder: OrderJSON): Promise<any>;
25
+ }