@xoxno/sdk-js 0.0.5-alpha → 0.0.7-alpha
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/collection/index.d.ts +59 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.min.js +1 -0
- package/dist/interactions/index.d.ts +79 -0
- package/dist/launchpad/index.d.ts +78 -0
- package/dist/nft/index.d.ts +44 -0
- package/dist/types/collection.d.ts +313 -0
- package/dist/types/interactions.d.ts +16 -0
- package/dist/types/nft.d.ts +93 -0
- package/dist/types/trading.d.ts +91 -0
- package/dist/utils/SmartContractAbis.d.ts +15 -0
- package/dist/utils/SmartContractService.d.ts +3 -0
- package/dist/utils/api.d.ts +23 -0
- package/dist/utils/const.d.ts +13 -0
- package/dist/utils/getActivity.d.ts +10 -0
- package/dist/utils/helpers.d.ts +2 -0
- package/dist/utils/regex.d.ts +2 -0
- package/dist/utils/scCalls.d.ts +9 -0
- package/package.json +3 -2
- package/.editorconfig +0 -9
- package/.prettierrc +0 -8
- package/.releaserc +0 -10
- package/commitlint.config.js +0 -3
- package/dist/xoxno.min.js +0 -1
- package/jest.config.js +0 -7
- package/src/collection/__tests__/collection.test.ts +0 -107
- package/src/collection/index.ts +0 -204
- package/src/index.ts +0 -20
- package/src/interactions/__tests__/market.test.ts +0 -92
- package/src/interactions/index.ts +0 -221
- package/src/launchpad/__tests__/market.test.ts +0 -25
- package/src/launchpad/index.ts +0 -163
- package/src/nft/__tests__/nft.test.ts +0 -84
- package/src/nft/index.ts +0 -98
- package/src/types/collection.ts +0 -332
- package/src/types/interactions.ts +0 -16
- package/src/types/nft.ts +0 -100
- package/src/types/trading.ts +0 -95
- package/src/utils/SmartContractAbis.ts +0 -82
- package/src/utils/SmartContractService.ts +0 -10
- package/src/utils/api.ts +0 -133
- package/src/utils/const.ts +0 -26
- package/src/utils/getActivity.ts +0 -55
- package/src/utils/helpers.ts +0 -14
- package/src/utils/regex.ts +0 -7
- package/src/utils/scCalls.ts +0 -47
- package/tsconfig.json +0 -14
- package/webpack.config.js +0 -28
- /package/{src/types/index.ts → dist/types/index.d.ts} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Offer = {
|
|
2
|
+
offer_id: number;
|
|
3
|
+
collection: string;
|
|
4
|
+
quantity: number;
|
|
5
|
+
payment_token: string;
|
|
6
|
+
payment_nonce: number;
|
|
7
|
+
price: number;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
owner: string;
|
|
10
|
+
attributes: Array<{
|
|
11
|
+
trait_type: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}>;
|
|
14
|
+
new_version: boolean;
|
|
15
|
+
price_long: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export interface NFTAttribute {
|
|
2
|
+
trait_type: string;
|
|
3
|
+
value: string;
|
|
4
|
+
occurance: number;
|
|
5
|
+
rarity: number;
|
|
6
|
+
frequency: number;
|
|
7
|
+
OnSale?: number;
|
|
8
|
+
FloorPrice?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface NFTMetadata {
|
|
11
|
+
description?: string;
|
|
12
|
+
attributes: NFTAttribute[];
|
|
13
|
+
rarity: {
|
|
14
|
+
rank: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface OriginalMedia {
|
|
18
|
+
contentType: string;
|
|
19
|
+
contentLength: number;
|
|
20
|
+
}
|
|
21
|
+
export interface SaleInfoNft {
|
|
22
|
+
auction_id: number;
|
|
23
|
+
seller: string;
|
|
24
|
+
current_winner: string;
|
|
25
|
+
min_bid: string;
|
|
26
|
+
max_bid: string;
|
|
27
|
+
current_bid: string;
|
|
28
|
+
start_time: number;
|
|
29
|
+
deadline: number;
|
|
30
|
+
accepted_payment_token: string;
|
|
31
|
+
accepted_payment_token_nonce: number;
|
|
32
|
+
auction_type: string;
|
|
33
|
+
timestamp: number;
|
|
34
|
+
min_bid_short: number;
|
|
35
|
+
max_bid_short: number;
|
|
36
|
+
current_bid_short: number;
|
|
37
|
+
quantity: null | number;
|
|
38
|
+
marketplace: string;
|
|
39
|
+
usd: string;
|
|
40
|
+
usd_max_bid: string;
|
|
41
|
+
}
|
|
42
|
+
export interface NftValue {
|
|
43
|
+
floorValue: number;
|
|
44
|
+
avgValue: number;
|
|
45
|
+
maxValue: number;
|
|
46
|
+
collectionFp: number;
|
|
47
|
+
}
|
|
48
|
+
export interface GameData {
|
|
49
|
+
name: string;
|
|
50
|
+
value: number;
|
|
51
|
+
}
|
|
52
|
+
export interface OffersInfo {
|
|
53
|
+
EgldValue: number;
|
|
54
|
+
UsdValue: number;
|
|
55
|
+
deadline: number;
|
|
56
|
+
isActive: boolean;
|
|
57
|
+
offer_id: number;
|
|
58
|
+
owner: string;
|
|
59
|
+
ownerUsername: string;
|
|
60
|
+
payment_nonce: number;
|
|
61
|
+
payment_token: string;
|
|
62
|
+
price: string;
|
|
63
|
+
price_short: number;
|
|
64
|
+
quantity: number;
|
|
65
|
+
timestamp: number;
|
|
66
|
+
}
|
|
67
|
+
export interface NftData {
|
|
68
|
+
identifier: string;
|
|
69
|
+
collection: string;
|
|
70
|
+
attributes?: string;
|
|
71
|
+
nonce: number;
|
|
72
|
+
type: string;
|
|
73
|
+
name: string;
|
|
74
|
+
creator?: string;
|
|
75
|
+
royalties: number;
|
|
76
|
+
url: string;
|
|
77
|
+
avifUrl: string;
|
|
78
|
+
webpUrl: string;
|
|
79
|
+
wasProcessed: boolean;
|
|
80
|
+
onSale: boolean;
|
|
81
|
+
hasOffers?: boolean;
|
|
82
|
+
metadata: NFTMetadata;
|
|
83
|
+
originalMedia: OriginalMedia;
|
|
84
|
+
saleInfoNft: SaleInfoNft;
|
|
85
|
+
offersInfo: OffersInfo[];
|
|
86
|
+
gameData: GameData[];
|
|
87
|
+
owner?: string;
|
|
88
|
+
ownerCount?: number;
|
|
89
|
+
ownerUsername?: string;
|
|
90
|
+
isVerified: boolean;
|
|
91
|
+
isVisible: boolean;
|
|
92
|
+
nftValue?: NftValue;
|
|
93
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Marketplace, MetadataAttribute, TradingActivity } from './collection';
|
|
2
|
+
export interface TradingActivityQueryFilter {
|
|
3
|
+
filters: {
|
|
4
|
+
collection?: string[];
|
|
5
|
+
identifier?: string[];
|
|
6
|
+
address?: string[];
|
|
7
|
+
tokens?: string[];
|
|
8
|
+
marketplace?: Marketplace[];
|
|
9
|
+
action?: string[];
|
|
10
|
+
range?: {
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
};
|
|
14
|
+
rankRange?: {
|
|
15
|
+
min: number;
|
|
16
|
+
max: number;
|
|
17
|
+
};
|
|
18
|
+
timestampRange?: {
|
|
19
|
+
min: number;
|
|
20
|
+
max: number;
|
|
21
|
+
};
|
|
22
|
+
attributes?: MetadataAttribute[];
|
|
23
|
+
};
|
|
24
|
+
top: number;
|
|
25
|
+
skip: number;
|
|
26
|
+
select?: SelectFieldsTradingActivity[];
|
|
27
|
+
orderBy?: OrderByTradingActivity[];
|
|
28
|
+
}
|
|
29
|
+
export interface TradincActivityArgs {
|
|
30
|
+
/** The collections to fetch the trading activity from */
|
|
31
|
+
collections?: string[];
|
|
32
|
+
/** The identifier of the NFTs to fetch the trading activity from */
|
|
33
|
+
identifiers?: string[];
|
|
34
|
+
/** The owners of the NFTs to fetch the trading activity from */
|
|
35
|
+
owners?: string[];
|
|
36
|
+
/** The marketplaces to fetch the trading activity from */
|
|
37
|
+
marketplaces?: Marketplace[];
|
|
38
|
+
/** The tokens to fetch the trading activity from */
|
|
39
|
+
placedInToken?: string[];
|
|
40
|
+
/** The price range to fetch the trading activity from */
|
|
41
|
+
priceRange?: {
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
};
|
|
45
|
+
/** The rank range to fetch the trading activity from */
|
|
46
|
+
rankRange?: {
|
|
47
|
+
min: number;
|
|
48
|
+
max: number;
|
|
49
|
+
};
|
|
50
|
+
/** The timestamp range to fetch the trading activity from */
|
|
51
|
+
timestampRange?: {
|
|
52
|
+
min: number;
|
|
53
|
+
max: number;
|
|
54
|
+
};
|
|
55
|
+
/** The number of results to return */
|
|
56
|
+
top?: number;
|
|
57
|
+
/** The number of results to skip */
|
|
58
|
+
skip?: number;
|
|
59
|
+
/** The actions to fetch the trading activity from */
|
|
60
|
+
actions?: string[];
|
|
61
|
+
/** The fields to select from the trading activity */
|
|
62
|
+
select?: SelectFieldsTradingActivity[];
|
|
63
|
+
/** The fields to order the trading activity by */
|
|
64
|
+
orderBy?: OrderByTradingActivity[];
|
|
65
|
+
/** The attributes to fetch the trading activity from */
|
|
66
|
+
attributes?: MetadataAttribute[];
|
|
67
|
+
}
|
|
68
|
+
export declare enum OrderByTradingActivity {
|
|
69
|
+
PriceHighToLow = "short_price desc",
|
|
70
|
+
PriceLowToHigh = "short_price asc",
|
|
71
|
+
RecentPlaced = "timestamp desc",
|
|
72
|
+
OldestPlaced = "timestamp asc"
|
|
73
|
+
}
|
|
74
|
+
export declare enum SelectFieldsTradingActivity {
|
|
75
|
+
'attributes' = 0,
|
|
76
|
+
'collection' = 1,
|
|
77
|
+
'offer_id' = 2,
|
|
78
|
+
'owner' = 3,
|
|
79
|
+
'short_price' = 4,
|
|
80
|
+
'price' = 5,
|
|
81
|
+
'id' = 6,
|
|
82
|
+
'dataType' = 7,
|
|
83
|
+
'marketplace' = 8,
|
|
84
|
+
'payment_token' = 9
|
|
85
|
+
}
|
|
86
|
+
export interface TradingActivityResponse {
|
|
87
|
+
hasMoreResults: boolean;
|
|
88
|
+
resources: TradingActivity[];
|
|
89
|
+
getNextPagePayload: TradincActivityArgs;
|
|
90
|
+
empty: boolean;
|
|
91
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AbiRegistry } from '@multiversx/sdk-core';
|
|
2
|
+
export declare class SmartContractAbis {
|
|
3
|
+
private static manager;
|
|
4
|
+
private static exchange;
|
|
5
|
+
private static minter;
|
|
6
|
+
private static market;
|
|
7
|
+
private static staking;
|
|
8
|
+
private static p2p;
|
|
9
|
+
static getMarket(): Promise<AbiRegistry>;
|
|
10
|
+
static getManager(): Promise<AbiRegistry>;
|
|
11
|
+
static getMinter(): Promise<AbiRegistry>;
|
|
12
|
+
static getStaking(): Promise<AbiRegistry>;
|
|
13
|
+
static getExchange(): Promise<AbiRegistry>;
|
|
14
|
+
static getP2P(): Promise<AbiRegistry>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SmartContract } from '@multiversx/sdk-core/out/smartcontracts/smartContract';
|
|
2
|
+
import type { AbiRegistry } from '@multiversx/sdk-core/out/smartcontracts/typesystem/abiRegistry';
|
|
3
|
+
export declare const getSmartContract: (abiRegistry: AbiRegistry, address: string) => SmartContract;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare enum Chain {
|
|
2
|
+
MAINNET = "1",
|
|
3
|
+
DEVNET = "D"
|
|
4
|
+
}
|
|
5
|
+
export declare class APIClient {
|
|
6
|
+
private static instance;
|
|
7
|
+
apiUrl: string;
|
|
8
|
+
private apiKey;
|
|
9
|
+
chain: Chain;
|
|
10
|
+
config: {
|
|
11
|
+
XO_SC: string;
|
|
12
|
+
FM_SC: string;
|
|
13
|
+
DR_SC: string;
|
|
14
|
+
KG_SC: string;
|
|
15
|
+
Staking_SC: string;
|
|
16
|
+
Manager_SC: string;
|
|
17
|
+
P2P_SC: string;
|
|
18
|
+
};
|
|
19
|
+
private constructor();
|
|
20
|
+
static init(apiUrl?: string, apiKey?: string, chain?: Chain): APIClient;
|
|
21
|
+
static getClient(): APIClient;
|
|
22
|
+
fetchWithTimeout: <T>(path: string, options?: Record<string, unknown>, timeout?: number) => Promise<T>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const API_URL = "https://api.xoxno.com";
|
|
2
|
+
export declare const API_URL_DEV = "https://api-dev.xoxno.com";
|
|
3
|
+
export declare const XOXNO_SC = "erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8";
|
|
4
|
+
export declare const FM_SC = "erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s";
|
|
5
|
+
export declare const DR_SC = "erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0";
|
|
6
|
+
export declare const KG_SC = "erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";
|
|
7
|
+
export declare const Staking_SC = "erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z";
|
|
8
|
+
export declare const Manager_SC = "erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7";
|
|
9
|
+
export declare const P2P_SC = "erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6";
|
|
10
|
+
export declare const XOXNO_SC_DEV = "erd1qqqqqqqqqqqqqpgqn4fnwl43hhchz9emdy66eh5azzhl599zd8ssxjdyh3";
|
|
11
|
+
export declare const Staking_SC_DEV = "erd1qqqqqqqqqqqqqpgqmkt2fvumf0zgum5qd0awl2l46x2pxdgmr5rswjr6r8";
|
|
12
|
+
export declare const Manager_SC_DEV = "erd1qqqqqqqqqqqqqpgq6sysl7mga393a850xemfpawaqanf4da5d8ssp3xamn";
|
|
13
|
+
export declare const P2P_SC_DEV = "erd1qqqqqqqqqqqqqpgqhuvnvkwwmucdzy3g7pvgvjumjfcgfwf69w2svch5c2";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TradincActivityArgs, TradingActivityResponse } from '../types/trading';
|
|
2
|
+
import { APIClient } from '../utils/api';
|
|
3
|
+
/**
|
|
4
|
+
* Fetches the trading activity of the given collections
|
|
5
|
+
* @param args - The trading activity arguments
|
|
6
|
+
* @param api - The API client
|
|
7
|
+
* @returns - The trading activity response
|
|
8
|
+
* @throws - If the top is greater than 35
|
|
9
|
+
*/
|
|
10
|
+
export declare const getActivity: (args: TradincActivityArgs, api: APIClient) => Promise<TradingActivityResponse>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SmartContract } from '@multiversx/sdk-core/out/smartcontracts/smartContract';
|
|
2
|
+
import type { Interaction } from '@multiversx/sdk-core/out/smartcontracts/interaction';
|
|
3
|
+
import type { TypedOutcomeBundle } from '@multiversx/sdk-core/out/smartcontracts/interface';
|
|
4
|
+
export declare class ContractQueryRunner {
|
|
5
|
+
private readonly proxy;
|
|
6
|
+
private readonly parser;
|
|
7
|
+
constructor();
|
|
8
|
+
runQuery(contract: SmartContract, interaction: Interaction): Promise<TypedOutcomeBundle>;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xoxno/sdk-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7-alpha",
|
|
4
4
|
"description": "The SDK to interact with the XOXNO Protocol!",
|
|
5
|
-
"main": "./dist/
|
|
5
|
+
"main": "./dist/index.min.js",
|
|
6
|
+
"types": "./dist/index.d.js",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"test": "jest",
|
|
8
9
|
"build": "webpack",
|
package/.editorconfig
DELETED
package/.prettierrc
DELETED
package/.releaserc
DELETED
package/commitlint.config.js
DELETED
package/dist/xoxno.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.XOXNO=t():e.XOXNO=t()}(self,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function n(e,t){return function(){return e.apply(t,arguments)}}e.r(t),e.d(t,{XOXNO:()=>We});const{toString:r}=Object.prototype,{getPrototypeOf:o}=Object,i=(s=Object.create(null),e=>{const t=r.call(e);return s[t]||(s[t]=t.slice(8,-1).toLowerCase())});var s;const a=e=>(e=e.toLowerCase(),t=>i(t)===e),c=e=>t=>typeof t===e,{isArray:l}=Array,u=c("undefined"),f=a("ArrayBuffer"),d=c("string"),p=c("function"),h=c("number"),m=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==i(e))return!1;const t=o(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},y=a("Date"),b=a("File"),w=a("Blob"),q=a("FileList"),E=a("URLSearchParams");function O(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function S(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,v=e=>!u(e)&&e!==R,T=(A="undefined"!=typeof Uint8Array&&o(Uint8Array),e=>A&&e instanceof A);var A;const N=a("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),x=a("RegExp"),j=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};O(n,((n,o)=>{!1!==t(n,o,e)&&(r[o]=n)})),Object.defineProperties(e,r)},P="abcdefghijklmnopqrstuvwxyz",k="0123456789",_={DIGIT:k,ALPHA:P,ALPHA_DIGIT:P+P.toUpperCase()+k},B={isArray:l,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&p(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||r.call(e)===t||p(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:d,isNumber:h,isBoolean:e=>!0===e||!1===e,isObject:m,isPlainObject:g,isUndefined:u,isDate:y,isFile:b,isBlob:w,isRegExp:x,isFunction:p,isStream:e=>m(e)&&p(e.pipe),isURLSearchParams:E,isTypedArray:T,isFileList:q,forEach:O,merge:function e(){const{caseless:t}=v(this)&&this||{},n={},r=(r,o)=>{const i=t&&S(n,o)||o;g(n[i])&&g(r)?n[i]=e(n[i],r):g(r)?n[i]=e({},r):l(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&O(arguments[e],r);return n},extend:(e,t,r,{allOwnKeys:o}={})=>(O(t,((t,o)=>{r&&p(t)?e[o]=n(t,r):e[o]=t}),{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let i,s,a;const c={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)a=i[s],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&o(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:i,kindOfTest:a,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!h(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:N,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:j,freezeMethods:e=>{j(e,((t,n)=>{if(p(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];p(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:S,global:R,isContextDefined:v,ALPHABET:_,generateString:(e=16,t=_.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&p(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(m(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=l(e)?[]:{};return O(e,((e,t)=>{const i=n(e,r+1);!u(i)&&(o[t]=i)})),t[r]=void 0,o}}return e};return n(e,0)}};function U(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}B.inherits(U,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const F=U.prototype,D={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{D[e]={value:e}})),Object.defineProperties(U,D),Object.defineProperty(F,"isAxiosError",{value:!0}),U.from=(e,t,n,r,o,i)=>{const s=Object.create(F);return B.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),U.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const L=U;function I(e){return B.isPlainObject(e)||B.isArray(e)}function M(e){return B.endsWith(e,"[]")?e.slice(0,-2):e}function z(e,t,n){return e?e.concat(t).map((function(e,t){return e=M(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const J=B.toFlatObject(B,{},null,(function(e){return/^is[A-Z]/.test(e)})),W=function(e,t,n){if(!B.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=B.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!B.isUndefined(t[e])}))).metaTokens,o=n.visitor||l,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(B.isDate(e))return e.toISOString();if(!a&&B.isBlob(e))throw new L("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(e)||B.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(B.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(B.isArray(e)&&function(e){return B.isArray(e)&&!e.some(I)}(e)||(B.isFileList(e)||B.endsWith(n,"[]"))&&(a=B.toArray(e)))return n=M(n),a.forEach((function(e,r){!B.isUndefined(e)&&null!==e&&t.append(!0===s?z([n],r,i):null===s?n:n+"[]",c(e))})),!1;return!!I(e)||(t.append(z(o,n,i),c(e)),!1)}const u=[],f=Object.assign(J,{defaultVisitor:l,convertValue:c,isVisitable:I});if(!B.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!B.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),B.forEach(n,(function(n,i){!0===(!(B.isUndefined(n)||null===n)&&o.call(t,n,B.isString(i)?i.trim():i,r,f))&&e(n,r?r.concat(i):[i])})),u.pop()}}(e),t};function H(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function $(e,t){this._pairs=[],e&&W(e,this,t)}const K=$.prototype;K.append=function(e,t){this._pairs.push([e,t])},K.toString=function(e){const t=e?function(t){return e.call(this,t,H)}:H;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};const V=$;function X(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function G(e,t,n){if(!t)return e;const r=n&&n.encode||X,o=n&&n.serialize;let i;if(i=o?o(t,n):B.isURLSearchParams(t)?t.toString():new V(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}const Q=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){B.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Y={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:V,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"undefined"!=typeof window&&"undefined"!=typeof document})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]},ee=function(e){function t(e,n,r,o){let i=e[o++];const s=Number.isFinite(+i),a=o>=e.length;return i=!i&&B.isArray(r)?r.length:i,a?(B.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s):(r[i]&&B.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&B.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s)}if(B.isFormData(e)&&B.isFunction(e.entries)){const n={};return B.forEachEntry(e,((e,r)=>{t(function(e){return B.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null},te={"Content-Type":void 0},ne={transitional:Z,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=B.isObject(e);if(o&&B.isHTMLForm(e)&&(e=new FormData(e)),B.isFormData(e))return r&&r?JSON.stringify(ee(e)):e;if(B.isArrayBuffer(e)||B.isBuffer(e)||B.isStream(e)||B.isFile(e)||B.isBlob(e))return e;if(B.isArrayBufferView(e))return e.buffer;if(B.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return W(e,new Y.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return Y.isNode&&B.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=B.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return W(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(B.isString(e))try{return(0,JSON.parse)(e),B.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ne.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&B.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw L.from(e,L.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Y.classes.FormData,Blob:Y.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};B.forEach(["delete","get","head"],(function(e){ne.headers[e]={}})),B.forEach(["post","put","patch"],(function(e){ne.headers[e]=B.merge(te)}));const re=ne,oe=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ie=Symbol("internals");function se(e){return e&&String(e).trim().toLowerCase()}function ae(e){return!1===e||null==e?e:B.isArray(e)?e.map(ae):String(e)}function ce(e,t,n,r,o){return B.isFunction(r)?r.call(this,t,n):(o&&(t=n),B.isString(t)?B.isString(r)?-1!==t.indexOf(r):B.isRegExp(r)?r.test(t):void 0:void 0)}class le{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=se(t);if(!o)throw new Error("header name must be a non-empty string");const i=B.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=ae(e))}const i=(e,t)=>B.forEach(e,((e,n)=>o(e,n,t)));return B.isPlainObject(e)||e instanceof this.constructor?i(e,t):B.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&oe[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&o(t,e,n),this}get(e,t){if(e=se(e)){const n=B.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(B.isFunction(t))return t.call(this,e,n);if(B.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=se(e)){const n=B.findKey(this,e);return!(!n||void 0===this[n]||t&&!ce(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=se(e)){const o=B.findKey(n,e);!o||t&&!ce(0,n[o],o,t)||(delete n[o],r=!0)}}return B.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!ce(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return B.forEach(this,((r,o)=>{const i=B.findKey(n,o);if(i)return t[i]=ae(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();s!==o&&delete t[o],t[s]=ae(r),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return B.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&B.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[ie]=this[ie]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=se(e);t[r]||(function(e,t){const n=B.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return B.isArray(e)?e.forEach(r):r(e),this}}le.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),B.freezeMethods(le.prototype),B.freezeMethods(le);const ue=le;function fe(e,t){const n=this||re,r=t||n,o=ue.from(r.headers);let i=r.data;return B.forEach(e,(function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)})),o.normalize(),i}function de(e){return!(!e||!e.__CANCEL__)}function pe(e,t,n){L.call(this,null==e?"canceled":e,L.ERR_CANCELED,t,n),this.name="CanceledError"}B.inherits(pe,L,{__CANCEL__:!0});const he=pe,me=Y.isStandardBrowserEnv?{write:function(e,t,n,r,o,i){const s=[];s.push(e+"="+encodeURIComponent(t)),B.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),B.isString(r)&&s.push("path="+r),B.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function ge(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const ye=Y.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=B.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function be(e,t){let n=0;const r=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[s];o||(o=c),n[i]=a,r[i]=c;let u=s,f=0;for(;u!==i;)f+=n[u++],u%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const d=l&&c-l;return d?Math.round(1e3*f/d):void 0}}(50,250);return o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,a=i-n,c=r(a);n=i;const l={loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:o};l[t?"download":"upload"]=!0,e(l)}}const we={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const o=ue.from(e.headers).normalize(),i=e.responseType;let s;function a(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}B.isFormData(r)&&(Y.isStandardBrowserEnv||Y.isStandardBrowserWebWorkerEnv)&&o.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(t+":"+n))}const l=ge(e.baseURL,e.url);function u(){if(!c)return;const r=ue.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new L("Request failed with status code "+n.status,[L.ERR_BAD_REQUEST,L.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),a()}),(function(e){n(e),a()}),{data:i&&"text"!==i&&"json"!==i?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:r,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),G(l,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=u:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=function(){c&&(n(new L("Request aborted",L.ECONNABORTED,e,c)),c=null)},c.onerror=function(){n(new L("Network Error",L.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||Z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new L(t,r.clarifyTimeoutError?L.ETIMEDOUT:L.ECONNABORTED,e,c)),c=null},Y.isStandardBrowserEnv){const t=(e.withCredentials||ye(l))&&e.xsrfCookieName&&me.read(e.xsrfCookieName);t&&o.set(e.xsrfHeaderName,t)}void 0===r&&o.setContentType(null),"setRequestHeader"in c&&B.forEach(o.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),B.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),i&&"json"!==i&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",be(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",be(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{c&&(n(!t||t.type?new he(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const f=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(l);f&&-1===Y.protocols.indexOf(f)?n(new L("Unsupported protocol "+f+":",L.ERR_BAD_REQUEST,e)):c.send(r||null)}))}};B.forEach(we,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));function qe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new he(null,e)}function Ee(e){return qe(e),e.headers=ue.from(e.headers),e.data=fe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),(e=>{e=B.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let o=0;o<t&&(n=e[o],!(r=B.isString(n)?we[n.toLowerCase()]:n));o++);if(!r){if(!1===r)throw new L(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(B.hasOwnProp(we,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`)}if(!B.isFunction(r))throw new TypeError("adapter is not a function");return r})(e.adapter||re.adapter)(e).then((function(t){return qe(e),t.data=fe.call(e,e.transformResponse,t),t.headers=ue.from(t.headers),t}),(function(t){return de(t)||(qe(e),t&&t.response&&(t.response.data=fe.call(e,e.transformResponse,t.response),t.response.headers=ue.from(t.response.headers))),Promise.reject(t)}))}const Oe=e=>e instanceof ue?e.toJSON():e;function Se(e,t){t=t||{};const n={};function r(e,t,n){return B.isPlainObject(e)&&B.isPlainObject(t)?B.merge.call({caseless:n},e,t):B.isPlainObject(t)?B.merge({},t):B.isArray(t)?t.slice():t}function o(e,t,n){return B.isUndefined(t)?B.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!B.isUndefined(t))return r(void 0,t)}function s(e,t){return B.isUndefined(t)?B.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>o(Oe(e),Oe(t),!0)};return B.forEach(Object.keys(e).concat(Object.keys(t)),(function(r){const i=c[r]||o,s=i(e[r],t[r],r);B.isUndefined(s)&&i!==a||(n[r]=s)})),n}const Re={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Re[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const ve={};Re.transitional=function(e,t,n){function r(e,t){return"[Axios v1.3.4] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new L(r(o," has been removed"+(t?" in "+t:"")),L.ERR_DEPRECATED);return t&&!ve[o]&&(ve[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};const Te={assertOptions:function(e,t,n){if("object"!=typeof e)throw new L("options must be an object",L.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new L("option "+i+" must be "+n,L.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new L("Unknown option "+i,L.ERR_BAD_OPTION)}},validators:Re},Ae=Te.validators;class Ne{constructor(e){this.defaults=e,this.interceptors={request:new Q,response:new Q}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Se(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;let i;void 0!==n&&Te.assertOptions(n,{silentJSONParsing:Ae.transitional(Ae.boolean),forcedJSONParsing:Ae.transitional(Ae.boolean),clarifyTimeoutError:Ae.transitional(Ae.boolean)},!1),void 0!==r&&Te.assertOptions(r,{encode:Ae.function,serialize:Ae.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),i=o&&B.merge(o.common,o[t.method]),i&&B.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=ue.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,f=0;if(!a){const e=[Ee.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),u=e.length,l=Promise.resolve(t);f<u;)l=l.then(e[f++],e[f++]);return l}u=s.length;let d=t;for(f=0;f<u;){const e=s[f++],t=s[f++];try{d=e(d)}catch(e){t.call(this,e);break}}try{l=Ee.call(this,d)}catch(e){return Promise.reject(e)}for(f=0,u=c.length;f<u;)l=l.then(c[f++],c[f++]);return l}getUri(e){return G(ge((e=Se(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}B.forEach(["delete","get","head","options"],(function(e){Ne.prototype[e]=function(t,n){return this.request(Se(n||{},{method:e,url:t,data:(n||{}).data}))}})),B.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(Se(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Ne.prototype[e]=t(),Ne.prototype[e+"Form"]=t(!0)}));const Ce=Ne;class xe{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new he(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new xe((function(t){e=t})),cancel:e}}}const je=xe,Pe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Pe).forEach((([e,t])=>{Pe[t]=e}));const ke=Pe,_e=function e(t){const r=new Ce(t),o=n(Ce.prototype.request,r);return B.extend(o,Ce.prototype,r,{allOwnKeys:!0}),B.extend(o,r,null,{allOwnKeys:!0}),o.create=function(n){return e(Se(t,n))},o}(re);_e.Axios=Ce,_e.CanceledError=he,_e.CancelToken=je,_e.isCancel=de,_e.VERSION="1.3.4",_e.toFormData=W,_e.AxiosError=L,_e.Cancel=_e.CanceledError,_e.all=function(e){return Promise.all(e)},_e.spread=function(e){return function(t){return e.apply(null,t)}},_e.isAxiosError=function(e){return B.isObject(e)&&!0===e.isAxiosError},_e.mergeConfig=Se,_e.AxiosHeaders=ue,_e.formToJSON=e=>ee(B.isHTMLForm(e)?new FormData(e):e),_e.HttpStatusCode=ke,_e.default=_e;const Be=_e,Ue="https://api.xoxno.com",Fe="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",De="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",Le="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var Ie;!function(e){e.MAINNET="1",e.DEVNET="D"}(Ie||(Ie={}));class Me{static instance;apiUrl;apiKey;chain;config;constructor(e,t,n){this.apiUrl=e,this.apiKey=t,this.chain=n,this.config=n===Ie.MAINNET?{XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:Fe,DR_SC:De,KG_SC:Le,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{XO_SC:"erd1qqqqqqqqqqqqqpgqn4fnwl43hhchz9emdy66eh5azzhl599zd8ssxjdyh3",FM_SC:Fe,DR_SC:De,KG_SC:Le,Staking_SC:"erd1qqqqqqqqqqqqqpgqmkt2fvumf0zgum5qd0awl2l46x2pxdgmr5rswjr6r8",Manager_SC:"erd1qqqqqqqqqqqqqpgq6sysl7mga393a850xemfpawaqanf4da5d8ssp3xamn",P2P_SC:"erd1qqqqqqqqqqqqqpgqhuvnvkwwmucdzy3g7pvgvjumjfcgfwf69w2svch5c2"}}static init(e=Ue,t="",n=Ie.MAINNET){return Me.instance||(Me.instance=new Me(e,t,n)),Me.instance}static getClient(){if(!Me.instance)throw new Error("APIClient has not been initialized");return Me.instance}fetchWithTimeout=async(e,t={},n=4e4)=>{const r={"Accept-Encoding":"gzip,deflate,br","xo-time":`Sent-At:${Math.round((new Date).getTime()/1e3)}`,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."POST"===t.method?{"Content-Type":"application/json"}:{},...t.headers??{}};try{const{data:o}=await Be(`${this.apiUrl}${e}${t.params?"?"+Object.keys(t.params).map((e=>`${e}=${encodeURIComponent(t.params[e])}`)).join("&"):""}`,{timeout:n,...t,...Object.keys(r).length?{headers:r}:{},method:t.method??"GET"});return o}catch(n){throw new Error("Something went wrong inside fetchWithTimeout "+e+" "+JSON.stringify(t)+" "+n)}}}const ze=e=>/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);class Je{api;constructor(){this.api=Me.getClient()}getCollectionProfile=async e=>{if(!ze(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/getCollectionProfile/${e}`)};getCollectionFloorPrice=async(e,t="EGLD")=>{if(!ze(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/getFloorPrice/${e}/${t}`)};getCollectionAttributes=async e=>{if(!ze(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/getCollectionAttributes/${e}`)};searchNFTs=async e=>{if(!ze(e.collection))throw new Error("Invalid collection ticker: "+e.collection);if(e.top&&e.top>35)throw new Error("Top cannot be greater than 35");const t={filters:{onSale:e.onlyOnSale||!1,marketplace:e.listedOnlyOn||void 0,auctionTypes:e.onlyOnSale?e.onlyAuctions?["NftBid","SftAll"]:["Nft","SftOnePerPayment"]:void 0,tokens:e.listedInToken||void 0,attributes:e.attributes||void 0,range:e.priceRange?{...e.priceRange,type:e.onlyAuctions?"saleInfoNft/current_bid_short":"saleInfoNft/min_bid_short"}:void 0,rankRange:e.rankRange||void 0,levelRange:e.cantinaLevelRange||void 0},name:e.searchName||"",orderBy:e.orderBy||void 0,collection:e.collection,select:e.onlySelectFields||void 0,top:e.top||35,skip:e.skip||0},n=Buffer.from(JSON.stringify(t)).toString("base64"),r=await this.api.fetchWithTimeout(`/searchNFTs/${n}`);return{...r,getNextPagePayload:{...e,skip:(e.skip??0)+(e.top??35)},hasMoreResults:r.resultsCount>(e.skip??0)+(e.top??35)}};getTradingActivity=async e=>await(async(e,t)=>{if(e.top&&e.top>35)throw new Error("Top cannot be greater than 35");const n={filters:{collection:e.collections,identifier:e.identifiers||void 0,address:e.owners||void 0,tokens:e.placedInToken||void 0,marketplace:e.marketplaces||void 0,action:e.actions||void 0,range:e.priceRange,rankRange:e.rankRange,timestampRange:e.timestampRange,attributes:e.attributes},orderBy:e.orderBy,select:e.select,top:e.top||35,skip:e.skip||0},r=Buffer.from(JSON.stringify(n)).toString("base64"),o=await t.fetchWithTimeout(`/getTradingActivity/${r}`);return{...o,getNextPagePayload:{...e,skip:(e.skip??0)+(e.top??35)},empty:0===o.resources.length}})(e,this.api);getCollections=async e=>{if(e?.top&&e.top>25)throw new Error("Top cannot be greater than 25");const t={skip:e?.skip||0,top:e?.top||25,select:e?.onlySelectFields||[],filters:{dataType:"collectionProfile",isMintable:e?.onlyMintable||void 0,...e?.collections&&e.collections.length>0&&{collection:e.collections}},orderBy:[e?.orderBy||"statistics.tradeData.weekEgldVolume desc"]},n=Buffer.from(JSON.stringify(t)).toString("base64"),r=await this.api.fetchWithTimeout(`/collections/${n}`);return{results:r,resultsCount:r.length,empty:0===r.length,getNextPagePayload:{...e,skip:(e?.skip||0)+(e?.top||25)},hasMoreResults:r.length<(e?.top||25)}}}class We{collection;constructor(e=Ue,t=""){Me.init(e,t),this.collection=new Je}}return t})()));
|
package/jest.config.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { CollectionModule } from './../index';
|
|
2
|
-
import { APIClient } from '../../utils/api';
|
|
3
|
-
import { CollectionsFieldsToSelect, FieldsToSelect } from '../../types';
|
|
4
|
-
|
|
5
|
-
describe('CollectionModule', () => {
|
|
6
|
-
let collectionModule: CollectionModule;
|
|
7
|
-
const inputCollection = 'BANANA-e955fd';
|
|
8
|
-
beforeAll(() => {
|
|
9
|
-
APIClient.init('https://proxy-api.xoxno.com', '');
|
|
10
|
-
collectionModule = new CollectionModule();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test('getCollectionProfile should return the correct result', async () => {
|
|
14
|
-
const collectionModule = new CollectionModule();
|
|
15
|
-
const result = await collectionModule.getCollectionProfile(inputCollection);
|
|
16
|
-
expect(result.collection).toEqual(inputCollection);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test('getCollectionProfiles should return the correct results', async () => {
|
|
20
|
-
const collectionModule = new CollectionModule();
|
|
21
|
-
const result = await collectionModule.getCollections();
|
|
22
|
-
expect(result).toBeDefined();
|
|
23
|
-
expect(result.results).toHaveLength(25);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should get the floor price of a collection', async () => {
|
|
27
|
-
const floorPrice = await collectionModule.getCollectionFloorPrice(
|
|
28
|
-
inputCollection
|
|
29
|
-
);
|
|
30
|
-
expect(floorPrice).toBeLessThan(1);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should get the collection attributes', async () => {
|
|
34
|
-
const attributesInfo = await collectionModule.getCollectionAttributes(
|
|
35
|
-
inputCollection
|
|
36
|
-
);
|
|
37
|
-
expect(attributesInfo).toMatchObject({
|
|
38
|
-
Accessorie: {
|
|
39
|
-
Dollars: {
|
|
40
|
-
attributeOccurrence: 260,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should get the collection trading activity', async () => {
|
|
47
|
-
const tradingActivity = await collectionModule.getTradingActivity({
|
|
48
|
-
collections: [inputCollection],
|
|
49
|
-
top: 1,
|
|
50
|
-
});
|
|
51
|
-
expect(tradingActivity).toMatchObject({
|
|
52
|
-
getNextPagePayload: {
|
|
53
|
-
top: 1,
|
|
54
|
-
skip: 1,
|
|
55
|
-
collections: [inputCollection],
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const tradingActivitySecondPage = await collectionModule.getTradingActivity(
|
|
60
|
-
tradingActivity.getNextPagePayload
|
|
61
|
-
);
|
|
62
|
-
expect(tradingActivitySecondPage).toMatchObject({
|
|
63
|
-
getNextPagePayload: {
|
|
64
|
-
top: 1,
|
|
65
|
-
skip: 2,
|
|
66
|
-
collections: [inputCollection],
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('should get fetch and filter NFTs from a collection', async () => {
|
|
72
|
-
const nfts = await collectionModule.searchNFTs({
|
|
73
|
-
collection: inputCollection,
|
|
74
|
-
onlyOnSale: true,
|
|
75
|
-
top: 1,
|
|
76
|
-
onlySelectFields: [
|
|
77
|
-
FieldsToSelect.Attributes,
|
|
78
|
-
FieldsToSelect.Name,
|
|
79
|
-
FieldsToSelect.SaleInfo,
|
|
80
|
-
FieldsToSelect.Rank,
|
|
81
|
-
FieldsToSelect.Description,
|
|
82
|
-
FieldsToSelect.Royalties,
|
|
83
|
-
FieldsToSelect.Collection,
|
|
84
|
-
],
|
|
85
|
-
});
|
|
86
|
-
expect(nfts).toMatchObject({
|
|
87
|
-
getNextPagePayload: {
|
|
88
|
-
top: 1,
|
|
89
|
-
skip: 1,
|
|
90
|
-
collection: inputCollection,
|
|
91
|
-
onlyOnSale: true,
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const nftsSecondPage = await collectionModule.searchNFTs(
|
|
96
|
-
nfts.getNextPagePayload
|
|
97
|
-
);
|
|
98
|
-
expect(nftsSecondPage).toMatchObject({
|
|
99
|
-
getNextPagePayload: {
|
|
100
|
-
top: 1,
|
|
101
|
-
skip: 2,
|
|
102
|
-
collection: inputCollection,
|
|
103
|
-
onlyOnSale: true,
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
});
|