@tradeport/sui-trading-sdk 0.1.100 → 0.1.101
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.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/SuiTradingClient.ts +9 -3
- package/src/apiClients/graphqlClient.ts +6 -2
- package/src/graphql/gqlChainRequest.ts +2 -2
- package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Transaction } from '@mysten/sui/transactions';
|
|
2
2
|
import { KioskTransaction } from '@mysten/kiosk';
|
|
3
|
+
import { GraphQLClient } from 'graphql-request';
|
|
3
4
|
|
|
4
5
|
type AcceptCollectionBid = {
|
|
5
6
|
bidId: string;
|
|
@@ -152,6 +153,7 @@ type ApiConfig = {
|
|
|
152
153
|
apiUser: string;
|
|
153
154
|
apiKey: string;
|
|
154
155
|
suiNodeUrl?: string;
|
|
156
|
+
graphQLClient?: GraphQLClient;
|
|
155
157
|
};
|
|
156
158
|
declare class SuiTradingClient {
|
|
157
159
|
private readonly apiUser;
|
|
@@ -159,7 +161,7 @@ declare class SuiTradingClient {
|
|
|
159
161
|
private readonly suiClient;
|
|
160
162
|
private readonly kioskClient;
|
|
161
163
|
private readonly allowedApiUsersForUnsharedKiosksMigration;
|
|
162
|
-
constructor({ apiUser, apiKey, suiNodeUrl }: ApiConfig);
|
|
164
|
+
constructor({ apiUser, apiKey, suiNodeUrl, graphQLClient }: ApiConfig);
|
|
163
165
|
buyListings({ listingIds, walletAddress, tx }: BuyListings): Promise<Transaction>;
|
|
164
166
|
listNfts({ nfts, walletAddress }: ListNfts): Promise<Transaction>;
|
|
165
167
|
unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Transaction } from '@mysten/sui/transactions';
|
|
2
2
|
import { KioskTransaction } from '@mysten/kiosk';
|
|
3
|
+
import { GraphQLClient } from 'graphql-request';
|
|
3
4
|
|
|
4
5
|
type AcceptCollectionBid = {
|
|
5
6
|
bidId: string;
|
|
@@ -152,6 +153,7 @@ type ApiConfig = {
|
|
|
152
153
|
apiUser: string;
|
|
153
154
|
apiKey: string;
|
|
154
155
|
suiNodeUrl?: string;
|
|
156
|
+
graphQLClient?: GraphQLClient;
|
|
155
157
|
};
|
|
156
158
|
declare class SuiTradingClient {
|
|
157
159
|
private readonly apiUser;
|
|
@@ -159,7 +161,7 @@ declare class SuiTradingClient {
|
|
|
159
161
|
private readonly suiClient;
|
|
160
162
|
private readonly kioskClient;
|
|
161
163
|
private readonly allowedApiUsersForUnsharedKiosksMigration;
|
|
162
|
-
constructor({ apiUser, apiKey, suiNodeUrl }: ApiConfig);
|
|
164
|
+
constructor({ apiUser, apiKey, suiNodeUrl, graphQLClient }: ApiConfig);
|
|
163
165
|
buyListings({ listingIds, walletAddress, tx }: BuyListings): Promise<Transaction>;
|
|
164
166
|
listNfts({ nfts, walletAddress }: ListNfts): Promise<Transaction>;
|
|
165
167
|
unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,10 @@ var createSuiClient_default = createSuiClient;
|
|
|
44
44
|
// src/apiClients/graphqlClient.ts
|
|
45
45
|
var import_graphql_request = require("graphql-request");
|
|
46
46
|
var graphqlClient = new import_graphql_request.GraphQLClient("https://api.indexer.xyz/graphql");
|
|
47
|
-
var
|
|
47
|
+
var getGraphqlClient = () => graphqlClient;
|
|
48
|
+
function setGraphqlClient(client) {
|
|
49
|
+
graphqlClient = client;
|
|
50
|
+
}
|
|
48
51
|
|
|
49
52
|
// src/graphql/createChainGQLQuery.ts
|
|
50
53
|
var import_graphql_request2 = require("graphql-request");
|
|
@@ -69,7 +72,7 @@ var gqlChainRequest = async ({ chain, query, variables }) => {
|
|
|
69
72
|
if (!chain || !query) {
|
|
70
73
|
throw new Error("Missing required arguments");
|
|
71
74
|
}
|
|
72
|
-
const response = await
|
|
75
|
+
const response = await getGraphqlClient().request(
|
|
73
76
|
createChainGQLQuery({ chain, query }),
|
|
74
77
|
variables
|
|
75
78
|
);
|
|
@@ -1601,7 +1604,7 @@ async function addOriginByteAcceptCollectionBidTx(txData) {
|
|
|
1601
1604
|
if (isNewKiosk) {
|
|
1602
1605
|
depositItemIntoOBKiosk({
|
|
1603
1606
|
tx,
|
|
1604
|
-
kiosk
|
|
1607
|
+
kiosk,
|
|
1605
1608
|
nftTokenId,
|
|
1606
1609
|
nftType
|
|
1607
1610
|
});
|
|
@@ -5374,13 +5377,16 @@ async function withdrawProfitsFromKiosks({ walletAddress }, context) {
|
|
|
5374
5377
|
|
|
5375
5378
|
// src/SuiTradingClient.ts
|
|
5376
5379
|
var SuiTradingClient = class {
|
|
5377
|
-
constructor({ apiUser, apiKey, suiNodeUrl }) {
|
|
5380
|
+
constructor({ apiUser, apiKey, suiNodeUrl, graphQLClient }) {
|
|
5378
5381
|
this.allowedApiUsersForUnsharedKiosksMigration = ["tradeport.xyz"];
|
|
5379
5382
|
this.apiUser = apiUser;
|
|
5380
5383
|
this.apiKey = apiKey;
|
|
5381
5384
|
this.suiClient = createSuiClient_default(suiNodeUrl || (0, import_client2.getFullnodeUrl)("mainnet"));
|
|
5382
5385
|
this.kioskClient = createKioskClient_default(this.suiClient);
|
|
5383
|
-
|
|
5386
|
+
if (graphQLClient) {
|
|
5387
|
+
setGraphqlClient(graphQLClient);
|
|
5388
|
+
}
|
|
5389
|
+
getGraphqlClient().setHeaders({
|
|
5384
5390
|
"x-api-user": apiUser,
|
|
5385
5391
|
"x-api-key": apiKey
|
|
5386
5392
|
});
|