@tradeport/sui-trading-sdk 0.0.0
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/.babel.config.js +3 -0
- package/.env.demo +4 -0
- package/.eslintrc.json +46 -0
- package/.prettierignore +4 -0
- package/.prettierrc.json +7 -0
- package/README.md +1 -0
- package/dist/index.d.mts +90 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +3760 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3733 -0
- package/dist/index.mjs.map +1 -0
- package/jest.config.js +7 -0
- package/package.json +45 -0
- package/src/SuiTradingClient.ts +158 -0
- package/src/apiClients/graphqlClient.ts +5 -0
- package/src/apiClients/kioskClient.ts +10 -0
- package/src/apiClients/suiClient.ts +5 -0
- package/src/constants.ts +74 -0
- package/src/graphql/createChainGQLQuery.ts +25 -0
- package/src/graphql/gqlChainRequest.ts +20 -0
- package/src/graphql/queries/fetchAccountKiosks.ts +12 -0
- package/src/graphql/queries/fetchBidsById.ts +28 -0
- package/src/graphql/queries/fetchCollectionBidById.ts +20 -0
- package/src/graphql/queries/fetchCollectionBidsAtSamePrice.ts +28 -0
- package/src/graphql/queries/fetchCollectionsById.ts +30 -0
- package/src/graphql/queries/fetchCommissionByListingId.ts +13 -0
- package/src/graphql/queries/fetchCryptoToUsdRate.ts +13 -0
- package/src/graphql/queries/fetchKiosksByOwner.ts +13 -0
- package/src/graphql/queries/fetchListingsById.ts +24 -0
- package/src/graphql/queries/fetchListingsByNftId.ts +23 -0
- package/src/graphql/queries/fetchNftsById.ts +61 -0
- package/src/graphql/queries/fetchOwnerCapByKiosk.ts +10 -0
- package/src/graphql/queries/fetchPersonalCapByKiosk.ts +10 -0
- package/src/graphql/queries/fetchSharedObjectsByType.ts +12 -0
- package/src/graphql/queries/fetchTransferPoliciesByType.ts +12 -0
- package/src/graphql/queries/getCommissionByListingId.ts +15 -0
- package/src/helpers/addOneDollarFee.ts +17 -0
- package/src/helpers/addThirdPartyTxFee.ts +17 -0
- package/src/helpers/destroyZeroCoin.ts +14 -0
- package/src/helpers/getMarketFeePrice.ts +78 -0
- package/src/helpers/getNftTypeFromNft.ts +8 -0
- package/src/helpers/getSharedObjects.ts +113 -0
- package/src/helpers/getSuiToUsdRate.ts +17 -0
- package/src/helpers/getTradeportBiddingContractParsedBidAmount.ts +32 -0
- package/src/helpers/hasRoyaltyRule.ts +14 -0
- package/src/helpers/hasTransferPolicyRules.ts +21 -0
- package/src/helpers/isNonKioskListing.ts +7 -0
- package/src/helpers/kiosk/getRulePackageId.ts +26 -0
- package/src/helpers/kiosk/isBluemoveKioskBid.ts +1 -0
- package/src/helpers/kiosk/isTradePortKioskBid.ts +4 -0
- package/src/helpers/kiosk/kioskTxWrapper.ts +102 -0
- package/src/helpers/kiosk/resolveFloorPriceRule.ts +25 -0
- package/src/helpers/kiosk/resolveKioskLockRule.ts +49 -0
- package/src/helpers/kiosk/resolvePersonalKioskRule.ts +26 -0
- package/src/helpers/kiosk/resolveRoyaltyRule.ts +41 -0
- package/src/helpers/kiosk/resolveTransferPolicies.ts +150 -0
- package/src/helpers/originByte/confirmOBTranfer.ts +33 -0
- package/src/helpers/originByte/createOBKiosk.ts +14 -0
- package/src/helpers/originByte/depositNftIntoOBKiosk.ts +14 -0
- package/src/helpers/originByte/getOBBidderKiosk.ts +9 -0
- package/src/helpers/originByte/getOBKiosk.ts +24 -0
- package/src/helpers/originByte/getOrCreateOBKiosk.ts +37 -0
- package/src/helpers/originByte/isOBKiosk.ts +13 -0
- package/src/helpers/originByte/isOriginByteBid.ts +6 -0
- package/src/helpers/originByte/isOriginByteTx.ts +2 -0
- package/src/helpers/originByte/shareOriginByteKiosk.ts +14 -0
- package/src/helpers/rpc/getAcountBalance.ts +17 -0
- package/src/helpers/rpc/getObjectType.ts +10 -0
- package/src/helpers/splitCoins.ts +12 -0
- package/src/index.ts +3 -0
- package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +119 -0
- package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +359 -0
- package/src/methods/acceptNftBids/acceptNftBids.ts +100 -0
- package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +214 -0
- package/src/methods/buyListings/addBuyListingTxs.ts +503 -0
- package/src/methods/buyListings/buyListings.ts +143 -0
- package/src/methods/claimNfts/addClaimNftsTxs.ts +104 -0
- package/src/methods/claimNfts/claimNfts.ts +139 -0
- package/src/methods/listNfts/addListTxs.ts +186 -0
- package/src/methods/listNfts/addRelistTxs.ts +79 -0
- package/src/methods/listNfts/listNfts.ts +80 -0
- package/src/methods/placeCollectionBids/addPlaceCollectionBidTxs.ts +146 -0
- package/src/methods/placeCollectionBids/placeCollectionBids.ts +120 -0
- package/src/methods/placeNftBids/addPlaceNftBidTxs.ts +146 -0
- package/src/methods/placeNftBids/placeNftBids.ts +69 -0
- package/src/methods/relistNft/relistNft.ts +104 -0
- package/src/methods/removeCollectionBid/addRemoveCollectionBidTxs.ts +119 -0
- package/src/methods/removeCollectionBid/removeCollectionBid.ts +97 -0
- package/src/methods/removeNftBids/addRemoveNftBidTxs.ts +84 -0
- package/src/methods/removeNftBids/removeNftBids.ts +80 -0
- package/src/methods/transferNfts/addTransferNftTx.ts +78 -0
- package/src/methods/transferNfts/transferNfts.ts +107 -0
- package/src/methods/unlistListings/addUnlistListingTxs.ts +258 -0
- package/src/methods/unlistListings/unlistListings.ts +108 -0
- package/src/methods/withdrawKioskProfits/withdrawKioskProfits.ts +25 -0
- package/src/tests/SuiWallet.ts +49 -0
- package/src/utils/addHexPrefix.ts +7 -0
- package/src/utils/addLeadingZerosAfter0x.ts +2 -0
- package/src/utils/parseSUI.ts +1 -0
- package/src/utils/printTxBlockTxs.ts +5 -0
- package/src/utils/toUint8Array.ts +12 -0
- package/tsconfig.json +14 -0
package/.babel.config.js
ADDED
package/.env.demo
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2022": true,
|
|
5
|
+
"commonjs": true,
|
|
6
|
+
"node": true
|
|
7
|
+
},
|
|
8
|
+
"extends": ["xo", "prettier"],
|
|
9
|
+
"overrides": [
|
|
10
|
+
{
|
|
11
|
+
"extends": ["xo-typescript"],
|
|
12
|
+
"files": ["*.ts"],
|
|
13
|
+
"rules": {
|
|
14
|
+
"@typescript-eslint/naming-convention": "off",
|
|
15
|
+
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
16
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
17
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
18
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
19
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
20
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
21
|
+
"@typescript-eslint/no-throw-literal": "off",
|
|
22
|
+
"@typescript-eslint/object-curly-spacing": "off",
|
|
23
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
24
|
+
"@typescript-eslint/no-negated-condition": "off",
|
|
25
|
+
"@typescript-eslint/prefer-ts-expect-error": "off",
|
|
26
|
+
"@typescript-eslint/indent": "off",
|
|
27
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
28
|
+
"complexity": "off",
|
|
29
|
+
"@typescript-eslint/quotes": [
|
|
30
|
+
"error",
|
|
31
|
+
"single",
|
|
32
|
+
{
|
|
33
|
+
"allowTemplateLiterals": true
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"capitalized-comments": "off",
|
|
37
|
+
"no-await-in-loop": "off",
|
|
38
|
+
"no-warning-comments": "off",
|
|
39
|
+
"max-nested-callbacks": ["error", 6]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"parserOptions": {
|
|
44
|
+
"ecmaVersion": "latest"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/.prettierignore
ADDED
package/.prettierrc.json
ADDED
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# sui-trading-sdk
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { TransactionBlock } from '@mysten/sui.js/transactions';
|
|
2
|
+
|
|
3
|
+
type AcceptCollectionBid = {
|
|
4
|
+
bidId: string;
|
|
5
|
+
nftId: string;
|
|
6
|
+
walletAddress: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type AcceptNftBids = {
|
|
10
|
+
bidIds: string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type BuyListings = {
|
|
14
|
+
listingIds: string[];
|
|
15
|
+
walletAddress: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type ClaimNfts = {
|
|
19
|
+
nftIds: string[];
|
|
20
|
+
walletAddress: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type ListNfts = {
|
|
24
|
+
nfts: Array<{
|
|
25
|
+
id: string;
|
|
26
|
+
listPrice: number;
|
|
27
|
+
}>;
|
|
28
|
+
walletAddress: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type PlaceCollectionBid = {
|
|
32
|
+
collectionId: string;
|
|
33
|
+
bidAmount: number;
|
|
34
|
+
numOfBids: number;
|
|
35
|
+
walletAddress: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type PlaceNftBids = {
|
|
39
|
+
nfts: Array<{
|
|
40
|
+
id: string;
|
|
41
|
+
bidAmount: number;
|
|
42
|
+
}>;
|
|
43
|
+
walletAddress: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
type RemoveCollectionBid = {
|
|
47
|
+
bidId: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type RemoveNftBids = {
|
|
51
|
+
bidIds: string[];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type TransferNfts = {
|
|
55
|
+
nftIds: string[];
|
|
56
|
+
recipientAddress: string;
|
|
57
|
+
walletAddress: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
type UnlistListings = {
|
|
61
|
+
listingIds: string[];
|
|
62
|
+
walletAddress: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
type WithdrawKioskProfits = {
|
|
66
|
+
amount?: number;
|
|
67
|
+
walletAddress: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
type ApiConfig = {
|
|
71
|
+
apiUser: string;
|
|
72
|
+
apiKey: string;
|
|
73
|
+
};
|
|
74
|
+
declare class SuiTradingClient {
|
|
75
|
+
constructor({ apiUser, apiKey }: ApiConfig);
|
|
76
|
+
buyListings({ listingIds, walletAddress }: BuyListings): Promise<TransactionBlock>;
|
|
77
|
+
listNfts({ nfts, walletAddress }: ListNfts): Promise<TransactionBlock>;
|
|
78
|
+
unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<TransactionBlock>;
|
|
79
|
+
placeNftBids({ nfts, walletAddress }: PlaceNftBids): Promise<TransactionBlock>;
|
|
80
|
+
removeNftBids({ bidIds }: RemoveNftBids): Promise<TransactionBlock>;
|
|
81
|
+
acceptNftBids({ bidIds }: AcceptNftBids): Promise<TransactionBlock>;
|
|
82
|
+
placeCollectionBid({ collectionId, bidAmount, numOfBids, walletAddress, }: PlaceCollectionBid): Promise<TransactionBlock>;
|
|
83
|
+
acceptCollectionBid({ bidId, nftId, walletAddress }: AcceptCollectionBid): Promise<TransactionBlock>;
|
|
84
|
+
removeCollectionBid({ bidId }: RemoveCollectionBid): Promise<TransactionBlock>;
|
|
85
|
+
transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<TransactionBlock>;
|
|
86
|
+
claimNfts({ nftIds, walletAddress }: ClaimNfts): Promise<TransactionBlock>;
|
|
87
|
+
withdrawKioskProfits({ amount, walletAddress }: WithdrawKioskProfits): Promise<TransactionBlock>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { SuiTradingClient };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { TransactionBlock } from '@mysten/sui.js/transactions';
|
|
2
|
+
|
|
3
|
+
type AcceptCollectionBid = {
|
|
4
|
+
bidId: string;
|
|
5
|
+
nftId: string;
|
|
6
|
+
walletAddress: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type AcceptNftBids = {
|
|
10
|
+
bidIds: string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type BuyListings = {
|
|
14
|
+
listingIds: string[];
|
|
15
|
+
walletAddress: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type ClaimNfts = {
|
|
19
|
+
nftIds: string[];
|
|
20
|
+
walletAddress: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type ListNfts = {
|
|
24
|
+
nfts: Array<{
|
|
25
|
+
id: string;
|
|
26
|
+
listPrice: number;
|
|
27
|
+
}>;
|
|
28
|
+
walletAddress: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type PlaceCollectionBid = {
|
|
32
|
+
collectionId: string;
|
|
33
|
+
bidAmount: number;
|
|
34
|
+
numOfBids: number;
|
|
35
|
+
walletAddress: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type PlaceNftBids = {
|
|
39
|
+
nfts: Array<{
|
|
40
|
+
id: string;
|
|
41
|
+
bidAmount: number;
|
|
42
|
+
}>;
|
|
43
|
+
walletAddress: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
type RemoveCollectionBid = {
|
|
47
|
+
bidId: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type RemoveNftBids = {
|
|
51
|
+
bidIds: string[];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type TransferNfts = {
|
|
55
|
+
nftIds: string[];
|
|
56
|
+
recipientAddress: string;
|
|
57
|
+
walletAddress: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
type UnlistListings = {
|
|
61
|
+
listingIds: string[];
|
|
62
|
+
walletAddress: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
type WithdrawKioskProfits = {
|
|
66
|
+
amount?: number;
|
|
67
|
+
walletAddress: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
type ApiConfig = {
|
|
71
|
+
apiUser: string;
|
|
72
|
+
apiKey: string;
|
|
73
|
+
};
|
|
74
|
+
declare class SuiTradingClient {
|
|
75
|
+
constructor({ apiUser, apiKey }: ApiConfig);
|
|
76
|
+
buyListings({ listingIds, walletAddress }: BuyListings): Promise<TransactionBlock>;
|
|
77
|
+
listNfts({ nfts, walletAddress }: ListNfts): Promise<TransactionBlock>;
|
|
78
|
+
unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<TransactionBlock>;
|
|
79
|
+
placeNftBids({ nfts, walletAddress }: PlaceNftBids): Promise<TransactionBlock>;
|
|
80
|
+
removeNftBids({ bidIds }: RemoveNftBids): Promise<TransactionBlock>;
|
|
81
|
+
acceptNftBids({ bidIds }: AcceptNftBids): Promise<TransactionBlock>;
|
|
82
|
+
placeCollectionBid({ collectionId, bidAmount, numOfBids, walletAddress, }: PlaceCollectionBid): Promise<TransactionBlock>;
|
|
83
|
+
acceptCollectionBid({ bidId, nftId, walletAddress }: AcceptCollectionBid): Promise<TransactionBlock>;
|
|
84
|
+
removeCollectionBid({ bidId }: RemoveCollectionBid): Promise<TransactionBlock>;
|
|
85
|
+
transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<TransactionBlock>;
|
|
86
|
+
claimNfts({ nftIds, walletAddress }: ClaimNfts): Promise<TransactionBlock>;
|
|
87
|
+
withdrawKioskProfits({ amount, walletAddress }: WithdrawKioskProfits): Promise<TransactionBlock>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { SuiTradingClient };
|