@tradeport/sui-trading-sdk 0.4.49 → 0.4.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/SuiTradingClient.ts
2
2
  import { getFullnodeUrl } from "@mysten/sui/client";
3
+ import { GraphQLClient } from "graphql-request";
3
4
 
4
5
  // src/apiClients/createKioskClient.ts
5
6
  import { KioskClient, Network } from "@mysten/kiosk";
@@ -16,9 +17,15 @@ var createSuiClient = (url) => new SuiClient({ url });
16
17
  var createSuiClient_default = createSuiClient;
17
18
 
18
19
  // src/apiClients/graphqlClient.ts
19
- import { GraphQLClient } from "graphql-request";
20
- var graphqlClient = new GraphQLClient("https://api.indexer.xyz/graphql");
21
- var getGraphqlClient = () => graphqlClient;
20
+ var graphqlClient;
21
+ var getGraphqlClient = () => {
22
+ if (!graphqlClient) {
23
+ throw new Error(
24
+ "GraphQL client not initialized. Please provide apiUrl to SuiTradingClient constructor."
25
+ );
26
+ }
27
+ return graphqlClient;
28
+ };
22
29
  function setGraphqlClient(client) {
23
30
  graphqlClient = client;
24
31
  }
@@ -7516,7 +7523,7 @@ var sponsorNftListing = async ({ nftTokenId, walletAddress, options }, context)
7516
7523
 
7517
7524
  // src/SuiTradingClient.ts
7518
7525
  var SuiTradingClient = class {
7519
- constructor({ apiUser, apiKey, suiNodeUrl, graphQLClient }) {
7526
+ constructor({ apiUser, apiKey, apiUrl, suiNodeUrl, graphQLClient }) {
7520
7527
  this.allowedApiUsersForUnsharedKiosksMigration = ["tradeport.xyz", "mercato.xyz"];
7521
7528
  this.apiUser = apiUser;
7522
7529
  this.apiKey = apiKey;
@@ -7524,6 +7531,8 @@ var SuiTradingClient = class {
7524
7531
  this.kioskClient = createKioskClient_default(this.suiClient);
7525
7532
  if (graphQLClient) {
7526
7533
  setGraphqlClient(graphQLClient);
7534
+ } else {
7535
+ setGraphqlClient(new GraphQLClient(apiUrl));
7527
7536
  }
7528
7537
  getGraphqlClient().setHeaders({
7529
7538
  "x-api-user": apiUser,