@tradeport/sui-trading-sdk 0.5.5 → 0.5.6
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.ts +194 -0
- package/dist/index.js +7420 -0
- package/dist/index.js.map +1 -0
- package/package.json +71 -66
- package/.babel.config.js +0 -3
- package/.claude/settings.json +0 -5
- package/.claude/settings.local.json +0 -5
- package/.env.demo +0 -5
- package/.eslintrc.json +0 -46
- package/.prettierignore +0 -4
- package/.prettierrc.json +0 -7
- package/.vscode/launch.json +0 -23
- package/CHANGELOG.md +0 -746
- package/jest.config.js +0 -12
- package/src/SuiTradingClient.ts +0 -442
- package/src/apiClients/createKioskClient.ts +0 -10
- package/src/apiClients/createSuiClient.ts +0 -5
- package/src/apiClients/graphqlClient.ts +0 -17
- package/src/bigNumberConfig.ts +0 -10
- package/src/constants.ts +0 -1052
- package/src/graphql/createChainGQLQuery.ts +0 -27
- package/src/graphql/gqlChainRequest.ts +0 -21
- package/src/graphql/queries/fetchAccountKiosks.ts +0 -12
- package/src/graphql/queries/fetchActiveLockStateByNftId.ts +0 -15
- package/src/graphql/queries/fetchBidsById.ts +0 -36
- package/src/graphql/queries/fetchCollectionBidById.ts +0 -21
- package/src/graphql/queries/fetchCollectionBidsAtSamePrice.ts +0 -29
- package/src/graphql/queries/fetchCollectionChainState.ts +0 -17
- package/src/graphql/queries/fetchCollectionFloorListingForMarket.ts +0 -28
- package/src/graphql/queries/fetchCollectionFloorListings.ts +0 -15
- package/src/graphql/queries/fetchCollectionsById.ts +0 -39
- package/src/graphql/queries/fetchCommissionByListingId.ts +0 -13
- package/src/graphql/queries/fetchCryptoToUsdRate.ts +0 -13
- package/src/graphql/queries/fetchKiosksByOwner.ts +0 -14
- package/src/graphql/queries/fetchListingsById.ts +0 -29
- package/src/graphql/queries/fetchListingsByNftId.ts +0 -23
- package/src/graphql/queries/fetchLockById.ts +0 -23
- package/src/graphql/queries/fetchMultibidById.ts +0 -34
- package/src/graphql/queries/fetchNftCollectionChainState.ts +0 -12
- package/src/graphql/queries/fetchNftsById.ts +0 -75
- package/src/graphql/queries/fetchNftsByKioskId.ts +0 -45
- package/src/graphql/queries/fetchOwnerCapByKiosk.ts +0 -10
- package/src/graphql/queries/fetchPersonalCapByKiosk.ts +0 -10
- package/src/graphql/queries/fetchSharedObjectsByType.ts +0 -12
- package/src/graphql/queries/fetchTransferPoliciesByType.ts +0 -12
- package/src/graphql/queries/fetchWalletKiosks.ts +0 -14
- package/src/graphql/queries/getCommissionByListingId.ts +0 -15
- package/src/helpers/addOneDollarFee.ts +0 -17
- package/src/helpers/addThirdPartyTxFee.ts +0 -17
- package/src/helpers/calculatePremium.ts +0 -9
- package/src/helpers/calculateRoyaltyFee.ts +0 -28
- package/src/helpers/destroyZeroCoin.ts +0 -14
- package/src/helpers/getActiveLockStateByNftId.ts +0 -15
- package/src/helpers/getCollectionChainState.ts +0 -31
- package/src/helpers/getCollectionFloorPrice.ts +0 -12
- package/src/helpers/getLockById.ts +0 -29
- package/src/helpers/getMarketFeePrice.ts +0 -82
- package/src/helpers/getNftType.ts +0 -38
- package/src/helpers/getRoyaltyRuleModule.ts +0 -7
- package/src/helpers/getSharedObjects.ts +0 -119
- package/src/helpers/getSuiToUsdRate.ts +0 -14
- package/src/helpers/getTradeportBiddingContractBidAmount.ts +0 -31
- package/src/helpers/getTransferPolicyRuleNamesFromSuiObject.ts +0 -24
- package/src/helpers/hasPersonalKioskRule.ts +0 -7
- package/src/helpers/hasRoyaltyRule.ts +0 -7
- package/src/helpers/hasTransferPolicyRules.ts +0 -6
- package/src/helpers/isExpiredListing.ts +0 -9
- package/src/helpers/isNonKioskListing.ts +0 -14
- package/src/helpers/isSIngleBid.ts +0 -13
- package/src/helpers/kiosk/assertNftInSharedKiosk.ts +0 -31
- package/src/helpers/kiosk/getKioskCollectionRoyaltyFeeAmount.ts +0 -71
- package/src/helpers/kiosk/getKioskIdFromKioskTx.ts +0 -29
- package/src/helpers/kiosk/getKioskPlaceBidCoin.ts +0 -59
- package/src/helpers/kiosk/getNativeKioskTransferPolicies.ts +0 -29
- package/src/helpers/kiosk/getNativeKioskTransferPoliciesByNftType.ts +0 -21
- package/src/helpers/kiosk/getRulePackageId.ts +0 -59
- package/src/helpers/kiosk/getTransferPoliciesToResolve.ts +0 -154
- package/src/helpers/kiosk/isBluemoveKioskBid.ts +0 -1
- package/src/helpers/kiosk/isTradePortKioskBid.ts +0 -4
- package/src/helpers/kiosk/kioskListingBcs.ts +0 -19
- package/src/helpers/kiosk/kioskTxWrapper.ts +0 -152
- package/src/helpers/kiosk/lockNftInsideKioskIfNotLocked.ts +0 -100
- package/src/helpers/kiosk/preProcessSharedBulkBuyingData.ts +0 -171
- package/src/helpers/kiosk/resolveCustomTransferPolicyRules.ts +0 -75
- package/src/helpers/kiosk/resolveFloorPriceRule.ts +0 -21
- package/src/helpers/kiosk/resolveKioskLockRule.ts +0 -47
- package/src/helpers/kiosk/resolvePersonalKioskRule.ts +0 -23
- package/src/helpers/kiosk/resolveRoyaltyRule.ts +0 -57
- package/src/helpers/kiosk/resolveTableAllowlistRule.ts +0 -34
- package/src/helpers/kiosk/resolveTransferPolicies.ts +0 -158
- package/src/helpers/kiosk/sharedKioskState.type.ts +0 -11
- package/src/helpers/kiosk/takeAndBorrowNftFromKiosk.ts +0 -50
- package/src/helpers/kiosk/takeLockedNftFromKiosk.ts +0 -73
- package/src/helpers/kiosk/upgradeKioskRulesPackageId.ts +0 -17
- package/src/helpers/originByte/confirmOBTranfer.ts +0 -33
- package/src/helpers/originByte/createOBKiosk.ts +0 -14
- package/src/helpers/originByte/depositNftIntoOBKiosk.ts +0 -16
- package/src/helpers/originByte/getOBBidderKiosk.ts +0 -12
- package/src/helpers/originByte/getOBKiosk.ts +0 -24
- package/src/helpers/originByte/getOrCreateOBKiosk.ts +0 -42
- package/src/helpers/originByte/isOBKiosk.ts +0 -13
- package/src/helpers/originByte/isOriginByteBid.ts +0 -30
- package/src/helpers/originByte/isOriginByteCollection.ts +0 -11
- package/src/helpers/originByte/shareOriginByteKiosk.ts +0 -14
- package/src/helpers/rpc/getAcountBalance.ts +0 -18
- package/src/helpers/rpc/getObjectType.ts +0 -25
- package/src/helpers/splitCoins.ts +0 -12
- package/src/helpers/track.ts +0 -20
- package/src/helpers/validateMinFloorPrice.ts +0 -22
- package/src/index.ts +0 -2
- package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +0 -189
- package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +0 -398
- package/src/methods/acceptNftBids/acceptNftBids.ts +0 -174
- package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +0 -438
- package/src/methods/applyFtStrategy/applyFtStrategy.ts +0 -55
- package/src/methods/applyNftStrategy/applyNftStrategy.ts +0 -90
- package/src/methods/buyListings/addBuyListingTxs.ts +0 -806
- package/src/methods/buyListings/buyListings.ts +0 -230
- package/src/methods/cancelMultiBid/cancelMultiBid.ts +0 -51
- package/src/methods/cancelNftTransfers/addCancelNftTransfersTx.ts +0 -20
- package/src/methods/cancelNftTransfers/cancelNftTransfers.ts +0 -118
- package/src/methods/claimNfts/addClaimNftsTxs.ts +0 -247
- package/src/methods/claimNfts/claimNfts.ts +0 -270
- package/src/methods/createMultiBid/createMultiBid.ts +0 -36
- package/src/methods/listNfts/addListTxs.ts +0 -210
- package/src/methods/listNfts/addRelistTxs.ts +0 -87
- package/src/methods/listNfts/listNfts.ts +0 -152
- package/src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts +0 -226
- package/src/methods/placeCollectionBids/addPlaceCollectionBidTxs.ts +0 -149
- package/src/methods/placeCollectionBids/placeCollectionBids.ts +0 -153
- package/src/methods/placeNftBids/addPlaceNftBidTxs.ts +0 -154
- package/src/methods/placeNftBids/placeNftBids.ts +0 -111
- package/src/methods/relistNft/relistNft.ts +0 -153
- package/src/methods/removeCollectionBids/addRemoveCollectionBidsTxs.ts +0 -132
- package/src/methods/removeCollectionBids/removeCollectionBids.ts +0 -117
- package/src/methods/removeNftBids/addRemoveNftBidTxs.ts +0 -122
- package/src/methods/removeNftBids/removeNftBids.ts +0 -116
- package/src/methods/sponsorNftListing/addSponsorNftListingTx.ts +0 -40
- package/src/methods/sponsorNftListing/sponsorNftListing.ts +0 -60
- package/src/methods/transferNfts/addTransferNftTx.ts +0 -220
- package/src/methods/transferNfts/transferNfts.ts +0 -216
- package/src/methods/unlistListings/addUnlistListingTxs.ts +0 -399
- package/src/methods/unlistListings/unlistListings.ts +0 -158
- package/src/methods/updateMultiBid/updateMultiBid.ts +0 -66
- package/src/methods/withdrawProfitsFromKiosks/withdrawProfitsFromKiosks.ts +0 -100
- package/src/tests/SuiWallet.ts +0 -83
- package/src/utils/addHexPrefix.ts +0 -7
- package/src/utils/addLeadingZerosAfter0x.ts +0 -9
- package/src/utils/normalizeNftType.ts +0 -7
- package/src/utils/printTxBlockTxs.ts +0 -11
- package/src/utils/pureValues.ts +0 -13
- package/src/utils/toUint8Array.ts +0 -12
- package/tsconfig.json +0 -16
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
type ChainQuery = {
|
|
4
|
-
chain: string;
|
|
5
|
-
query: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function createChainGQLQuery({ chain, query }: ChainQuery) {
|
|
9
|
-
const regex = /query\s+(\w+)\s*\(([\s\S]*?)\)\s*((?:@\w+(?:\([^)]*\))?\s*)*){([\s\S]*)}/;
|
|
10
|
-
const matches = regex.exec(query);
|
|
11
|
-
|
|
12
|
-
if (!matches || matches.length !== 5) {
|
|
13
|
-
throw new Error('Invalid query string format');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const [, queryName, argsString, directivesString, bodyString] = matches;
|
|
17
|
-
|
|
18
|
-
if (!argsString || !bodyString) return '';
|
|
19
|
-
|
|
20
|
-
const args = argsString.trim().length ? `(${argsString.trim()})` : '';
|
|
21
|
-
const directives = directivesString.trim();
|
|
22
|
-
const directivesPart = directives.length ? ` ${directives}` : '';
|
|
23
|
-
const body = bodyString.trim();
|
|
24
|
-
const wrappedBody = `${chain} {\n${body}\n}`;
|
|
25
|
-
|
|
26
|
-
return gql`query ${queryName}${args}${directivesPart} {\n${wrappedBody}\n}`;
|
|
27
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { getGraphqlClient } from '../apiClients/graphqlClient';
|
|
2
|
-
import { createChainGQLQuery } from './createChainGQLQuery';
|
|
3
|
-
|
|
4
|
-
type Args = {
|
|
5
|
-
chain: string;
|
|
6
|
-
query: string;
|
|
7
|
-
variables?: any;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const gqlChainRequest = async ({ chain, query, variables }: Args) => {
|
|
11
|
-
if (!chain || !query) {
|
|
12
|
-
throw new Error('Missing required arguments');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const response = await getGraphqlClient().request<any>(
|
|
16
|
-
createChainGQLQuery({ chain, query }),
|
|
17
|
-
variables,
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
return response?.[chain];
|
|
21
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchAccountKiosks = gql`
|
|
4
|
-
query fetchAccountKiosks($accountAddress: String!) {
|
|
5
|
-
kiosks: kiosks_by_owner_address(owner_address: $accountAddress) {
|
|
6
|
-
id
|
|
7
|
-
is_origin_byte
|
|
8
|
-
owner_address
|
|
9
|
-
profits
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchActiveLockStateByNftId = gql`
|
|
4
|
-
query fetchActiveLockStateByNftId($nftId: uuid!) {
|
|
5
|
-
locks(
|
|
6
|
-
where: {
|
|
7
|
-
state: { _nin: ["exercised", "canceled", "confirmed"] }
|
|
8
|
-
nft_meta_id: { _eq: $nftId }
|
|
9
|
-
}
|
|
10
|
-
) {
|
|
11
|
-
id
|
|
12
|
-
state
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchBidsById = gql`
|
|
4
|
-
query fetchBidsById($bidIds: [uuid!]) {
|
|
5
|
-
bids(where: { id: { _in: $bidIds } }) {
|
|
6
|
-
nonce
|
|
7
|
-
price
|
|
8
|
-
status
|
|
9
|
-
type
|
|
10
|
-
receiver
|
|
11
|
-
bidder
|
|
12
|
-
multi_bid_id
|
|
13
|
-
nft {
|
|
14
|
-
token_id
|
|
15
|
-
properties
|
|
16
|
-
chain_state
|
|
17
|
-
collection_id
|
|
18
|
-
owner
|
|
19
|
-
contract {
|
|
20
|
-
properties
|
|
21
|
-
}
|
|
22
|
-
listings(where: { listed: { _eq: true } }) {
|
|
23
|
-
price
|
|
24
|
-
market_name
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
market_contract {
|
|
28
|
-
name
|
|
29
|
-
}
|
|
30
|
-
collection {
|
|
31
|
-
id
|
|
32
|
-
chain_state
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchCollectionBidsById = gql`
|
|
4
|
-
query fetchCollectionBidsById($bidIds: [uuid!]) {
|
|
5
|
-
bids(where: { id: { _in: $bidIds } }) {
|
|
6
|
-
nonce
|
|
7
|
-
price
|
|
8
|
-
bidder
|
|
9
|
-
status
|
|
10
|
-
type
|
|
11
|
-
collection_id
|
|
12
|
-
multi_bid_id
|
|
13
|
-
contract {
|
|
14
|
-
properties
|
|
15
|
-
}
|
|
16
|
-
market_contract {
|
|
17
|
-
name
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchCollectionBidsAtSamePrice = gql`
|
|
4
|
-
query fetchCollectionBidsAtSamePrice($collectionId: uuid!, $price: numeric) {
|
|
5
|
-
bids(
|
|
6
|
-
where: {
|
|
7
|
-
collection_id: { _eq: $collectionId }
|
|
8
|
-
price: { _eq: $price }
|
|
9
|
-
status: { _eq: "active" }
|
|
10
|
-
type: { _eq: "collection" }
|
|
11
|
-
}
|
|
12
|
-
order_by: { price: desc }
|
|
13
|
-
) {
|
|
14
|
-
nonce
|
|
15
|
-
price
|
|
16
|
-
bidder
|
|
17
|
-
status
|
|
18
|
-
type
|
|
19
|
-
collection_id
|
|
20
|
-
multi_bid_id
|
|
21
|
-
contract {
|
|
22
|
-
properties
|
|
23
|
-
}
|
|
24
|
-
market_contract {
|
|
25
|
-
name
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchCollectionChainState = gql`
|
|
4
|
-
query fetchCollectionChainState($collectionId: uuid!) @cached(ttl: 10) {
|
|
5
|
-
collections(where: { id: { _eq: $collectionId } }) {
|
|
6
|
-
chain_state
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
export const fetchCollectionChainStateByFtType = gql`
|
|
12
|
-
query fetchCollectionChainStateByFtType($ftType: String!) @cached(ttl: 10) {
|
|
13
|
-
collections_by_ft_type(args: { coin_type: $ftType }, limit: 1) {
|
|
14
|
-
chain_state
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchCollectionFloorListingsForMarket = gql`
|
|
4
|
-
query fetchCollectionFloorListingsForMarket(
|
|
5
|
-
$collectionId: uuid!
|
|
6
|
-
$marketAddress: String!
|
|
7
|
-
$totalPrice: numeric
|
|
8
|
-
) {
|
|
9
|
-
listings(
|
|
10
|
-
where: {
|
|
11
|
-
collection_id: { _eq: $collectionId }
|
|
12
|
-
listed: { _eq: true }
|
|
13
|
-
market_name: { _eq: "tradeport" }
|
|
14
|
-
seller: { _neq: $marketAddress }
|
|
15
|
-
nonce: { _like: "1::0x%" }
|
|
16
|
-
price: { _lte: $totalPrice }
|
|
17
|
-
}
|
|
18
|
-
order_by: [{ price: asc_nulls_last }, { block_height: asc }, { tx_index: asc }]
|
|
19
|
-
) {
|
|
20
|
-
id
|
|
21
|
-
price
|
|
22
|
-
nft {
|
|
23
|
-
token_id
|
|
24
|
-
delegated_owner
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchCollectionFloorListings = gql`
|
|
4
|
-
query fetchCollectionFloorListings($collectionId: uuid!) {
|
|
5
|
-
listings(
|
|
6
|
-
where: { collection_id: { _eq: $collectionId }, listed: { _eq: true }, nft: {} }
|
|
7
|
-
order_by: { price: asc_nulls_last, market_name: desc_nulls_last }
|
|
8
|
-
limit: 3
|
|
9
|
-
) {
|
|
10
|
-
id
|
|
11
|
-
price
|
|
12
|
-
market_name
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchCollectionsById = gql`
|
|
4
|
-
query fetchCollectionsById($collectionIds: [uuid!]) {
|
|
5
|
-
collections(where: { id: { _in: $collectionIds } }) {
|
|
6
|
-
id
|
|
7
|
-
contract {
|
|
8
|
-
properties
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
export const fetchCollectionsByIdWithOneNft = gql`
|
|
15
|
-
query fetchCollectionsByIdWithOneNft($collectionIds: [uuid!]) {
|
|
16
|
-
collections(where: { id: { _in: $collectionIds } }) {
|
|
17
|
-
id
|
|
18
|
-
chain_state
|
|
19
|
-
contract {
|
|
20
|
-
properties
|
|
21
|
-
}
|
|
22
|
-
nfts(limit: 1) {
|
|
23
|
-
id
|
|
24
|
-
properties
|
|
25
|
-
contract {
|
|
26
|
-
properties
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
export const fetchCollectionsBySlug = gql`
|
|
34
|
-
query fetchCollectionsBySlug($slug: String!) {
|
|
35
|
-
collections(where: { slug: { _eq: $slug } }) {
|
|
36
|
-
id
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchCommissionByNftContractId = gql`
|
|
4
|
-
query fetchCommissionByNftContractId($nftContractId: uuid!) {
|
|
5
|
-
commissions(where: { contract_id: { _eq: $nftContractId } }) {
|
|
6
|
-
is_custodial
|
|
7
|
-
key
|
|
8
|
-
market_fee
|
|
9
|
-
market_name
|
|
10
|
-
royalty
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchCryptoToUsdRate = gql`
|
|
4
|
-
query fetchCryptoToUsdRate($crypto: String!) {
|
|
5
|
-
crypto_rates(where: { crypto: { _eq: $crypto }, fiat: { _eq: "USD" } }) {
|
|
6
|
-
crypto
|
|
7
|
-
fiat
|
|
8
|
-
id
|
|
9
|
-
rate
|
|
10
|
-
timestamp
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchKiosksByOwner = gql`
|
|
4
|
-
query fetchKiosksByOwner($ownerAddress: String!) {
|
|
5
|
-
kiosks: kiosks_by_owner_address(owner_address: $ownerAddress) {
|
|
6
|
-
id
|
|
7
|
-
is_origin_byte
|
|
8
|
-
is_personal
|
|
9
|
-
owner_address
|
|
10
|
-
profits
|
|
11
|
-
is_shared
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchListingsById = gql`
|
|
4
|
-
query fetchListingsById($listingIds: [uuid!]) {
|
|
5
|
-
listings(where: { id: { _in: $listingIds } }) {
|
|
6
|
-
id
|
|
7
|
-
seller
|
|
8
|
-
listed
|
|
9
|
-
market_name
|
|
10
|
-
price
|
|
11
|
-
nonce
|
|
12
|
-
nft {
|
|
13
|
-
id
|
|
14
|
-
token_id
|
|
15
|
-
collection_id
|
|
16
|
-
contract_id
|
|
17
|
-
properties
|
|
18
|
-
chain_state
|
|
19
|
-
contract {
|
|
20
|
-
properties
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
collection {
|
|
24
|
-
id
|
|
25
|
-
chain_state
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchListingsByNftId = gql`
|
|
4
|
-
query fetchListingsByNftId($nftIds: [uuid!]) {
|
|
5
|
-
listings(where: { nft_id: { _in: $nftIds }, listed: { _eq: true } }) {
|
|
6
|
-
listed
|
|
7
|
-
market_name
|
|
8
|
-
price
|
|
9
|
-
nonce
|
|
10
|
-
nft {
|
|
11
|
-
id
|
|
12
|
-
token_id
|
|
13
|
-
collection_id
|
|
14
|
-
contract_id
|
|
15
|
-
properties
|
|
16
|
-
chain_state
|
|
17
|
-
contract {
|
|
18
|
-
properties
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchLockById = gql`
|
|
4
|
-
query fetchLockById($lockId: uuid!) {
|
|
5
|
-
locks(where: { id: { _eq: $lockId } }) {
|
|
6
|
-
id
|
|
7
|
-
type
|
|
8
|
-
state
|
|
9
|
-
collection_id
|
|
10
|
-
lock_id
|
|
11
|
-
nft_type
|
|
12
|
-
maker_price
|
|
13
|
-
maker
|
|
14
|
-
chain_state
|
|
15
|
-
collection_id
|
|
16
|
-
expire_in
|
|
17
|
-
nft {
|
|
18
|
-
id
|
|
19
|
-
token_id
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchMultibidChainIdById = gql`
|
|
4
|
-
query fetchMultibidById($multiBidId: uuid!) {
|
|
5
|
-
multi_bids(where: { id: { _eq: $multiBidId } }) {
|
|
6
|
-
chain_id
|
|
7
|
-
cancelled_at
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
export const fetchMultibidChainIdAndSingleBidsById = gql`
|
|
13
|
-
query fetchMultibidChainIdAndSingleBidsById($multiBidId: uuid!) {
|
|
14
|
-
multi_bids(where: { id: { _eq: $multiBidId } }) {
|
|
15
|
-
chain_id
|
|
16
|
-
cancelled_at
|
|
17
|
-
bids(where: { status: { _in: ["active", "inactive", "expired"] } }) {
|
|
18
|
-
nonce
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
export const fetchMultibidChainIdAndExpiredSingleBidsById = gql`
|
|
25
|
-
query fetchMultibidChainIdAndExpiredSingleBidsById($multiBidId: uuid!, $expiredBidLimit: Int!) {
|
|
26
|
-
multi_bids(where: { id: { _eq: $multiBidId } }) {
|
|
27
|
-
chain_id
|
|
28
|
-
cancelled_at
|
|
29
|
-
bids(where: { status: { _eq: "expired" } }, limit: $expiredBidLimit) {
|
|
30
|
-
nonce
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchNftCollectionChainState = gql`
|
|
4
|
-
query fetchNftCollectionChainState($nftTokenId: String!) {
|
|
5
|
-
nfts(where: { token_id: { _eq: $nftTokenId } }) {
|
|
6
|
-
collection {
|
|
7
|
-
id
|
|
8
|
-
chain_state
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchNftById = gql`
|
|
4
|
-
query fetchNftById($nftId: uuid!) {
|
|
5
|
-
nfts(where: { id: { _eq: $nftId } }) {
|
|
6
|
-
id
|
|
7
|
-
token_id
|
|
8
|
-
collection_id
|
|
9
|
-
properties
|
|
10
|
-
chain_state
|
|
11
|
-
listed
|
|
12
|
-
owner
|
|
13
|
-
contract {
|
|
14
|
-
properties
|
|
15
|
-
}
|
|
16
|
-
listings(where: { listed: { _eq: true } }) {
|
|
17
|
-
price
|
|
18
|
-
nonce
|
|
19
|
-
market_name
|
|
20
|
-
}
|
|
21
|
-
collection {
|
|
22
|
-
id
|
|
23
|
-
chain_state
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export const fetchNftsById = gql`
|
|
30
|
-
query fetchNftsById($nftIds: [uuid!]) {
|
|
31
|
-
nfts(where: { id: { _in: $nftIds } }) {
|
|
32
|
-
id
|
|
33
|
-
token_id
|
|
34
|
-
collection_id
|
|
35
|
-
properties
|
|
36
|
-
chain_state
|
|
37
|
-
listed
|
|
38
|
-
owner
|
|
39
|
-
contract {
|
|
40
|
-
properties
|
|
41
|
-
}
|
|
42
|
-
collection {
|
|
43
|
-
id
|
|
44
|
-
chain_state
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
export const fetchNftsWithListingsById = gql`
|
|
51
|
-
query fetchNftsWithListingsById($nftIds: [uuid!]) {
|
|
52
|
-
nfts(where: { id: { _in: $nftIds } }) {
|
|
53
|
-
id
|
|
54
|
-
token_id
|
|
55
|
-
collection_id
|
|
56
|
-
properties
|
|
57
|
-
chain_state
|
|
58
|
-
listed
|
|
59
|
-
contract {
|
|
60
|
-
properties
|
|
61
|
-
}
|
|
62
|
-
listings {
|
|
63
|
-
listed
|
|
64
|
-
market_name
|
|
65
|
-
price
|
|
66
|
-
nonce
|
|
67
|
-
seller
|
|
68
|
-
}
|
|
69
|
-
collection {
|
|
70
|
-
id
|
|
71
|
-
chain_state
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
`;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchNftsByKioskId = gql`
|
|
4
|
-
query fetchNftsByKioskId($jsonFilter: jsonb) {
|
|
5
|
-
nfts(where: { chain_state: { _contains: $jsonFilter } }) {
|
|
6
|
-
id
|
|
7
|
-
name
|
|
8
|
-
token_id
|
|
9
|
-
properties
|
|
10
|
-
chain_state
|
|
11
|
-
collection_id
|
|
12
|
-
claimable_reason
|
|
13
|
-
owner
|
|
14
|
-
contract {
|
|
15
|
-
properties
|
|
16
|
-
}
|
|
17
|
-
collection {
|
|
18
|
-
id
|
|
19
|
-
chain_state
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
export const fetchBulkNftsByKioskId = gql`
|
|
26
|
-
query fetchNftsByKioskId($where: nfts_bool_exp) {
|
|
27
|
-
nfts(where: $where) {
|
|
28
|
-
id
|
|
29
|
-
name
|
|
30
|
-
token_id
|
|
31
|
-
properties
|
|
32
|
-
chain_state
|
|
33
|
-
collection_id
|
|
34
|
-
claimable_reason
|
|
35
|
-
owner
|
|
36
|
-
contract {
|
|
37
|
-
properties
|
|
38
|
-
}
|
|
39
|
-
collection {
|
|
40
|
-
id
|
|
41
|
-
chain_state
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
|
|
3
|
-
export const fetchWalletKiosks = gql`
|
|
4
|
-
query fetchWalletKiosks($wallet: String!) {
|
|
5
|
-
kiosks: kiosks_by_owner_address(owner_address: $wallet) {
|
|
6
|
-
id
|
|
7
|
-
is_origin_byte
|
|
8
|
-
is_personal
|
|
9
|
-
owner_address
|
|
10
|
-
profits
|
|
11
|
-
is_shared
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { gqlChainRequest } from '../gqlChainRequest';
|
|
2
|
-
import { fetchCommissionByNftContractId } from './fetchCommissionByListingId';
|
|
3
|
-
|
|
4
|
-
export const getCommissionByNftContractId = async (nftContractId: string) => {
|
|
5
|
-
try {
|
|
6
|
-
const res = await gqlChainRequest({
|
|
7
|
-
chain: 'sui',
|
|
8
|
-
query: fetchCommissionByNftContractId,
|
|
9
|
-
variables: { nftContractId },
|
|
10
|
-
});
|
|
11
|
-
return res?.commissions?.[0];
|
|
12
|
-
} catch (err) {
|
|
13
|
-
throw new Error(`Failed to fetch commission for listing ${nftContractId}`);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type Transaction } from '@mysten/sui/transactions';
|
|
2
|
-
import { TRADEPORT_BENEFICIARY_ADDRESS } from '../constants';
|
|
3
|
-
import { addLeadingZerosAfter0x } from '../utils/addLeadingZerosAfter0x';
|
|
4
|
-
import { getSuiToUsdRate } from './getSuiToUsdRate';
|
|
5
|
-
|
|
6
|
-
export const addOneDollarFee = async (tx: Transaction) => {
|
|
7
|
-
const rate = await getSuiToUsdRate();
|
|
8
|
-
|
|
9
|
-
const companyFee = BigInt(Math.ceil(1_000_000_000 / rate));
|
|
10
|
-
|
|
11
|
-
const [microTxFee] = tx.splitCoins(tx.gas, [tx.pure.u64(Number(companyFee))]);
|
|
12
|
-
|
|
13
|
-
tx.transferObjects(
|
|
14
|
-
[tx.object(microTxFee)],
|
|
15
|
-
tx.pure.address(addLeadingZerosAfter0x(TRADEPORT_BENEFICIARY_ADDRESS)),
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type Transaction } from '@mysten/sui/transactions';
|
|
2
|
-
import {
|
|
3
|
-
TRADEPORT_BENEFICIARY_ADDRESS,
|
|
4
|
-
TRADEPORT_THIRD_PARTY_FEE_DECIMAL_PERCENT,
|
|
5
|
-
} from '../constants';
|
|
6
|
-
import { addLeadingZerosAfter0x } from '../utils/addLeadingZerosAfter0x';
|
|
7
|
-
|
|
8
|
-
export const addThirdPartyTxFee = async (tx: Transaction, price: number) => {
|
|
9
|
-
const [microTxFee] = tx.splitCoins(tx.gas, [
|
|
10
|
-
tx.pure.u64(price * TRADEPORT_THIRD_PARTY_FEE_DECIMAL_PERCENT),
|
|
11
|
-
]);
|
|
12
|
-
|
|
13
|
-
tx.transferObjects(
|
|
14
|
-
[tx.object(microTxFee)],
|
|
15
|
-
tx.pure.address(addLeadingZerosAfter0x(TRADEPORT_BENEFICIARY_ADDRESS)),
|
|
16
|
-
);
|
|
17
|
-
};
|