@xoxno/sdk-js 0.1.56-alpha → 0.1.58-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 +1 -0
- package/dist/collection/index.js +569 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/common/index.js +50 -0
- package/dist/common/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/index.large.d.ts +2 -0
- package/dist/index.large.js +3 -0
- package/dist/index.large.js.map +1 -0
- package/dist/interactions/index.js +619 -0
- package/dist/interactions/index.js.map +1 -0
- package/dist/launchpad/index.js +140 -0
- package/dist/launchpad/index.js.map +1 -0
- package/dist/nft/index.js +109 -0
- package/dist/nft/index.js.map +1 -0
- package/dist/staking/index.js +17 -0
- package/dist/staking/index.js.map +1 -0
- package/dist/types/collection.js +180 -0
- package/dist/types/collection.js.map +1 -0
- package/dist/types/common.js +2 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/interactions.js +8 -0
- package/dist/types/interactions.js.map +1 -0
- package/dist/types/nft.js +2 -0
- package/dist/types/nft.js.map +1 -0
- package/dist/types/staking.js +12 -0
- package/dist/types/staking.js.map +1 -0
- package/dist/types/trading.js +51 -0
- package/dist/types/trading.js.map +1 -0
- package/dist/types/user.js +10 -0
- package/dist/types/user.js.map +1 -0
- package/dist/users/index.js +209 -0
- package/dist/users/index.js.map +1 -0
- package/dist/utils/SmartContractAbis.js +84 -0
- package/dist/utils/SmartContractAbis.js.map +1 -0
- package/dist/utils/SmartContractService.js +9 -0
- package/dist/utils/SmartContractService.js.map +1 -0
- package/dist/utils/api.js +82 -0
- package/dist/utils/api.js.map +1 -0
- package/dist/utils/const.js +14 -0
- package/dist/utils/const.js.map +1 -0
- package/dist/utils/getActivity.js +53 -0
- package/dist/utils/getActivity.js.map +1 -0
- package/dist/utils/helpers.js +21 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/regex.js +7 -0
- package/dist/utils/regex.js.map +1 -0
- package/dist/utils/scCalls.js +25 -0
- package/dist/utils/scCalls.js.map +1 -0
- package/package.json +2 -2
- package/dist/236.bundle.js +0 -1
- package/dist/265.bundle.js +0 -2
- package/dist/265.bundle.js.LICENSE.txt +0 -10
- package/dist/index.bundle.js +0 -1
- package/dist/interactions.bundle.js +0 -1
- package/dist/launchpad.bundle.js +0 -1
- package/dist/runtime.bundle.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trading.js","sourceRoot":"","sources":["../../src/types/trading.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,eA0BX;AA1BD,WAAY,eAAe;IACzB,eAAe;IACf,2CAAwB,CAAA;IACxB,uCAAoB,CAAA;IACpB,2CAAwB,CAAA;IACxB,+CAA4B,CAAA;IAC5B,cAAc;IACd,mDAAgC,CAAA;IAChC,uDAAoC,CAAA;IACpC,mDAAgC,CAAA;IAChC,6CAA0B,CAAA;IAC1B,oDAAiC,CAAA;IACjC,+CAA4B,CAAA;IAC5B,mDAAgC,CAAA;IAChC,+CAA4B,CAAA;IAC5B,4DAAyC,CAAA;IACzC,gEAA6C,CAAA;IAC7C,kCAAe,CAAA;IACf,2CAAwB,CAAA;IACxB,iDAA8B,CAAA;IAC9B,6CAA0B,CAAA;IAC1B,6CAA0B,CAAA;IAC1B,0DAAuC,CAAA;IACvC,UAAU;IACV,kCAAe,CAAA;IACf,uCAAoB,CAAA;AACtB,CAAC,EA1BW,eAAe,KAAf,eAAe,QA0B1B;AA8ED,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,2DAAiC,CAAA;IACjC,0DAAgC,CAAA;IAChC,oDAA0B,CAAA;IAC1B,qDAA2B,CAAA;IAC3B,yDAA+B,CAAA;IAC/B,wDAA8B,CAAA;AAChC,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC;AAED,MAAM,CAAN,IAAY,2BAWX;AAXD,WAAY,2BAA2B;IACrC,yFAAY,CAAA;IACZ,yFAAY,CAAA;IACZ,qFAAU,CAAA;IACV,+EAAO,CAAA;IACP,2FAAa,CAAA;IACb,+EAAO,CAAA;IACP,yEAAI,CAAA;IACJ,qFAAU,CAAA;IACV,2FAAa,CAAA;IACb,+FAAe,CAAA;AACjB,CAAC,EAXW,2BAA2B,KAA3B,2BAA2B,QAWtC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var OfferType;
|
|
2
|
+
(function (OfferType) {
|
|
3
|
+
OfferType["Received"] = "received";
|
|
4
|
+
OfferType["Sent"] = "sent";
|
|
5
|
+
})(OfferType || (OfferType = {}));
|
|
6
|
+
export var Type;
|
|
7
|
+
(function (Type) {
|
|
8
|
+
Type["NonFungibleESDT"] = "NonFungibleESDT";
|
|
9
|
+
})(Type || (Type = {}));
|
|
10
|
+
//# sourceMappingURL=user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":"AAsEA,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,kCAAqB,CAAA;IACrB,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AA2CD,MAAM,CAAN,IAAY,IAEX;AAFD,WAAY,IAAI;IACd,2CAAmC,CAAA;AACrC,CAAC,EAFW,IAAI,KAAJ,IAAI,QAEf"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { CollectionModule, XOXNOClient } from '../index';
|
|
2
|
+
import { getActivity } from '../utils/getActivity';
|
|
3
|
+
import { isAddressValid } from '../utils/helpers';
|
|
4
|
+
import { isValidCollectionTicker } from '../utils/regex';
|
|
5
|
+
export class UserModule {
|
|
6
|
+
api;
|
|
7
|
+
collection;
|
|
8
|
+
constructor() {
|
|
9
|
+
this.api = XOXNOClient.init();
|
|
10
|
+
this.collection = new CollectionModule();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Returns the user profile
|
|
14
|
+
*
|
|
15
|
+
* @param {String} address - Address of the user
|
|
16
|
+
* @returns {IUserProfile}
|
|
17
|
+
*/
|
|
18
|
+
getUserProfile = async (address) => {
|
|
19
|
+
if (!isAddressValid(address))
|
|
20
|
+
throw new Error('Invalid address');
|
|
21
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/profile`);
|
|
22
|
+
return response;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Returns the wallet accounts
|
|
26
|
+
*
|
|
27
|
+
* @param {String[]} addresses - Addresses of the user
|
|
28
|
+
* @returns {BulkAccount[]}
|
|
29
|
+
*/
|
|
30
|
+
getBulkAccounts = async (addresses) => {
|
|
31
|
+
const response = await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/address/bulk`, {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body: JSON.stringify(addresses),
|
|
34
|
+
});
|
|
35
|
+
return response;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Returns the user account info that inclues nonce, guardian data, esdtTokens
|
|
39
|
+
*
|
|
40
|
+
* @param {String} address - Address of the user
|
|
41
|
+
* @returns {UserAccountInfo}
|
|
42
|
+
*/
|
|
43
|
+
getUserAccount = async (address) => {
|
|
44
|
+
if (!isAddressValid(address))
|
|
45
|
+
throw new Error('Invalid address');
|
|
46
|
+
const response = await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/accounts/${address}`);
|
|
47
|
+
return response;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Gets user's inventory
|
|
51
|
+
*
|
|
52
|
+
* @param {String} address - User's address
|
|
53
|
+
* @returns {UserInventory} User's inventory
|
|
54
|
+
*/
|
|
55
|
+
getUserSummaryInventory = async (address) => {
|
|
56
|
+
if (!isAddressValid(address))
|
|
57
|
+
throw new Error('Invalid address');
|
|
58
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/inventory-summary`);
|
|
59
|
+
return response;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Fetches the user's NFTs listed on the marketplaces
|
|
63
|
+
* @param address - The user's address
|
|
64
|
+
* @returns {UserInventory} - A list of token ids and the price
|
|
65
|
+
*/
|
|
66
|
+
getUserNFTs = async (args) => {
|
|
67
|
+
return await this.collection.getNFTs(args);
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* @name getUserOffers
|
|
71
|
+
* @description Fetches all offers sent or received associated with a user address
|
|
72
|
+
* @param {String} address - The user's wallet address
|
|
73
|
+
* @returns {UserOffers} - The user's listings
|
|
74
|
+
*/
|
|
75
|
+
getUserOffers = async (args) => {
|
|
76
|
+
if (!isAddressValid(args.address))
|
|
77
|
+
throw new Error('Invalid address');
|
|
78
|
+
const response = await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/user/${args.address}/offers?type=${args.type}&skip=${args.skip}&top=${args.top}`);
|
|
79
|
+
return response;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Retrieves trading history based on the provided arguments.
|
|
83
|
+
*
|
|
84
|
+
* @param {TradincActivityArgs} args - The arguments for filtering the trading activity.
|
|
85
|
+
* @returns {Promise<TradingActivityResponse>} A promise resolving to a TradingActivityResponse object containing the activity.
|
|
86
|
+
* @throws {Error} Throws an error if the 'top' argument is greater than 35.
|
|
87
|
+
*/
|
|
88
|
+
getTradingActivity = async (args) => {
|
|
89
|
+
return await getActivity(args, this.api);
|
|
90
|
+
};
|
|
91
|
+
/** Gets user's staking info by ticker
|
|
92
|
+
* @param {String} address - User's address
|
|
93
|
+
* @param {String} ticker - Collection's ticker
|
|
94
|
+
* @returns {GroupStakingInfo[]} User's staking info
|
|
95
|
+
* @throws {Error} Throws an error if the address is invalid
|
|
96
|
+
* */
|
|
97
|
+
getUserStakingTickerInfoGrouped = async (address, ticker) => {
|
|
98
|
+
if (!isAddressValid(address))
|
|
99
|
+
throw new Error('Invalid address');
|
|
100
|
+
if (!isValidCollectionTicker(ticker))
|
|
101
|
+
throw new Error('Invalid ticker');
|
|
102
|
+
const response = await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/getUserStakingInfo/${address}?groupByTicker=true&ticker=${ticker}`);
|
|
103
|
+
return response;
|
|
104
|
+
};
|
|
105
|
+
/** Gets user's creator profile
|
|
106
|
+
* @param {String} address - User's address
|
|
107
|
+
* @returns {CreatorProfile} User's creator profile struct
|
|
108
|
+
* @throws {Error} Throws an error if the address is invalid
|
|
109
|
+
* */
|
|
110
|
+
getUserCreatorProfile = async (address) => {
|
|
111
|
+
if (!isAddressValid(address))
|
|
112
|
+
throw new Error('Invalid address');
|
|
113
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/creator/profile`);
|
|
114
|
+
return response;
|
|
115
|
+
};
|
|
116
|
+
/** Gets user's creator profile
|
|
117
|
+
* @param {String} address - User's address
|
|
118
|
+
* @returns {IMintInfo[]} User's creator profile struct
|
|
119
|
+
* @throws {Error} Throws an error if the address is invalid
|
|
120
|
+
* */
|
|
121
|
+
getCreatorListings = async (address) => {
|
|
122
|
+
if (!isAddressValid(address))
|
|
123
|
+
throw new Error('Invalid address');
|
|
124
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/creator/listing`);
|
|
125
|
+
return response;
|
|
126
|
+
};
|
|
127
|
+
/** Gets user's staking info
|
|
128
|
+
* @param {String} address - User's address
|
|
129
|
+
* @returns {UserStakingSummary[]} User's staking info
|
|
130
|
+
* @throws {Error} Throws an error if the address is invalid
|
|
131
|
+
* */
|
|
132
|
+
getUserStakingSummary = async (address) => {
|
|
133
|
+
if (!isAddressValid(address))
|
|
134
|
+
throw new Error('Invalid address');
|
|
135
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/staking/summary`);
|
|
136
|
+
return response;
|
|
137
|
+
};
|
|
138
|
+
/** Gets user's staking info
|
|
139
|
+
* @param {String} address - User's address
|
|
140
|
+
* @returns {UserStakingAvaiblePools[]} User's staking info
|
|
141
|
+
* @throws {Error} Throws an error if the address is invalid
|
|
142
|
+
* */
|
|
143
|
+
getUserStakingAailable = async (address) => {
|
|
144
|
+
if (!isAddressValid(address))
|
|
145
|
+
throw new Error('Invalid address');
|
|
146
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/staking/available-pools`);
|
|
147
|
+
return response;
|
|
148
|
+
};
|
|
149
|
+
/** Gets user's creator info
|
|
150
|
+
* @param {String} address - User's address
|
|
151
|
+
* @returns {CreatorInfo} User's creator info
|
|
152
|
+
* @throws {Error} Throws an error if the address is invalid
|
|
153
|
+
* */
|
|
154
|
+
getUserCreatorInfo = async (address) => {
|
|
155
|
+
if (!isAddressValid(address))
|
|
156
|
+
throw new Error('Invalid address');
|
|
157
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/creator/details`);
|
|
158
|
+
return response;
|
|
159
|
+
};
|
|
160
|
+
/** Gets pool details
|
|
161
|
+
* @param {String} address - User's address
|
|
162
|
+
* @param {String} collection - Collection ticker
|
|
163
|
+
* @returns {UserCollectionStaking} User's creator info
|
|
164
|
+
* @throws {Error} Throws an error if the address is invalid
|
|
165
|
+
* */
|
|
166
|
+
getUserCollectionStaking = async (address, collection) => {
|
|
167
|
+
if (!isAddressValid(address))
|
|
168
|
+
throw new Error('Invalid address');
|
|
169
|
+
if (!isValidCollectionTicker(collection)) {
|
|
170
|
+
throw new Error('Invalid collection ticker: ' + collection);
|
|
171
|
+
}
|
|
172
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/staking/collection/${collection}`);
|
|
173
|
+
return response;
|
|
174
|
+
};
|
|
175
|
+
/** Gets pool details
|
|
176
|
+
* @param {number} poolId - User's address
|
|
177
|
+
* @returns {CreatoPoolDetailsrInfo} User's creator info
|
|
178
|
+
* @throws {Error} Throws an error if the address is invalid
|
|
179
|
+
* */
|
|
180
|
+
getUserPoolStaking = async (address, poolId) => {
|
|
181
|
+
if (!isAddressValid(address))
|
|
182
|
+
throw new Error('Invalid address');
|
|
183
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/staking/pool/${poolId}`);
|
|
184
|
+
return response;
|
|
185
|
+
};
|
|
186
|
+
/** Gets pool details
|
|
187
|
+
* @param {number} poolId - User's address
|
|
188
|
+
* @returns {CreatoPoolDetailsrInfo} User's creator info
|
|
189
|
+
* @throws {Error} Throws an error if the address is invalid
|
|
190
|
+
* */
|
|
191
|
+
getAvailableNFTsForStakingPool = async (address, poolId) => {
|
|
192
|
+
if (!isAddressValid(address))
|
|
193
|
+
throw new Error('Invalid address');
|
|
194
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/staking/pool/${poolId}/nfts`);
|
|
195
|
+
return response;
|
|
196
|
+
};
|
|
197
|
+
/** Gets owned pools by address
|
|
198
|
+
* @param {string} address - User's address
|
|
199
|
+
* @returns {PoolDetails[]} User pools
|
|
200
|
+
* @throws {Error} Throws an error if the address is invalid
|
|
201
|
+
* */
|
|
202
|
+
getOwnedPoolsByAddress = async (address) => {
|
|
203
|
+
if (!isAddressValid(address))
|
|
204
|
+
throw new Error('Invalid address');
|
|
205
|
+
const response = await this.api.fetchWithTimeout(`/user/${address}/staking/owned-pools`);
|
|
206
|
+
return response;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/users/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAwBzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,OAAO,UAAU;IACb,GAAG,CAAc;IACjB,UAAU,CAAmB;IACrC;QACE,IAAI,CAAC,GAAG,GAAG,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C;QACjE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAC9C,SAAS,OAAO,iBAAiB,MAAM,OAAO,CAC/C,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF;;;;UAIM;IACC,sBAAsB,GAAG,KAAK,EACnC,OAAe,EACS,EAAE;QAC1B,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAC9C,SAAS,OAAO,sBAAsB,CACvC,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;CACH"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { AbiRegistry } from '@multiversx/sdk-core/out/smartcontracts/typesystem/abiRegistry';
|
|
2
|
+
import { XOXNOClient } from './api';
|
|
3
|
+
export class SmartContractAbis {
|
|
4
|
+
static manager;
|
|
5
|
+
static exchange;
|
|
6
|
+
static minter;
|
|
7
|
+
static market;
|
|
8
|
+
static staking;
|
|
9
|
+
static p2p;
|
|
10
|
+
static async getMarket() {
|
|
11
|
+
if (!SmartContractAbis.market) {
|
|
12
|
+
const data = await XOXNOClient.init().fetchWithTimeout('https://media.xoxno.com/smartcontractabi/esdt-nft-marketplace.abi.json', {
|
|
13
|
+
next: {
|
|
14
|
+
tags: ['getMarket'],
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const abiRegistry = AbiRegistry.create(data);
|
|
18
|
+
SmartContractAbis.market = abiRegistry;
|
|
19
|
+
}
|
|
20
|
+
return SmartContractAbis.market;
|
|
21
|
+
}
|
|
22
|
+
static async getManager() {
|
|
23
|
+
if (!SmartContractAbis.manager) {
|
|
24
|
+
const data = await XOXNOClient.init().fetchWithTimeout('https://media.xoxno.com/smartcontractabi/manage.json', {
|
|
25
|
+
next: {
|
|
26
|
+
tags: ['getManager'],
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const abiRegistry = AbiRegistry.create(data);
|
|
30
|
+
SmartContractAbis.manager = abiRegistry;
|
|
31
|
+
}
|
|
32
|
+
return SmartContractAbis.manager;
|
|
33
|
+
}
|
|
34
|
+
static async getMinter() {
|
|
35
|
+
if (!SmartContractAbis.minter) {
|
|
36
|
+
const data = await XOXNOClient.init().fetchWithTimeout('https://media.xoxno.com/smartcontractabi/minter.json', {
|
|
37
|
+
next: {
|
|
38
|
+
tags: ['getMinter'],
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
const abiRegistry = AbiRegistry.create(data);
|
|
42
|
+
SmartContractAbis.minter = abiRegistry;
|
|
43
|
+
}
|
|
44
|
+
return SmartContractAbis.minter;
|
|
45
|
+
}
|
|
46
|
+
static async getStaking() {
|
|
47
|
+
if (!SmartContractAbis.staking) {
|
|
48
|
+
const data = await XOXNOClient.init().fetchWithTimeout('https://media.xoxno.com/smartcontractabi/staking-nfts.abi.json', {
|
|
49
|
+
next: {
|
|
50
|
+
tags: ['getStaking'],
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
const abiRegistry = AbiRegistry.create(data);
|
|
54
|
+
SmartContractAbis.staking = abiRegistry;
|
|
55
|
+
}
|
|
56
|
+
return SmartContractAbis.staking;
|
|
57
|
+
}
|
|
58
|
+
static async getExchange() {
|
|
59
|
+
if (!SmartContractAbis.exchange) {
|
|
60
|
+
const data = await XOXNOClient.init().fetchWithTimeout('https://media.xoxno.com/smartcontractabi/rs-exchange.abi.json', {
|
|
61
|
+
next: {
|
|
62
|
+
tags: ['getExchange'],
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
const abiRegistry = AbiRegistry.create(data);
|
|
66
|
+
SmartContractAbis.exchange = abiRegistry;
|
|
67
|
+
}
|
|
68
|
+
return SmartContractAbis.exchange;
|
|
69
|
+
}
|
|
70
|
+
static async getP2P() {
|
|
71
|
+
if (!SmartContractAbis.p2p) {
|
|
72
|
+
const data = await XOXNOClient.init().fetchWithTimeout('https://media.xoxno.com/smartcontractabi/p2p.abi.json', {
|
|
73
|
+
next: {
|
|
74
|
+
tags: ['getP2P'],
|
|
75
|
+
revalidate: 500,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
const abiRegistry = AbiRegistry.create(data);
|
|
79
|
+
SmartContractAbis.p2p = abiRegistry;
|
|
80
|
+
}
|
|
81
|
+
return SmartContractAbis.p2p;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=SmartContractAbis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartContractAbis.js","sourceRoot":"","sources":["../../src/utils/SmartContractAbis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gEAAgE,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAC,OAAO,CAAc;IAC5B,MAAM,CAAC,QAAQ,CAAc;IAC7B,MAAM,CAAC,MAAM,CAAc;IAC3B,MAAM,CAAC,MAAM,CAAc;IAC3B,MAAM,CAAC,OAAO,CAAc;IAC5B,MAAM,CAAC,GAAG,CAAc;IAEzB,MAAM,CAAC,KAAK,CAAC,SAAS;QAC3B,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;YAC9B,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC,gBAAgB,CACpD,wEAAwE,EACxE;gBACE,IAAI,EAAE;oBACJ,IAAI,EAAE,CAAC,WAAW,CAAC;iBACpB;aACF,CACF,CAAC;YACF,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7C,iBAAiB,CAAC,MAAM,GAAG,WAAW,CAAC;QACzC,CAAC;QAED,OAAO,iBAAiB,CAAC,MAAM,CAAC;IAClC,CAAC;IAEM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;QAED,OAAO,iBAAiB,CAAC,OAAO,CAAC;IACnC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,WAAW;QAC7B,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC,gBAAgB,CACpD,+DAA+D,EAC/D;gBACE,IAAI,EAAE;oBACJ,IAAI,EAAE,CAAC,aAAa,CAAC;iBACtB;aACF,CACF,CAAC;YACF,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7C,iBAAiB,CAAC,QAAQ,GAAG,WAAW,CAAC;QAC3C,CAAC;QAED,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACpC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,MAAM;QACxB,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC,gBAAgB,CACpD,uDAAuD,EACvD;gBACE,IAAI,EAAE;oBACJ,IAAI,EAAE,CAAC,QAAQ,CAAC;oBAChB,UAAU,EAAE,GAAG;iBAChB;aACF,CACF,CAAC;YACF,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7C,iBAAiB,CAAC,GAAG,GAAG,WAAW,CAAC;QACtC,CAAC;QAED,OAAO,iBAAiB,CAAC,GAAG,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Address } from '@multiversx/sdk-core/out/address';
|
|
2
|
+
import { SmartContract } from '@multiversx/sdk-core/out/smartcontracts/smartContract';
|
|
3
|
+
export const getSmartContract = (abiRegistry, address) => {
|
|
4
|
+
return new SmartContract({
|
|
5
|
+
address: new Address(address),
|
|
6
|
+
abi: abiRegistry,
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=SmartContractService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartContractService.js","sourceRoot":"","sources":["../../src/utils/SmartContractService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAGtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,WAAwB,EAAE,OAAe,EAAE,EAAE;IAC5E,OAAO,IAAI,aAAa,CAAC;QACvB,OAAO,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC;QAC7B,GAAG,EAAE,WAAW;KACjB,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { API_URL, API_URL_DEV, DR_SC, FM_SC, KG_SC, Manager_SC, Manager_SC_DEV, P2P_SC, P2P_SC_DEV, Staking_SC, Staking_SC_DEV, XOXNO_SC, XOXNO_SC_DEV, } from './const';
|
|
2
|
+
export var Chain;
|
|
3
|
+
(function (Chain) {
|
|
4
|
+
Chain["MAINNET"] = "1";
|
|
5
|
+
Chain["DEVNET"] = "D";
|
|
6
|
+
})(Chain || (Chain = {}));
|
|
7
|
+
export class XOXNOClient {
|
|
8
|
+
static instance;
|
|
9
|
+
apiUrl;
|
|
10
|
+
apiKey;
|
|
11
|
+
chain;
|
|
12
|
+
config;
|
|
13
|
+
constructor(apiUrl = API_URL, apiKey = '', chain = Chain.MAINNET) {
|
|
14
|
+
this.apiUrl = apiUrl;
|
|
15
|
+
this.apiKey = apiKey;
|
|
16
|
+
this.chain = chain;
|
|
17
|
+
this.config =
|
|
18
|
+
chain === Chain.MAINNET
|
|
19
|
+
? {
|
|
20
|
+
XO_SC: XOXNO_SC,
|
|
21
|
+
FM_SC: FM_SC,
|
|
22
|
+
DR_SC,
|
|
23
|
+
KG_SC,
|
|
24
|
+
Staking_SC,
|
|
25
|
+
Manager_SC,
|
|
26
|
+
P2P_SC,
|
|
27
|
+
}
|
|
28
|
+
: {
|
|
29
|
+
XO_SC: XOXNO_SC_DEV,
|
|
30
|
+
FM_SC,
|
|
31
|
+
DR_SC,
|
|
32
|
+
KG_SC,
|
|
33
|
+
Staking_SC: Staking_SC_DEV,
|
|
34
|
+
Manager_SC: Manager_SC_DEV,
|
|
35
|
+
P2P_SC: P2P_SC_DEV,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
static init({ apiUrl = API_URL, apiKey = '', chain = Chain.MAINNET, } = {}) {
|
|
39
|
+
if (!XOXNOClient.instance) {
|
|
40
|
+
if (chain == Chain.DEVNET) {
|
|
41
|
+
XOXNOClient.instance = new XOXNOClient(API_URL_DEV, apiKey, chain);
|
|
42
|
+
}
|
|
43
|
+
XOXNOClient.instance = new XOXNOClient(apiUrl, apiKey, chain);
|
|
44
|
+
}
|
|
45
|
+
return XOXNOClient.instance;
|
|
46
|
+
}
|
|
47
|
+
fetchWithTimeout = async (path, options = {}, timeout = 40000) => {
|
|
48
|
+
const headers = {
|
|
49
|
+
'Accept-Encoding': 'gzip,deflate,br',
|
|
50
|
+
Referer: 'https://xoxno.sdk',
|
|
51
|
+
'User-Agent': 'XOXNO/1.0/SDK',
|
|
52
|
+
...(options.method === 'POST'
|
|
53
|
+
? { 'Content-Type': 'application/json' }
|
|
54
|
+
: {}),
|
|
55
|
+
...(options.headers ?? {}),
|
|
56
|
+
};
|
|
57
|
+
const shouldInsertOrigin = typeof path === 'string' && path.startsWith('/');
|
|
58
|
+
const url = `${shouldInsertOrigin ? `${this.apiUrl}${path}` : path}${options.params
|
|
59
|
+
? '?' +
|
|
60
|
+
Object.keys(options.params)
|
|
61
|
+
.map((key) => {
|
|
62
|
+
return `${key}=${encodeURIComponent(options.params[key])}`;
|
|
63
|
+
})
|
|
64
|
+
.join('&')
|
|
65
|
+
: ''}`;
|
|
66
|
+
const controller = new AbortController();
|
|
67
|
+
setTimeout(() => controller.abort(), timeout);
|
|
68
|
+
const res = await fetch(url, {
|
|
69
|
+
...options,
|
|
70
|
+
...(options?.next && options.next.revalidate
|
|
71
|
+
? {}
|
|
72
|
+
: { cache: 'no-store' }),
|
|
73
|
+
signal: controller.signal,
|
|
74
|
+
...(Object.keys(headers).length ? { headers } : {}),
|
|
75
|
+
method: options.method ?? 'GET',
|
|
76
|
+
});
|
|
77
|
+
if (!res.ok)
|
|
78
|
+
throw new Error((await res.json()).message.toString());
|
|
79
|
+
return res.json();
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,WAAW,EACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,UAAU,EACV,cAAc,EACd,MAAM,EACN,UAAU,EACV,UAAU,EACV,cAAc,EACd,QAAQ,EACR,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAN,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,sBAAa,CAAA;IACb,qBAAY,CAAA;AACd,CAAC,EAHW,KAAK,KAAL,KAAK,QAGhB;AACD,MAAM,OAAO,WAAW;IACd,MAAM,CAAC,QAAQ,CAAc;IAC9B,MAAM,CAAS;IACd,MAAM,CAAS;IAChB,KAAK,CAAW;IAChB,MAAM,CAQX;IAEF,YACE,SAAiB,OAAO,EACxB,MAAM,GAAG,EAAE,EACX,QAAe,KAAK,CAAC,OAAO;QAE5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM;YACT,KAAK,KAAK,KAAK,CAAC,OAAO;gBACrB,CAAC,CAAC;oBACE,KAAK,EAAE,QAAQ;oBACf,KAAK,EAAE,KAAK;oBACZ,KAAK;oBACL,KAAK;oB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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const API_URL = 'https://api.xoxno.com';
|
|
2
|
+
export const API_URL_DEV = 'https://api-dev.xoxno.com';
|
|
3
|
+
export const XOXNO_SC = 'erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8';
|
|
4
|
+
export const FM_SC = 'erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s';
|
|
5
|
+
export const DR_SC = 'erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0';
|
|
6
|
+
export const KG_SC = 'erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e';
|
|
7
|
+
export const Staking_SC = 'erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z';
|
|
8
|
+
export const Manager_SC = 'erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7';
|
|
9
|
+
export const P2P_SC = 'erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6';
|
|
10
|
+
export const XOXNO_SC_DEV = 'erd1qqqqqqqqqqqqqpgqn4fnwl43hhchz9emdy66eh5azzhl599zd8ssxjdyh3';
|
|
11
|
+
export const Staking_SC_DEV = 'erd1qqqqqqqqqqqqqpgqmkt2fvumf0zgum5qd0awl2l46x2pxdgmr5rswjr6r8';
|
|
12
|
+
export const Manager_SC_DEV = 'erd1qqqqqqqqqqqqqpgq6sysl7mga393a850xemfpawaqanf4da5d8ssp3xamn';
|
|
13
|
+
export const P2P_SC_DEV = 'erd1qqqqqqqqqqqqqpgqhuvnvkwwmucdzy3g7pvgvjumjfcgfwf69w2svch5c2';
|
|
14
|
+
//# sourceMappingURL=const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../src/utils/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,uBAAuB,CAAC;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAEvD,MAAM,CAAC,MAAM,QAAQ,GACnB,gEAAgE,CAAC;AACnE,MAAM,CAAC,MAAM,KAAK,GAChB,gEAAgE,CAAC;AACnE,MAAM,CAAC,MAAM,KAAK,GAChB,gEAAgE,CAAC;AACnE,MAAM,CAAC,MAAM,KAAK,GAChB,gEAAgE,CAAC;AACnE,MAAM,CAAC,MAAM,UAAU,GACrB,gEAAgE,CAAC;AACnE,MAAM,CAAC,MAAM,UAAU,GACrB,gEAAgE,CAAC;AACnE,MAAM,CAAC,MAAM,MAAM,GACjB,gEAAgE,CAAC;AAEnE,MAAM,CAAC,MAAM,YAAY,GACvB,gEAAgE,CAAC;AACnE,MAAM,CAAC,MAAM,cAAc,GACzB,gEAAgE,CAAC;AACnE,MAAM,CAAC,MAAM,cAAc,GACzB,gEAAgE,CAAC;AACnE,MAAM,CAAC,MAAM,UAAU,GACrB,gEAAgE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches the trading activity of the given collections
|
|
3
|
+
* @param args - The trading activity arguments
|
|
4
|
+
* @param api - The API client
|
|
5
|
+
* @returns - The trading activity response
|
|
6
|
+
* @throws - If the top is greater than 35
|
|
7
|
+
*/
|
|
8
|
+
export const getActivity = async (args, api) => {
|
|
9
|
+
if (args.top && args.top > 35) {
|
|
10
|
+
throw new Error('Top cannot be greater than 35');
|
|
11
|
+
}
|
|
12
|
+
const payloadBody = {
|
|
13
|
+
filters: {
|
|
14
|
+
activityData: args.from == null && args.to == null
|
|
15
|
+
? {
|
|
16
|
+
collection: args.collections,
|
|
17
|
+
identifier: args.identifiers || undefined,
|
|
18
|
+
}
|
|
19
|
+
: undefined,
|
|
20
|
+
from: args.from,
|
|
21
|
+
to: args.to,
|
|
22
|
+
activityAddress: args.wallets || undefined,
|
|
23
|
+
// tokens: args.placedInToken || undefined,
|
|
24
|
+
source: args.source || undefined,
|
|
25
|
+
activityType: args.activityType || undefined,
|
|
26
|
+
// range: args.priceRange,
|
|
27
|
+
// rankRange: args.rankRange,
|
|
28
|
+
// timestampRange: args.timestampRange,
|
|
29
|
+
// attributes: args.attributes,
|
|
30
|
+
},
|
|
31
|
+
strictSelect: args.strictSelect,
|
|
32
|
+
orderBy: args.orderBy,
|
|
33
|
+
select: args.select,
|
|
34
|
+
top: args.top || 35,
|
|
35
|
+
skip: args.skip || 0,
|
|
36
|
+
};
|
|
37
|
+
const buffer = Buffer.from(JSON.stringify(payloadBody)).toString('base64');
|
|
38
|
+
const response = await api.fetchWithTimeout(`/activity/${buffer}/query`, {
|
|
39
|
+
next: {
|
|
40
|
+
tags: ['getActivity'],
|
|
41
|
+
revalidate: 180,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
...response,
|
|
46
|
+
getNextPagePayload: {
|
|
47
|
+
...args,
|
|
48
|
+
skip: (args.skip ?? 0) + (args.top ?? 35),
|
|
49
|
+
},
|
|
50
|
+
empty: response.resources.length === 0,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=getActivity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getActivity.js","sourceRoot":"","sources":["../../src/utils/getActivity.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,IAAyB,EACzB,GAAgB,EACkB,EAAE;IACpC,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,WAAW,GAA+B;QAC9C,OAAO,EAAE;YACP,YAAY,EACV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AAQ,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;KACvC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Address } from '@multiversx/sdk-core/out/address';
|
|
2
|
+
export const nonceToHex = (nonce) => {
|
|
3
|
+
let nonceHex = nonce.toString(16);
|
|
4
|
+
if (nonceHex.length % 2 !== 0) {
|
|
5
|
+
nonceHex = '0' + nonceHex;
|
|
6
|
+
}
|
|
7
|
+
return nonceHex;
|
|
8
|
+
};
|
|
9
|
+
export const getIdentifierFromColAndNonce = (collection, nonce) => {
|
|
10
|
+
return [collection, nonceToHex(nonce)].join('-');
|
|
11
|
+
};
|
|
12
|
+
export const isAddressValid = (address) => {
|
|
13
|
+
try {
|
|
14
|
+
new Address(address);
|
|
15
|
+
return true && address.includes('erd1');
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAU,EAAE;IAClD,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC;IAC5B,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,UAAkB,EAClB,KAAa,EACL,EAAE;IACV,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAwB,EAAW,EAAE;IAClE,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const isValidCollectionTicker = (ticker) => {
|
|
2
|
+
return /^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(ticker);
|
|
3
|
+
};
|
|
4
|
+
export const isValidNftIdentifier = (identifier) => {
|
|
5
|
+
return /^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,5}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(identifier);
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=regex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex.js","sourceRoot":"","sources":["../../src/utils/regex.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAW,EAAE;IACjE,OAAO,8BAA8B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAW,EAAE;IAClE,OAAO,gFAAgF,CAAC,IAAI,CAC1F,UAAU,CACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { XOXNOClient } from '../index';
|
|
2
|
+
import { ResultsParser } from '@multiversx/sdk-core/out/smartcontracts/resultsParser';
|
|
3
|
+
import { ProxyNetworkProvider } from '@multiversx/sdk-network-providers/out/proxyNetworkProvider';
|
|
4
|
+
export class ContractQueryRunner {
|
|
5
|
+
proxy;
|
|
6
|
+
parser = new ResultsParser();
|
|
7
|
+
constructor() {
|
|
8
|
+
const api = XOXNOClient.init().apiUrl;
|
|
9
|
+
this.proxy = new ProxyNetworkProvider(api, {
|
|
10
|
+
timeout: 10000,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async runQuery(contract, interaction) {
|
|
14
|
+
try {
|
|
15
|
+
const queryResponse = await this.proxy.queryContract(interaction.buildQuery());
|
|
16
|
+
return this.parser.parseQueryResponse(queryResponse, interaction.getEndpoint());
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.log(`Unexpected error when running query '${interaction.buildQuery().func}' to sc '${contract.getAddress().bech32()}' `);
|
|
20
|
+
console.error(error);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=scCalls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scCalls.js","sourceRoot":"","sources":["../../src/utils/scCalls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAKtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAElG,MAAM,OAAO,mBAAmB;IACb,KAAK,CAAmB;IACxB,MAAM,GAAkB,IAAI,aAAa,EAAE,CAAC;IAE7D;QACE,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,oBAAoB,CAAC,GAAG,EAAE;YACzC,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,QAAuB,EACvB,WAAwB;QAExB,IAAI,CAAC;YACH,MAAM,aAAa,GACjB,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC,CAAC;YAE3D,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,CACnC,aAAa,EACb,WAAW,CAAC,WAAW,EAAE,CAC1B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CACT,wCACE,WAAW,CAAC,UAAU,EAAE,CAAC,IAC3B,YAAY,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,IAAI,CAC/C,CAAC;YACF,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAErB,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xoxno/sdk-js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.58-alpha",
|
|
4
4
|
"description": "The SDK to interact with the XOXNO Protocol!",
|
|
5
5
|
"main": "./dist/index.bundle.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "jest",
|
|
10
|
-
"build": "
|
|
10
|
+
"build": "tsc -p tsconfig.json",
|
|
11
11
|
"lint": "eslint 'src/**/*.ts' --fix",
|
|
12
12
|
"format": "prettier --write 'src/**/*.ts'",
|
|
13
13
|
"commit": "git-cz",
|
package/dist/236.bundle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_xoxno_sdk_js=this.webpackChunk_xoxno_sdk_js||[]).push([[236],{236:function(r,e,t){var n=this&&this.__createBinding||(Object.create?function(r,e,t,n){void 0===n&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){void 0===n&&(n=t),r[n]=e[t]}),s=this&&this.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),o=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(null!=r)for(var t in r)"default"!==t&&Object.prototype.hasOwnProperty.call(r,t)&&n(e,r,t);return s(e,r),e};Object.defineProperty(e,"__esModule",{value:!0}),e.Address=void 0;const a=o(t(9674)),i=o(t(2581)),c="erd",d="0".repeat(16);class u{constructor(r){if(this.valueHex="",r){if(r instanceof u)return u.fromAddress(r);if(r instanceof Buffer)return u.fromBuffer(r);if("string"==typeof r)return u.fromString(r);throw new i.ErrAddressCannotCreate(r)}}static fromAddress(r){return u.fromValidHex(r.valueHex)}static fromValidHex(r){let e=new u;return e.valueHex=r,e}static fromBuffer(r){if(32!=r.length)throw new i.ErrAddressCannotCreate(r);return u.fromValidHex(r.toString("hex"))}static fromString(r){return u.isValidHex(r)?u.fromValidHex(r):u.fromBech32(r)}static isValidHex(r){return 32==Buffer.from(r,"hex").length}static fromHex(r){if(!u.isValidHex(r))throw new i.ErrAddressCannotCreate(r);return u.fromValidHex(r)}static empty(){return new u}static fromBech32(r){let e;try{e=a.decode(r)}catch(e){throw new i.ErrAddressCannotCreate(r,e)}let t=e.prefix;if(t!=c)throw new i.ErrAddressBadHrp(c,t);let n=Buffer.from(a.fromWords(e.words));if(32!=n.length)throw new i.ErrAddressCannotCreate(r);return u.fromValidHex(n.toString("hex"))}static isValid(r){const e=a.decodeUnsafe(r),t=null==e?void 0:e.prefix,n=e?Buffer.from(a.fromWords(e.words)):void 0;return t===c&&32===(null==n?void 0:n.length)}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let r=a.toWords(this.pubkey());return a.encode(c,r)}pubkey(){return this.isEmpty()?Buffer.from([]):Buffer.from(this.valueHex,"hex")}isEmpty(){return!this.valueHex}equals(r){return!!r&&this.valueHex==r.valueHex}toString(){return this.bech32()}toJSON(){return{bech32:this.bech32(),pubkey:this.hex()}}static Zero(){return new u("0".repeat(64))}isContractAddress(){return this.hex().startsWith(d)}}e.Address=u},2581:(r,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ErrIsCompletedFieldIsMissingOnTransaction=e.ErrGasLimitShouldBe0ForInnerTransaction=e.ErrInvalidRelayedV2BuilderArguments=e.ErrInvalidRelayedV1BuilderArguments=e.ErrNotImplemented=e.ErrContractInteraction=e.ErrCodec=e.ErrCannotParseTransactionOutcome=e.ErrCannotParseContractResults=e.ErrMissingFieldOnEnum=e.ErrMissingFieldOnStruct=e.ErrTypingSystem=e.ErrMock=e.ErrContractHasNoAddress=e.ErrContract=e.ErrExpectedTransactionEventsNotFound=e.ErrExpectedTransactionStatusNotReached=e.ErrTransactionWatcherTimeout=e.ErrAsyncTimerAborted=e.ErrAsyncTimerAlreadyRunning=e.ErrInvalidFunctionName=e.ErrSignatureCannotCreate=e.ErrTransactionOptionsInvalid=e.ErrTransactionVersionInvalid=e.ErrNonceInvalid=e.ErrNotEnoughGas=e.ErrAddressEmpty=e.ErrAddressBadHrp=e.ErrAddressCannotCreate=e.ErrUnexpectedCondition=e.ErrInvariantFailed=e.ErrBadType=e.ErrUnsupportedOperation=e.ErrInvalidArgument=e.Err=void 0;class t extends Error{constructor(r,e){super(r),this.inner=void 0,this.inner=e}summary(){let r=[];r.push({name:this.name,message:this.message});let e=this.inner;for(;e;)r.push({name:e.name,message:e.message}),e=e.inner;return r}}e.Err=t;e.ErrInvalidArgument=class extends t{constructor(r,e){super(`Invalid argument: ${r}`,e)}};e.ErrUnsupportedOperation=class extends t{constructor(r,e="not specified"){super(`Operation "${r}" not supported. Reason: ${e}`)}};e.ErrBadType=class extends t{constructor(r,e,t){super(`Bad type of "${r}": ${t}. Expected type: ${e}`)}};e.ErrInvariantFailed=class extends t{constructor(r){super(`Invariant failed: [${r}]`)}};e.ErrUnexpectedCondition=class extends t{constructor(r){super(`Unexpected condition: [${r}]`)}};e.ErrAddressCannotCreate=class extends t{constructor(r,e){super(`Cannot create address from: ${r}`,e)}};e.ErrAddressBadHrp=class extends t{constructor(r,e){super(`Wrong address HRP. Expected: ${r}, got ${e}`)}};e.ErrAddressEmpty=class extends t{constructor(){super("Address is empty")}};e.ErrNotEnoughGas=class extends t{constructor(r){super(`Not enough gas provided: ${r}`)}};e.ErrNonceInvalid=class extends t{constructor(r){super(`Invalid nonce: ${r}`)}};e.ErrTransactionVersionInvalid=class extends t{constructor(r){super(`Invalid transaction version: ${r}`)}};e.ErrTransactionOptionsInvalid=class extends t{constructor(r){super(`Invalid transaction options: ${r}`)}};e.ErrSignatureCannotCreate=class extends t{constructor(r,e){super(`Cannot create signature from: ${r}`,e)}};e.ErrInvalidFunctionName=class extends t{constructor(){super("Invalid function name")}};e.ErrAsyncTimerAlreadyRunning=class extends t{constructor(){super("Async timer already running")}};e.ErrAsyncTimerAborted=class extends t{constructor(){super("Async timer aborted")}};e.ErrTransactionWatcherTimeout=class extends t{constructor(){super("TransactionWatcher has timed out")}};e.ErrExpectedTransactionStatusNotReached=class extends t{constructor(){super("Expected transaction status not reached")}};e.ErrExpectedTransactionEventsNotFound=class extends t{constructor(){super("Expected transaction events not found")}};class n extends t{constructor(r){super(r)}}e.ErrContract=n;e.ErrContractHasNoAddress=class extends n{constructor(){super("\nThe smart contract has no address set. Make sure you provide the address in the constructor, or call setAddress() appropriately.\nIf you need to recompute the address of the contract, make use of SmartContract.computeAddress() (static method). \n")}};e.ErrMock=class extends t{constructor(r){super(r)}};e.ErrTypingSystem=class extends t{constructor(r){super(r)}};e.ErrMissingFieldOnStruct=class extends t{constructor(r,e){super(`field ${r} does not exist on struct ${e}`)}};e.ErrMissingFieldOnEnum=class extends t{constructor(r,e){super(`field ${r} does not exist on enum ${e}`)}};e.ErrCannotParseContractResults=class extends t{constructor(r){super(`cannot parse contract results: ${r}`)}};e.ErrCannotParseTransactionOutcome=class extends t{constructor(r,e){super(`cannot parse outcome of transaction ${r}: ${e}`)}};e.ErrCodec=class extends t{constructor(r){super(r)}};e.ErrContractInteraction=class extends t{constructor(r){super(r)}};e.ErrNotImplemented=class extends t{constructor(){super("Method not yet implemented")}};e.ErrInvalidRelayedV1BuilderArguments=class extends t{constructor(){super("invalid arguments for relayed v1 builder")}};e.ErrInvalidRelayedV2BuilderArguments=class extends t{constructor(){super("invalid arguments for relayed v2 builder")}};e.ErrGasLimitShouldBe0ForInnerTransaction=class extends t{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};e.ErrIsCompletedFieldIsMissingOnTransaction=class extends t{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}}},9674:r=>{for(var e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",t={},n=0;n<32;n++){var s=e.charAt(n);if(void 0!==t[s])throw new TypeError(s+" is ambiguous");t[s]=n}function o(r){var e=r>>25;return(33554431&r)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(r){for(var e=1,t=0;t<r.length;++t){var n=r.charCodeAt(t);if(n<33||n>126)return"Invalid prefix ("+r+")";e=o(e)^n>>5}for(e=o(e),t=0;t<r.length;++t){var s=r.charCodeAt(t);e=o(e)^31&s}return e}function i(r,e){if(e=e||90,r.length<8)return r+" too short";if(r.length>e)return"Exceeds length limit";var n=r.toLowerCase(),s=r.toUpperCase();if(r!==n&&r!==s)return"Mixed-case string "+r;var i=(r=n).lastIndexOf("1");if(-1===i)return"No separator character for "+r;if(0===i)return"Missing prefix for "+r;var c=r.slice(0,i),d=r.slice(i+1);if(d.length<6)return"Data too short";var u=a(c);if("string"==typeof u)return u;for(var l=[],f=0;f<d.length;++f){var p=d.charAt(f),h=t[p];if(void 0===h)return"Unknown character "+p;u=o(u)^h,f+6>=d.length||l.push(h)}return 1!==u?"Invalid checksum for "+r:{prefix:c,words:l}}function c(r,e,t,n){for(var s=0,o=0,a=(1<<t)-1,i=[],c=0;c<r.length;++c)for(s=s<<e|r[c],o+=e;o>=t;)o-=t,i.push(s>>o&a);if(n)o>0&&i.push(s<<t-o&a);else{if(o>=e)return"Excess padding";if(s<<t-o&a)return"Non-zero padding"}return i}r.exports={decodeUnsafe:function(){var r=i.apply(null,arguments);if("object"==typeof r)return r},decode:function(r){var e=i.apply(null,arguments);if("object"==typeof e)return e;throw new Error(e)},encode:function(r,t,n){if(n=n||90,r.length+7+t.length>n)throw new TypeError("Exceeds length limit");var s=a(r=r.toLowerCase());if("string"==typeof s)throw new Error(s);for(var i=r+"1",c=0;c<t.length;++c){var d=t[c];if(d>>5!=0)throw new Error("Non 5-bit word");s=o(s)^d,i+=e.charAt(d)}for(c=0;c<6;++c)s=o(s);for(s^=1,c=0;c<6;++c){i+=e.charAt(s>>5*(5-c)&31)}return i},toWordsUnsafe:function(r){var e=c(r,8,5,!0);if(Array.isArray(e))return e},toWords:function(r){var e=c(r,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(r){var e=c(r,5,8,!1);if(Array.isArray(e))return e},fromWords:function(r){var e=c(r,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}}}}]);
|