@xoxno/sdk-js 1.0.84 → 1.0.91

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.
@@ -1,4 +1,3 @@
1
- import type { IChainID } from '@multiversx/sdk-core/out/interface';
2
1
  export type SafeHeaders = Record<string, string> & {
3
2
  authorization?: never;
4
3
  Authorization?: never;
@@ -13,7 +12,7 @@ export declare enum Chain {
13
12
  }
14
13
  export declare class XOXNOClient {
15
14
  apiUrl: string;
16
- chain: IChainID;
15
+ chain: Chain;
17
16
  init: OurRequestInit;
18
17
  config: {
19
18
  mediaUrl: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoxno/sdk-js",
3
- "version": "1.0.84",
3
+ "version": "1.0.91",
4
4
  "description": "The SDK to interact with the XOXNO Protocol!",
5
5
  "type": "module",
6
6
  "exports": {
@@ -8,11 +8,6 @@
8
8
  "import": "./dist/index.esm.js",
9
9
  "require": "./dist/index.cjs.js",
10
10
  "types": "./dist/index.d.ts"
11
- },
12
- "./interactor": {
13
- "import": "./dist/interactor.esm.js",
14
- "require": "./dist/interactor.cjs.js",
15
- "types": "./dist/interactor.d.ts"
16
11
  }
17
12
  },
18
13
  "types": "./dist/index.d.ts",
@@ -24,13 +19,13 @@
24
19
  "sideEffects": false,
25
20
  "scripts": {
26
21
  "test": "jest",
27
- "build:sdk": "npx bun run src/sdk/parseSwagger.ts && eslint 'src/sdk/swagger.ts' --fix && npx bun run md/extract.ts",
22
+ "build:sdk": "npx bun run src/sdk/parseSwagger.ts && npx oxlint src/sdk/swagger.ts --fix && npx bun run md/extract.ts",
28
23
  "build:types": "tsc --emitDeclarationOnly",
29
24
  "build:esm": "webpack --config webpack-esm.config.mjs",
30
25
  "build:cjs": "webpack --config webpack-cjs.config.mjs",
31
26
  "build": "npm run build:sdk && npm run build:types && npm run build:esm && npm run build:cjs",
32
- "lint": "eslint 'src/**/*.{ts,tsx}' --fix",
33
- "format": "prettier --write 'src/**/*.{ts,tsx}'",
27
+ "lint": "oxlint src",
28
+ "format": "oxlint src --fix",
34
29
  "commit": "git-cz",
35
30
  "release": "semantic-release",
36
31
  "docs": "typedoc --out docs src/**/*.ts"
@@ -65,45 +60,39 @@
65
60
  },
66
61
  "homepage": "https://github.com/XOXNO/sdk-js#readme",
67
62
  "devDependencies": {
68
- "@commitlint/cli": "^19.6.1",
69
- "@commitlint/config-conventional": "^19.6.0",
70
- "@ianvs/prettier-plugin-sort-imports": "^4.4.0",
71
- "@multiversx/sdk-extension-provider": "^5.0.0",
63
+ "@commitlint/cli": "^20.4.1",
64
+ "@commitlint/config-conventional": "^20.4.1",
65
+ "@multiversx/sdk-extension-provider": "^5.1.2",
72
66
  "@semantic-release/changelog": "^6.0.3",
73
67
  "@semantic-release/git": "^10.0.1",
74
- "@swc/cli": "^0.5.2",
75
- "@swc/core": "^1.10.4",
76
- "@types/jest": "^29.5.14",
77
- "@types/node": "^22.10.2",
78
- "@types/react": "^19.1.8",
79
- "@typescript-eslint/eslint-plugin": "^8.19.0",
80
- "@typescript-eslint/parser": "^8.19.0",
81
- "bun": "^1.2.18",
82
- "commitizen": "^4.3.1",
83
- "cookies-next": "^6.1.0",
68
+ "@swc/cli": "^0.8.0",
69
+ "@swc/core": "^1.15.11",
70
+ "@types/jest": "^30.0.0",
71
+ "@types/node": "^25.2.3",
72
+ "@types/react": "^19.2.14",
73
+ "bun": "^1.3.9",
74
+ "commitizen": "^4.2.4",
75
+ "cookies-next": "^6.1.1",
84
76
  "cz-conventional-changelog": "^3.3.0",
85
- "eslint": "^8",
86
- "eslint-config-prettier": "^9.1.0",
87
- "eslint-plugin-prettier": "^5.2.1",
88
- "fork-ts-checker-webpack-plugin": "^9.0.2",
77
+ "fork-ts-checker-webpack-plugin": "^9.1.0",
89
78
  "husky": "^9.1.7",
90
- "jest": "^29.7.0",
91
- "prettier": "^3.4.2",
92
- "semantic-release": "^24.2.0",
93
- "swc-loader": "^0.2.6",
94
- "terser-webpack-plugin": "^5.3.11",
95
- "ts-jest": "^29.2.5",
96
- "ts-loader": "^9.5.1",
97
- "typedoc": "^0.27.6",
98
- "typescript": "^5.7.2",
99
- "webpack": "^5.97.1",
79
+ "jest": "^30.2.0",
80
+ "oxlint": "^1.47.0",
81
+ "semantic-release": "^25.0.3",
82
+ "swc-loader": "^0.2.7",
83
+ "terser-webpack-plugin": "^5.3.16",
84
+ "ts-jest": "^29.4.6",
85
+ "ts-loader": "^9.5.4",
86
+ "typedoc": "^0.28.17",
87
+ "typescript": "^5.9.3",
88
+ "webpack": "^5.105.2",
100
89
  "webpack-cli": "^6.0.1",
101
90
  "webpack-merge": "^6.0.1",
102
- "yaml": "^2.8.0"
91
+ "yaml": "^2.8.2"
103
92
  },
104
93
  "dependencies": {
105
- "@multiversx/sdk-core": "^13.17.2",
94
+ "@multiversx/sdk-core": "^15.3.2",
106
95
  "@multiversx/sdk-network-providers": "^2.9.3",
107
- "@xoxno/types": "^1.0.366"
96
+ "@xoxno/types": "^1.0.377"
108
97
  }
109
98
  }
@@ -1,278 +0,0 @@
1
- import type { IPlainTransactionObject } from '@multiversx/sdk-core/out/interface';
2
- import type { GlobalOfferDoc, NftDoc } from '@xoxno/types';
3
- import type { AcceptGlobalOffer, ChangeListing, NewListingArgs, Payment, SendCustomOffer, SendGlobalOffer, WithSenderAndNonce } from './types';
4
- declare enum AuctionType {
5
- NftBid = 0,
6
- Nft = 1,
7
- SftAll = 2,
8
- SftOnePerPayment = 3
9
- }
10
- interface Auction {
11
- auctioned_token_type: string;
12
- auctioned_token_nonce: number;
13
- nr_auctioned_tokens: number;
14
- auction_type: AuctionType;
15
- payment_token_type: string;
16
- payment_token_nonce: number;
17
- min_bid: string;
18
- max_bid: string;
19
- start_time: number;
20
- deadline: number;
21
- original_owner: string;
22
- current_bid: string;
23
- current_winner: string;
24
- marketplace_cut_percentage: string;
25
- creator_royalties_percentage: string;
26
- }
27
- export declare class SCInteraction {
28
- private xo;
29
- private api;
30
- private runner;
31
- private config;
32
- private factory;
33
- private constructor();
34
- static init(): Promise<SCInteraction>;
35
- private getResult;
36
- /**
37
- * Gets the percentage of each transaction that will be paid to the marketplace.
38
- *
39
- * @returns The percentage of each transaction that will be paid to the marketplace.
40
- */
41
- getMarketplaceFees: () => Promise<number>;
42
- /**
43
- * Retrieves the list of accepted payment tokens.
44
- * @returns {string[]} A list of accepted payment tokens.
45
- */
46
- getAcceptedPaymentTokens: () => Promise<string[]>;
47
- /**
48
- * This function returns a list of IDs of global offers.
49
- * @returns {number[]} a list of IDs of global offers.
50
- */
51
- getGlobalOfferIDs: () => Promise<number[]>;
52
- /**
53
- * Gets the balance of a user in a token of a specific pool.
54
- * @param address The address of the user.
55
- * @param token The token address.
56
- * @param nonce The nonce of the pool.
57
- * @returns {number} The balance of the user in the token of the pool.
58
- */
59
- getUserPoolBalance(address: string, token: string, nonce: number): Promise<number>;
60
- private isOfferActive;
61
- /**
62
- * Returns the global offer data for the offer with the given id.
63
- *
64
- * @param global_offer_id The id of the global offer for which to return the data.
65
- *
66
- * @returns An object containing the global offer data for the offer with the given id. If the global offer id is invalid, the return value will be null.
67
- */
68
- getGlobalOfferData: (global_offer_id: number) => Promise<GlobalOfferDoc>;
69
- /**
70
- * Returns the auction struct for the given id.
71
- *
72
- * @param auctionID The id of the auction for which to return the data.
73
- *
74
- * @returns {Auction} An object containing the auction data for the given id. If the auction id is invalid, the return value will be null.
75
- */
76
- getAuctionInfo: (auctionID: number) => Promise<Auction | null>;
77
- /** Gets the number of listings.
78
- * @returns {number} The number of listings.
79
- * */
80
- getListingsCount(): Promise<number>;
81
- /** Gets the number of custom offers.
82
- * @returns {number} The number of custom offers.
83
- * */
84
- getOffersCount(): Promise<number>;
85
- /** Gets the number of global offers.
86
- * @returns {number} The number of global offers.
87
- * */
88
- getGlobalOffersCount(): Promise<number>;
89
- /** Gets the number of collections listed.
90
- * @returns {number} The number of collections listed.
91
- * */
92
- getCollectionsCount(): Promise<number>;
93
- /**
94
- * Checks whether a collection is listed with at least 1 NFT.
95
- *
96
- * @param collection name of the collection
97
- * @return true if the collection is listed, false otherwise
98
- */
99
- isCollectionListed(collection: string): Promise<boolean>;
100
- /** Gets the on sale NFT count of the collection.
101
- *
102
- * @param collection The collection identifier for which one wants to get the on sale NFT count.
103
- *
104
- * @returns {number} The on sale NFT count of the collection.
105
- * */
106
- getCollectionNFTsOnSaleCount(collection: string): Promise<number>;
107
- /** Gets the active unique auction IDs of collection.
108
- *
109
- * @param collection The collection identifier for which one wants to get the active unique auction IDs.
110
- *
111
- * @returns {number[]} The active unique auction IDs of collection.
112
- * */
113
- getAuctionIDsForCollection(collection: string): Promise<number[]>;
114
- /**
115
- * Withdraw auctions from the smart contract.
116
- *
117
- * @param auctionIDs The IDs of the auctions to withdraw from
118
- * @returns {IPlainTransactionObject} The interaction object of the smart contract
119
- */
120
- withdrawAuctions({ auctionIDs, sender, market, signature, }: {
121
- auctionIDs: number[];
122
- sender: WithSenderAndNonce;
123
- signature?: string;
124
- market?: string;
125
- }): Promise<IPlainTransactionObject[]>;
126
- /**
127
- * Withdraw global offer from the smart contract.
128
- *
129
- * @param auctionIDs The IDs of the global offer to withdraw
130
- * @returns {IPlainTransactionObject} The interaction object of the smart contract
131
- */
132
- withdrawGlobalOffer(offerID: number, market: string | undefined, senderNonce: WithSenderAndNonce): Promise<IPlainTransactionObject>;
133
- /**
134
- * Accept a global offer
135
- *
136
- * @param offerID The offer ID
137
- * @returns {IPlainTransactionObject} The interaction object of the smart contract
138
- */
139
- acceptGlobalOffer({ signature, offer_id, auction_ids_opt, market, nfts, address, nonce, }: AcceptGlobalOffer & WithSenderAndNonce): Promise<IPlainTransactionObject>;
140
- /**
141
- * Send a global offer
142
- * @param payment_token The token used for payment
143
- * @param payment_nonce The nonce of the payment token
144
- * @param price The price of the offer
145
- * @param collection The collection of the NFT
146
- * @param attributes The attributes of the NFT
147
- * @param depositAmount The deposit amount
148
- * @returns {IPlainTransactionObject} The interaction object of the smart contract
149
- * */
150
- sendGlobalOffer({ payment_token, payment_nonce, price, collection, quantity, attributes, depositAmount, address, nonce, }: SendGlobalOffer & WithSenderAndNonce): Promise<IPlainTransactionObject>;
151
- /**
152
- * Send a custom offer
153
- * @param payment_token The token used for payment
154
- * @param payment_nonce The nonce of the payment token
155
- * @param price The price of the offer
156
- * @param deadline The deadline of the offer
157
- * @param nft The NFT to be sold
158
- * @param depositAmount The deposit amount
159
- * @returns {IPlainTransactionObject} The interaction object of the smart contract
160
- * */
161
- sendCustomOffer({ payment_token, payment_nonce, price, deadline, nft, depositAmount, address, nonce, }: SendCustomOffer & WithSenderAndNonce): Promise<IPlainTransactionObject>;
162
- /**
163
- * Withdraws a custom offer
164
- *
165
- * @param offerID The offer ID
166
- * @returns {IPlainTransactionObject} The interaction object of the smart contract
167
- */
168
- withdrawCustomOffer(offerID: number, senderNonce: WithSenderAndNonce, market: string): Promise<IPlainTransactionObject>;
169
- /**
170
- * Decline a custom offer
171
- *
172
- * @param offerID The offer ID
173
- * @returns {IPlainTransactionObject} The interaction object of the smart contract
174
- */
175
- declineCustomOffer(offerID: number, sender: WithSenderAndNonce, nft: NftDoc, market: string): Promise<IPlainTransactionObject>;
176
- /**
177
- * Accept a custom offer
178
- *
179
- * @param offerID The offer ID
180
- * @returns {IPlainTransactionObject} The interaction object of the smart contract
181
- */
182
- acceptCustomOffer(offerID: number, sender: WithSenderAndNonce, nft: NftDoc, market: string): Promise<IPlainTransactionObject>;
183
- /**
184
- * @public
185
- * @function endAuction
186
- * @param {number} auctionID - The unique identifier of the auction.
187
- * @returns {IPlainTransactionObject} The resulting interaction with the specified chainID and gas limit.
188
- *
189
- * This function allows ending an auction by its auctionID. It takes the following parameter:
190
- * - auctionID (number): The unique identifier of the auction.
191
- *
192
- * The function calls the `endAuction` method on the smart contract with the provided auctionID.
193
- * Finally, it returns the resulting interaction with the specified chainID and gas limit.
194
- */
195
- endAuction(auctionID: number, sender: WithSenderAndNonce, market?: string): Promise<IPlainTransactionObject>;
196
- /**
197
- * Bid on an auction
198
- *
199
- * @param auctionID The auction ID
200
- * @param collection The NFT Collection
201
- * @param nonce The NFT nonce
202
- * @param payment The payment object
203
- * @returns {IPlainTransactionObject} The interaction object of the smart contract
204
- */
205
- bidOnAuctionId(auctionID: number, collection: string, nonce: number, payment: Payment, sender: WithSenderAndNonce): Promise<IPlainTransactionObject>;
206
- /**
207
- * Bulk buy auctions
208
- *
209
- * @param auctionIDs The auction IDs
210
- * @param payment The payment object
211
- * @returns {IPlainTransactionObject} The interaction object of the smart contract
212
- */
213
- bulkBuy(auctionIDs: number[], payment: Payment, sender: WithSenderAndNonce): Promise<IPlainTransactionObject>;
214
- /**
215
- * @public
216
- * @async
217
- * @function buyAuctionById
218
- * @param {Object} options - An object containing the necessary parameters to buy an auction.
219
- * @param {number} options.auctionID - The unique identifier of the auction.
220
- * @param {string} [options.collection] - The collection the auctioned token belongs to (optional).
221
- * @param {number} [options.nonce] - The nonce of the auctioned token (optional).
222
- * @param {number} [options.quantity=1] - The quantity of tokens to buy (default is 1).
223
- * @param {string} [options.token='EGLD'] - The payment token (default is 'EGLD').
224
- * @param {number} [options.paymentAmount] - The payment amount for the auction (optional).
225
- * @param {boolean} [options.withCheck=true] - Whether to check the auction information (default is true).
226
- * @param {boolean} [options.isBigUintPayment=false] - Whether the payment amount is a big integer (default is false).
227
- * @returns {Promise<IPlainTransactionObject>} The resulting interaction with the specified chainID and gas limit.
228
- *
229
- * This function allows a user to buy an auction by its auctionID. It takes an object with the following properties:
230
- * - auctionID (number): The unique identifier of the auction.
231
- * - collection (string, optional): The collection the auctioned token belongs to.
232
- * - nonce (number, optional): The nonce of the auctioned token.
233
- * - quantity (number, optional): The quantity of tokens to buy (default is 1).
234
- * - token (string, optional): The payment token (default is 'EGLD').
235
- * - paymentAmount (number, optional): The payment amount for the auction.
236
- * - withCheck (boolean, optional): Whether to check the auction information (default is true).
237
- * - isBigUintPayment (boolean, optional): Whether the payment amount is a big integer (default is false).
238
- *
239
- * The function first checks if the auction exists and if its type is NFT or SftOnePerPayment. If not, an error is thrown.
240
- * Then, it calculates the payment amount and calls the `buy` method on the smart contract with the provided parameters.
241
- * Finally, the function returns the resulting interaction with the specified chainID and gas limit.
242
- */
243
- buyAuctionById({ auctionID, collection, nonce, paymentAmount, quantity, token, withCheck, isBigUintPayment, isBid, decimals, market, sender, }: {
244
- auctionID: number;
245
- collection?: string;
246
- nonce?: number;
247
- quantity?: number;
248
- token?: string;
249
- paymentAmount?: string;
250
- withCheck?: boolean;
251
- isBigUintPayment?: boolean;
252
- isBid?: boolean;
253
- market?: string;
254
- decimals?: number;
255
- sender: WithSenderAndNonce;
256
- }): Promise<IPlainTransactionObject>;
257
- /**
258
- * @docutype
259
- * @public
260
- * @async
261
- * @function changeListing
262
- * @param {ChangeListing[]} listings - An array of objects containing the information needed to change a listing.
263
- * @returns {IPlainTransactionObject} The resulting interaction with the specified chainID and gas limit.
264
- *
265
- * This function takes an array of `ChangeListing` objects and constructs `Struct` instances using the provided
266
- * information. Each `ChangeListing` object should have the following properties:
267
- * - paymentToken (string): The identifier of the payment token type.
268
- * - price (BigInt): The new price for the listing.
269
- * - auctionID (number): The unique identifier of the auction.
270
- * - deadline (number): The deadline (in Unix time) for the listing.
271
- *
272
- * The function then calls the `changeListing` method on the smart contract and returns the resulting interaction
273
- * with the specified chainID and gas limit.
274
- */
275
- changeListing(listings: ChangeListing[], sender: WithSenderAndNonce, marketplace: string): Promise<IPlainTransactionObject>;
276
- listNFTs(listings: NewListingArgs[], sender: WithSenderAndNonce): Promise<IPlainTransactionObject>;
277
- }
278
- export {};
@@ -1,59 +0,0 @@
1
- import type { BytesValue } from '@multiversx/sdk-core/out/smartcontracts/typesystem/bytes';
2
- interface NFTBody {
3
- collection: string;
4
- nonce: number;
5
- amount?: number;
6
- }
7
- export interface WithSenderAndNonce {
8
- address: string;
9
- nonce?: number;
10
- }
11
- export interface Payment extends Omit<NFTBody, 'amount'> {
12
- decimals?: number;
13
- amount: string;
14
- }
15
- export interface SendGlobalOffer {
16
- payment_token: string;
17
- payment_nonce: number;
18
- quantity: number;
19
- price: number;
20
- collection: string;
21
- attributes?: string;
22
- depositAmount?: string;
23
- }
24
- export interface SendCustomOffer {
25
- payment_token: string;
26
- payment_nonce: number;
27
- price: number;
28
- nft: NFTBody;
29
- deadline: number;
30
- depositAmount?: string;
31
- }
32
- export interface AcceptGlobalOffer {
33
- nfts: NFTBody[];
34
- offer_id: number;
35
- market: string;
36
- auction_ids_opt: number[];
37
- signature?: BytesValue;
38
- }
39
- export interface ChangeListing {
40
- paymentToken: string;
41
- price: string;
42
- auctionID: number;
43
- deadline: number;
44
- }
45
- export interface NewListingArgs {
46
- min_bid: string;
47
- max_bid?: string;
48
- deadline?: number;
49
- accepted_payment_token: string;
50
- accepted_payment_token_decimals?: number;
51
- bid: boolean;
52
- opt_sft_max_one_per_payment?: boolean;
53
- isSFTPack?: boolean;
54
- opt_start_time?: number;
55
- collection: string;
56
- nonce: number;
57
- nft_amount: number;
58
- }
59
- export {};