@tradeport/sui-trading-sdk 0.0.8 → 0.1.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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +47 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +466 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +466 -33
- package/dist/index.mjs.map +1 -1
- package/jest.config.js +1 -0
- package/package.json +1 -1
- package/src/SuiTradingClient.ts +25 -0
- package/src/constants.ts +6 -1
- package/src/graphql/queries/fetchBidsById.ts +1 -0
- package/src/graphql/queries/fetchCollectionsById.ts +8 -0
- package/src/graphql/queries/fetchLockById.ts +22 -0
- package/src/helpers/calculatePremium.ts +9 -0
- package/src/helpers/calculateRoyaltyFee.ts +12 -0
- package/src/helpers/getLockById.ts +27 -0
- package/src/helpers/kiosk/kioskTxWrapper.ts +7 -1
- package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +4 -4
- package/src/methods/acceptNftBids/acceptNftBids.ts +10 -2
- package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +5 -4
- package/src/methods/buyAndExerciseLock/buyAndExerciseLock.ts +10 -0
- package/src/methods/buyListings/addBuyListingTxs.ts +6 -3
- package/src/methods/buyListings/buyListings.ts +7 -1
- package/src/methods/buyLock/buyLock.ts +38 -0
- package/src/methods/cancelLock/cancelLock.ts +39 -0
- package/src/methods/claimNfts/addClaimNftsTxs.ts +1 -1
- package/src/methods/claimNfts/claimNfts.ts +7 -2
- package/src/methods/createLock/createLock.ts +117 -0
- package/src/methods/exerciseLock/exerciseLock.ts +257 -0
- package/src/methods/listNfts/addRelistTxs.ts +3 -3
- package/src/methods/removeCollectionBid/addRemoveCollectionBidTxs.ts +3 -3
- package/src/methods/removeNftBids/addRemoveNftBidTxs.ts +5 -5
- package/src/methods/unlistListings/addUnlistListingTxs.ts +4 -4
- package/src/tests/SuiWallet.ts +25 -5
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { KioskTransaction } from '@mysten/kiosk';
|
|
2
3
|
|
|
3
4
|
type AcceptCollectionBid = {
|
|
4
5
|
bidId: string;
|
|
@@ -8,16 +9,21 @@ type AcceptCollectionBid = {
|
|
|
8
9
|
|
|
9
10
|
type AcceptNftBids = {
|
|
10
11
|
bidIds: string[];
|
|
12
|
+
tx?: Transaction;
|
|
13
|
+
kioskTx?: KioskTransaction;
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
type BuyListings = {
|
|
14
17
|
listingIds: string[];
|
|
15
18
|
walletAddress: string;
|
|
19
|
+
tx?: Transaction;
|
|
20
|
+
kioskTx?: KioskTransaction;
|
|
16
21
|
};
|
|
17
22
|
|
|
18
23
|
type ClaimNfts = {
|
|
19
24
|
nftIds: string[];
|
|
20
25
|
walletAddress: string;
|
|
26
|
+
tx?: Transaction;
|
|
21
27
|
};
|
|
22
28
|
|
|
23
29
|
type ListNfts = {
|
|
@@ -67,6 +73,42 @@ type WithdrawKioskProfits = {
|
|
|
67
73
|
walletAddress: string;
|
|
68
74
|
};
|
|
69
75
|
|
|
76
|
+
type CreateLockCommon = {
|
|
77
|
+
type: string;
|
|
78
|
+
nftType?: string;
|
|
79
|
+
collectionId?: string;
|
|
80
|
+
price: bigint;
|
|
81
|
+
};
|
|
82
|
+
type CreateLongLock = CreateLockCommon & {
|
|
83
|
+
type: 'long';
|
|
84
|
+
nftId: string;
|
|
85
|
+
walletAddress: string;
|
|
86
|
+
};
|
|
87
|
+
type CreateShortLock = CreateLockCommon & {
|
|
88
|
+
type: 'short';
|
|
89
|
+
nftType: string;
|
|
90
|
+
};
|
|
91
|
+
type CreateLock = CreateLongLock | CreateShortLock;
|
|
92
|
+
|
|
93
|
+
type CancelLock = {
|
|
94
|
+
lockId: string;
|
|
95
|
+
walletAddress: string;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
type BuyLock = {
|
|
99
|
+
lockId: string;
|
|
100
|
+
tx?: Transaction;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type ExerciseLock = {
|
|
104
|
+
lockId: string;
|
|
105
|
+
walletAddress: string;
|
|
106
|
+
bidId?: string;
|
|
107
|
+
listingId?: string;
|
|
108
|
+
nftId?: string;
|
|
109
|
+
tx?: Transaction;
|
|
110
|
+
};
|
|
111
|
+
|
|
70
112
|
type ApiConfig = {
|
|
71
113
|
apiUser: string;
|
|
72
114
|
apiKey: string;
|
|
@@ -85,6 +127,11 @@ declare class SuiTradingClient {
|
|
|
85
127
|
transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<Transaction>;
|
|
86
128
|
claimNfts({ nftIds, walletAddress }: ClaimNfts): Promise<Transaction>;
|
|
87
129
|
withdrawKioskProfits({ amount, walletAddress }: WithdrawKioskProfits): Promise<Transaction>;
|
|
130
|
+
createLock(args: CreateLock): Promise<Transaction>;
|
|
131
|
+
cancelLock(args: CancelLock): Promise<Transaction>;
|
|
132
|
+
buyLock(args: BuyLock): Promise<Transaction>;
|
|
133
|
+
exerciseLock(args: ExerciseLock): Promise<Transaction>;
|
|
134
|
+
buyAndExerciseLock(args: BuyLock & ExerciseLock): Promise<Transaction>;
|
|
88
135
|
}
|
|
89
136
|
|
|
90
137
|
export { SuiTradingClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { KioskTransaction } from '@mysten/kiosk';
|
|
2
3
|
|
|
3
4
|
type AcceptCollectionBid = {
|
|
4
5
|
bidId: string;
|
|
@@ -8,16 +9,21 @@ type AcceptCollectionBid = {
|
|
|
8
9
|
|
|
9
10
|
type AcceptNftBids = {
|
|
10
11
|
bidIds: string[];
|
|
12
|
+
tx?: Transaction;
|
|
13
|
+
kioskTx?: KioskTransaction;
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
type BuyListings = {
|
|
14
17
|
listingIds: string[];
|
|
15
18
|
walletAddress: string;
|
|
19
|
+
tx?: Transaction;
|
|
20
|
+
kioskTx?: KioskTransaction;
|
|
16
21
|
};
|
|
17
22
|
|
|
18
23
|
type ClaimNfts = {
|
|
19
24
|
nftIds: string[];
|
|
20
25
|
walletAddress: string;
|
|
26
|
+
tx?: Transaction;
|
|
21
27
|
};
|
|
22
28
|
|
|
23
29
|
type ListNfts = {
|
|
@@ -67,6 +73,42 @@ type WithdrawKioskProfits = {
|
|
|
67
73
|
walletAddress: string;
|
|
68
74
|
};
|
|
69
75
|
|
|
76
|
+
type CreateLockCommon = {
|
|
77
|
+
type: string;
|
|
78
|
+
nftType?: string;
|
|
79
|
+
collectionId?: string;
|
|
80
|
+
price: bigint;
|
|
81
|
+
};
|
|
82
|
+
type CreateLongLock = CreateLockCommon & {
|
|
83
|
+
type: 'long';
|
|
84
|
+
nftId: string;
|
|
85
|
+
walletAddress: string;
|
|
86
|
+
};
|
|
87
|
+
type CreateShortLock = CreateLockCommon & {
|
|
88
|
+
type: 'short';
|
|
89
|
+
nftType: string;
|
|
90
|
+
};
|
|
91
|
+
type CreateLock = CreateLongLock | CreateShortLock;
|
|
92
|
+
|
|
93
|
+
type CancelLock = {
|
|
94
|
+
lockId: string;
|
|
95
|
+
walletAddress: string;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
type BuyLock = {
|
|
99
|
+
lockId: string;
|
|
100
|
+
tx?: Transaction;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type ExerciseLock = {
|
|
104
|
+
lockId: string;
|
|
105
|
+
walletAddress: string;
|
|
106
|
+
bidId?: string;
|
|
107
|
+
listingId?: string;
|
|
108
|
+
nftId?: string;
|
|
109
|
+
tx?: Transaction;
|
|
110
|
+
};
|
|
111
|
+
|
|
70
112
|
type ApiConfig = {
|
|
71
113
|
apiUser: string;
|
|
72
114
|
apiKey: string;
|
|
@@ -85,6 +127,11 @@ declare class SuiTradingClient {
|
|
|
85
127
|
transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<Transaction>;
|
|
86
128
|
claimNfts({ nftIds, walletAddress }: ClaimNfts): Promise<Transaction>;
|
|
87
129
|
withdrawKioskProfits({ amount, walletAddress }: WithdrawKioskProfits): Promise<Transaction>;
|
|
130
|
+
createLock(args: CreateLock): Promise<Transaction>;
|
|
131
|
+
cancelLock(args: CancelLock): Promise<Transaction>;
|
|
132
|
+
buyLock(args: BuyLock): Promise<Transaction>;
|
|
133
|
+
exerciseLock(args: ExerciseLock): Promise<Transaction>;
|
|
134
|
+
buyAndExerciseLock(args: BuyLock & ExerciseLock): Promise<Transaction>;
|
|
88
135
|
}
|
|
89
136
|
|
|
90
137
|
export { SuiTradingClient };
|