@tradeport/sui-trading-sdk 0.5.3 → 0.5.5
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/.claude/settings.json +5 -0
- package/.claude/settings.local.json +5 -0
- package/.env.demo +5 -0
- package/.eslintrc.json +46 -0
- package/.prettierignore +4 -0
- package/.prettierrc.json +7 -0
- package/.vscode/launch.json +23 -0
- package/CHANGELOG.md +746 -0
- package/jest.config.js +12 -0
- package/package.json +66 -71
- package/src/SuiTradingClient.ts +442 -0
- package/src/apiClients/createKioskClient.ts +10 -0
- package/src/apiClients/createSuiClient.ts +5 -0
- package/src/apiClients/graphqlClient.ts +17 -0
- package/src/bigNumberConfig.ts +10 -0
- package/src/constants.ts +1052 -0
- package/src/graphql/createChainGQLQuery.ts +27 -0
- package/src/graphql/gqlChainRequest.ts +21 -0
- package/src/graphql/queries/fetchAccountKiosks.ts +12 -0
- package/src/graphql/queries/fetchActiveLockStateByNftId.ts +15 -0
- package/src/graphql/queries/fetchBidsById.ts +36 -0
- package/src/graphql/queries/fetchCollectionBidById.ts +21 -0
- package/src/graphql/queries/fetchCollectionBidsAtSamePrice.ts +29 -0
- package/src/graphql/queries/fetchCollectionChainState.ts +17 -0
- package/src/graphql/queries/fetchCollectionFloorListingForMarket.ts +28 -0
- package/src/graphql/queries/fetchCollectionFloorListings.ts +15 -0
- package/src/graphql/queries/fetchCollectionsById.ts +39 -0
- package/src/graphql/queries/fetchCommissionByListingId.ts +13 -0
- package/src/graphql/queries/fetchCryptoToUsdRate.ts +13 -0
- package/src/graphql/queries/fetchKiosksByOwner.ts +14 -0
- package/src/graphql/queries/fetchListingsById.ts +29 -0
- package/src/graphql/queries/fetchListingsByNftId.ts +23 -0
- package/src/graphql/queries/fetchLockById.ts +23 -0
- package/src/graphql/queries/fetchMultibidById.ts +34 -0
- package/src/graphql/queries/fetchNftCollectionChainState.ts +12 -0
- package/src/graphql/queries/fetchNftsById.ts +75 -0
- package/src/graphql/queries/fetchNftsByKioskId.ts +45 -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/fetchWalletKiosks.ts +14 -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/calculatePremium.ts +9 -0
- package/src/helpers/calculateRoyaltyFee.ts +28 -0
- package/src/helpers/destroyZeroCoin.ts +14 -0
- package/src/helpers/getActiveLockStateByNftId.ts +15 -0
- package/src/helpers/getCollectionChainState.ts +31 -0
- package/src/helpers/getCollectionFloorPrice.ts +12 -0
- package/src/helpers/getLockById.ts +29 -0
- package/src/helpers/getMarketFeePrice.ts +82 -0
- package/src/helpers/getNftType.ts +38 -0
- package/src/helpers/getRoyaltyRuleModule.ts +7 -0
- package/src/helpers/getSharedObjects.ts +119 -0
- package/src/helpers/getSuiToUsdRate.ts +14 -0
- package/src/helpers/getTradeportBiddingContractBidAmount.ts +31 -0
- package/src/helpers/getTransferPolicyRuleNamesFromSuiObject.ts +24 -0
- package/src/helpers/hasPersonalKioskRule.ts +7 -0
- package/src/helpers/hasRoyaltyRule.ts +7 -0
- package/src/helpers/hasTransferPolicyRules.ts +6 -0
- package/src/helpers/isExpiredListing.ts +9 -0
- package/src/helpers/isNonKioskListing.ts +14 -0
- package/src/helpers/isSIngleBid.ts +13 -0
- package/src/helpers/kiosk/assertNftInSharedKiosk.ts +31 -0
- package/src/helpers/kiosk/getKioskCollectionRoyaltyFeeAmount.ts +71 -0
- package/src/helpers/kiosk/getKioskIdFromKioskTx.ts +29 -0
- package/src/helpers/kiosk/getKioskPlaceBidCoin.ts +59 -0
- package/src/helpers/kiosk/getNativeKioskTransferPolicies.ts +29 -0
- package/src/helpers/kiosk/getNativeKioskTransferPoliciesByNftType.ts +21 -0
- package/src/helpers/kiosk/getRulePackageId.ts +59 -0
- package/src/helpers/kiosk/getTransferPoliciesToResolve.ts +154 -0
- package/src/helpers/kiosk/isBluemoveKioskBid.ts +1 -0
- package/src/helpers/kiosk/isTradePortKioskBid.ts +4 -0
- package/src/helpers/kiosk/kioskListingBcs.ts +19 -0
- package/src/helpers/kiosk/kioskTxWrapper.ts +152 -0
- package/src/helpers/kiosk/lockNftInsideKioskIfNotLocked.ts +100 -0
- package/src/helpers/kiosk/preProcessSharedBulkBuyingData.ts +171 -0
- package/src/helpers/kiosk/resolveCustomTransferPolicyRules.ts +75 -0
- package/src/helpers/kiosk/resolveFloorPriceRule.ts +21 -0
- package/src/helpers/kiosk/resolveKioskLockRule.ts +47 -0
- package/src/helpers/kiosk/resolvePersonalKioskRule.ts +23 -0
- package/src/helpers/kiosk/resolveRoyaltyRule.ts +57 -0
- package/src/helpers/kiosk/resolveTableAllowlistRule.ts +34 -0
- package/src/helpers/kiosk/resolveTransferPolicies.ts +158 -0
- package/src/helpers/kiosk/sharedKioskState.type.ts +11 -0
- package/src/helpers/kiosk/takeAndBorrowNftFromKiosk.ts +50 -0
- package/src/helpers/kiosk/takeLockedNftFromKiosk.ts +73 -0
- package/src/helpers/kiosk/upgradeKioskRulesPackageId.ts +17 -0
- package/src/helpers/originByte/confirmOBTranfer.ts +33 -0
- package/src/helpers/originByte/createOBKiosk.ts +14 -0
- package/src/helpers/originByte/depositNftIntoOBKiosk.ts +16 -0
- package/src/helpers/originByte/getOBBidderKiosk.ts +12 -0
- package/src/helpers/originByte/getOBKiosk.ts +24 -0
- package/src/helpers/originByte/getOrCreateOBKiosk.ts +42 -0
- package/src/helpers/originByte/isOBKiosk.ts +13 -0
- package/src/helpers/originByte/isOriginByteBid.ts +30 -0
- package/src/helpers/originByte/isOriginByteCollection.ts +11 -0
- package/src/helpers/originByte/shareOriginByteKiosk.ts +14 -0
- package/src/helpers/rpc/getAcountBalance.ts +18 -0
- package/src/helpers/rpc/getObjectType.ts +25 -0
- package/src/helpers/splitCoins.ts +12 -0
- package/src/helpers/track.ts +20 -0
- package/src/helpers/validateMinFloorPrice.ts +22 -0
- package/src/index.ts +2 -0
- package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +189 -0
- package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +398 -0
- package/src/methods/acceptNftBids/acceptNftBids.ts +174 -0
- package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +438 -0
- package/src/methods/applyFtStrategy/applyFtStrategy.ts +55 -0
- package/src/methods/applyNftStrategy/applyNftStrategy.ts +90 -0
- package/src/methods/buyListings/addBuyListingTxs.ts +806 -0
- package/src/methods/buyListings/buyListings.ts +230 -0
- package/src/methods/cancelMultiBid/cancelMultiBid.ts +51 -0
- package/src/methods/cancelNftTransfers/addCancelNftTransfersTx.ts +20 -0
- package/src/methods/cancelNftTransfers/cancelNftTransfers.ts +118 -0
- package/src/methods/claimNfts/addClaimNftsTxs.ts +247 -0
- package/src/methods/claimNfts/claimNfts.ts +270 -0
- package/src/methods/createMultiBid/createMultiBid.ts +36 -0
- package/src/methods/listNfts/addListTxs.ts +210 -0
- package/src/methods/listNfts/addRelistTxs.ts +87 -0
- package/src/methods/listNfts/listNfts.ts +152 -0
- package/src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts +226 -0
- package/src/methods/placeCollectionBids/addPlaceCollectionBidTxs.ts +149 -0
- package/src/methods/placeCollectionBids/placeCollectionBids.ts +153 -0
- package/src/methods/placeNftBids/addPlaceNftBidTxs.ts +154 -0
- package/src/methods/placeNftBids/placeNftBids.ts +111 -0
- package/src/methods/relistNft/relistNft.ts +153 -0
- package/src/methods/removeCollectionBids/addRemoveCollectionBidsTxs.ts +132 -0
- package/src/methods/removeCollectionBids/removeCollectionBids.ts +117 -0
- package/src/methods/removeNftBids/addRemoveNftBidTxs.ts +122 -0
- package/src/methods/removeNftBids/removeNftBids.ts +116 -0
- package/src/methods/sponsorNftListing/addSponsorNftListingTx.ts +40 -0
- package/src/methods/sponsorNftListing/sponsorNftListing.ts +60 -0
- package/src/methods/transferNfts/addTransferNftTx.ts +220 -0
- package/src/methods/transferNfts/transferNfts.ts +216 -0
- package/src/methods/unlistListings/addUnlistListingTxs.ts +399 -0
- package/src/methods/unlistListings/unlistListings.ts +158 -0
- package/src/methods/updateMultiBid/updateMultiBid.ts +66 -0
- package/src/methods/withdrawProfitsFromKiosks/withdrawProfitsFromKiosks.ts +100 -0
- package/src/tests/SuiWallet.ts +83 -0
- package/src/utils/addHexPrefix.ts +7 -0
- package/src/utils/addLeadingZerosAfter0x.ts +9 -0
- package/src/utils/normalizeNftType.ts +7 -0
- package/src/utils/printTxBlockTxs.ts +11 -0
- package/src/utils/pureValues.ts +13 -0
- package/src/utils/toUint8Array.ts +12 -0
- package/tsconfig.json +16 -0
- package/dist/index.d.ts +0 -194
- package/dist/index.js +0 -7419
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PREMIUM_FEE_NOMINATOR, PREMIUM_NOMINATOR } from '../constants';
|
|
2
|
+
|
|
3
|
+
export function calculatePremium(price: bigint): bigint {
|
|
4
|
+
return (BigInt(price) * PREMIUM_NOMINATOR) / 10_000n;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function calculatePremiumFee(premium: bigint): bigint {
|
|
8
|
+
return (BigInt(premium) * PREMIUM_FEE_NOMINATOR) / 10_000n;
|
|
9
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import BigNumber from '../bigNumberConfig';
|
|
2
|
+
import { ZERO } from '../bigNumberConfig';
|
|
3
|
+
|
|
4
|
+
export function calculateRoyaltyFee(
|
|
5
|
+
transferPolicyRules: Array<{ type: string; amount_bp?: string; min_amount?: string }>,
|
|
6
|
+
price: BigNumber,
|
|
7
|
+
): BigNumber {
|
|
8
|
+
const royaltyRule = transferPolicyRules?.filter(
|
|
9
|
+
(rule: { type: string }) => rule.type === 'royalty_rule' || rule.type === 'kiosk_royalty_rule',
|
|
10
|
+
)?.[0];
|
|
11
|
+
|
|
12
|
+
if (!royaltyRule || (!royaltyRule.amount_bp && !royaltyRule.min_amount)) {
|
|
13
|
+
return ZERO;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const royaltyFee = royaltyRule.amount_bp
|
|
17
|
+
? new BigNumber(royaltyRule.amount_bp)
|
|
18
|
+
.times(price)
|
|
19
|
+
.div(10000)
|
|
20
|
+
.integerValue(BigNumber.ROUND_DOWN)
|
|
21
|
+
: ZERO;
|
|
22
|
+
|
|
23
|
+
if (royaltyRule.min_amount && new BigNumber(royaltyRule.min_amount).isGreaterThan(royaltyFee)) {
|
|
24
|
+
return new BigNumber(royaltyRule.min_amount);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return royaltyFee;
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
2
|
+
|
|
3
|
+
type Args = {
|
|
4
|
+
tx: Transaction;
|
|
5
|
+
coin: string | TransactionArgument;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const destroyZeroCoin = ({ tx, coin }: Args) => {
|
|
9
|
+
tx.moveCall({
|
|
10
|
+
target: '0x2::coin::destroy_zero',
|
|
11
|
+
arguments: [tx.object(coin as any)],
|
|
12
|
+
typeArguments: ['0x2::sui::SUI'],
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { gqlChainRequest } from '../graphql/gqlChainRequest';
|
|
2
|
+
import { type Lock } from './getLockById';
|
|
3
|
+
import { fetchActiveLockStateByNftId } from '../graphql/queries/fetchActiveLockStateByNftId';
|
|
4
|
+
|
|
5
|
+
export const getActiveLockStateByNftId = async (
|
|
6
|
+
nftId: string,
|
|
7
|
+
): Promise<Pick<Lock, 'id' | 'state'>> => {
|
|
8
|
+
const res = await gqlChainRequest({
|
|
9
|
+
chain: 'sui',
|
|
10
|
+
query: fetchActiveLockStateByNftId,
|
|
11
|
+
variables: { nftId },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return res?.locks?.[0] ?? undefined;
|
|
15
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { gqlChainRequest } from '../graphql/gqlChainRequest';
|
|
2
|
+
import {
|
|
3
|
+
fetchCollectionChainState,
|
|
4
|
+
fetchCollectionChainStateByFtType,
|
|
5
|
+
} from '../graphql/queries/fetchCollectionChainState';
|
|
6
|
+
|
|
7
|
+
export const getCollectionChainState = async (
|
|
8
|
+
collectionId: string,
|
|
9
|
+
): Promise<Record<string, unknown> | undefined> => {
|
|
10
|
+
const res = await gqlChainRequest({
|
|
11
|
+
chain: 'sui',
|
|
12
|
+
query: fetchCollectionChainState,
|
|
13
|
+
variables: { collectionId },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return res?.collections?.[0]?.chain_state;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const getCollectionChainStateByFtType = async (
|
|
20
|
+
ftType: string,
|
|
21
|
+
): Promise<Record<string, unknown> | undefined> => {
|
|
22
|
+
const res = await gqlChainRequest({
|
|
23
|
+
chain: 'sui',
|
|
24
|
+
query: fetchCollectionChainStateByFtType,
|
|
25
|
+
variables: {
|
|
26
|
+
ftType,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return res?.collections_by_ft_type?.[0]?.chain_state;
|
|
31
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { gqlChainRequest } from '../graphql/gqlChainRequest';
|
|
2
|
+
import { fetchCollectionFloorListings } from '../graphql/queries/fetchCollectionFloorListings';
|
|
3
|
+
|
|
4
|
+
export const getCollectionFloorPrice = async (collectionId: string) => {
|
|
5
|
+
const res = await gqlChainRequest({
|
|
6
|
+
chain: 'sui',
|
|
7
|
+
query: fetchCollectionFloorListings,
|
|
8
|
+
variables: { collectionId },
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
return res?.listings?.[0]?.price;
|
|
12
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { gqlChainRequest } from '../graphql/gqlChainRequest';
|
|
2
|
+
import { fetchLockById } from '../graphql/queries/fetchLockById';
|
|
3
|
+
|
|
4
|
+
export type Lock = {
|
|
5
|
+
id: string;
|
|
6
|
+
lock_id: string;
|
|
7
|
+
chain_state?: Record<string, any>;
|
|
8
|
+
nft_type: string;
|
|
9
|
+
type: string;
|
|
10
|
+
state: string;
|
|
11
|
+
maker_price: bigint;
|
|
12
|
+
maker: string;
|
|
13
|
+
collection_id: string;
|
|
14
|
+
expire_in: number;
|
|
15
|
+
nft?: {
|
|
16
|
+
id: string;
|
|
17
|
+
token_id: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const getLockById = async (lockId: string): Promise<Lock | undefined> => {
|
|
22
|
+
const res = await gqlChainRequest({
|
|
23
|
+
chain: 'sui',
|
|
24
|
+
query: fetchLockById,
|
|
25
|
+
variables: { lockId },
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return res?.locks?.[0] ?? undefined;
|
|
29
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BASC_ROYALTY_DECIMAL_PERCENT,
|
|
3
|
+
COLLECTION_IDS_WITH_ZERO_COMMISSION,
|
|
4
|
+
DSL_LEGACY_ROYALTY_DECIMAL_PERCENT,
|
|
5
|
+
MASC_ROYALTY_DECIMAL_PERCENT,
|
|
6
|
+
TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT,
|
|
7
|
+
} from '../constants';
|
|
8
|
+
|
|
9
|
+
export const getMASCMarketFeePrice = (price: number) => {
|
|
10
|
+
if (price * (MASC_ROYALTY_DECIMAL_PERCENT + TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT) < 1) {
|
|
11
|
+
return price * (MASC_ROYALTY_DECIMAL_PERCENT + TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return parseInt(
|
|
15
|
+
(price * (MASC_ROYALTY_DECIMAL_PERCENT + TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT))?.toFixed(0),
|
|
16
|
+
10,
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const getBASCMarketFeePrice = (price: number) => {
|
|
21
|
+
if (price * (BASC_ROYALTY_DECIMAL_PERCENT + TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT) < 1) {
|
|
22
|
+
return price * (BASC_ROYALTY_DECIMAL_PERCENT + TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return parseInt(
|
|
26
|
+
(price * (BASC_ROYALTY_DECIMAL_PERCENT + TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT))?.toFixed(0),
|
|
27
|
+
10,
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const getDSLLegacyMarketFeePrice = (price: number) => {
|
|
32
|
+
if (price * (DSL_LEGACY_ROYALTY_DECIMAL_PERCENT + TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT) < 1) {
|
|
33
|
+
return price * (DSL_LEGACY_ROYALTY_DECIMAL_PERCENT + TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return parseInt(
|
|
37
|
+
(price * (DSL_LEGACY_ROYALTY_DECIMAL_PERCENT + TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT))?.toFixed(
|
|
38
|
+
0,
|
|
39
|
+
),
|
|
40
|
+
10,
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
type GetMarketFeePrice = {
|
|
45
|
+
price: number;
|
|
46
|
+
collectionId: string;
|
|
47
|
+
marketFeeDecimalPercent?: number;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const getMarketFeePrice = ({
|
|
51
|
+
price,
|
|
52
|
+
collectionId,
|
|
53
|
+
marketFeeDecimalPercent,
|
|
54
|
+
}: GetMarketFeePrice) => {
|
|
55
|
+
if (collectionId === '6824e1ff-477e-4810-9ba7-8d6387b68c7d') {
|
|
56
|
+
return getBASCMarketFeePrice(price);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (collectionId === '8568521c-73a3-4beb-b830-d1ff27a3f1ca') {
|
|
60
|
+
return getMASCMarketFeePrice(price);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (collectionId === '307c7e7a-be3a-43a5-ae44-37f3a37d01f9') {
|
|
64
|
+
return getDSLLegacyMarketFeePrice(price);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let marketFeePrice = 0;
|
|
68
|
+
|
|
69
|
+
if (!COLLECTION_IDS_WITH_ZERO_COMMISSION?.includes(collectionId)) {
|
|
70
|
+
marketFeePrice = price * TRADEPORT_DEFAULT_FEE_DECIMAL_PERCENT;
|
|
71
|
+
|
|
72
|
+
if (marketFeeDecimalPercent) {
|
|
73
|
+
marketFeePrice = price * marketFeeDecimalPercent;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (marketFeePrice < 1) {
|
|
78
|
+
return marketFeePrice;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return parseInt(marketFeePrice?.toFixed(0), 10);
|
|
82
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface CollectionChainState {
|
|
2
|
+
nft_type: string;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
interface NFT {
|
|
6
|
+
properties?: {
|
|
7
|
+
nft_type?: string;
|
|
8
|
+
};
|
|
9
|
+
contract?: {
|
|
10
|
+
properties?: {
|
|
11
|
+
nft_type?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const getNftType = ({
|
|
17
|
+
collectionId,
|
|
18
|
+
collectionChainState,
|
|
19
|
+
nft,
|
|
20
|
+
}: {
|
|
21
|
+
collectionId: string;
|
|
22
|
+
collectionChainState?: CollectionChainState;
|
|
23
|
+
nft?: NFT;
|
|
24
|
+
}): string => {
|
|
25
|
+
if (collectionId === 'a6fabb11-4713-4203-bce8-a3c4f673b5a7') {
|
|
26
|
+
// dungeon move, each nft has different type based off it's identity, so use nft.properties.nft_type
|
|
27
|
+
return nft?.properties?.nft_type;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (collectionChainState?.nft_type) return collectionChainState.nft_type;
|
|
31
|
+
|
|
32
|
+
let nftType = nft?.properties?.nft_type;
|
|
33
|
+
if (!nftType || nftType?.split('::')?.length <= 1) {
|
|
34
|
+
nftType = nft?.contract?.properties?.nft_type;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return nftType ?? '';
|
|
38
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { normalizedNftType } from '../utils/normalizeNftType';
|
|
2
|
+
|
|
3
|
+
export const getRoyaltyRuleModule = (nftType: string) =>
|
|
4
|
+
normalizedNftType(nftType) ===
|
|
5
|
+
'0xe7e651e4974fe367aa2837712d68081efb299c470242a15e2b9c26ea326159ec::card::SudoCard'
|
|
6
|
+
? 'kiosk_royalty_rule'
|
|
7
|
+
: 'royalty_rule';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CRYPTOPEDIA_ORIGIN_BYTE_ALLOW_LIST_OBJECT,
|
|
3
|
+
FUDDIES_ORIGIN_BYTE_ALLOW_LIST_OBJECT,
|
|
4
|
+
GNOMES_ORIGIN_BYTE_ALLOW_LIST_OBJECT,
|
|
5
|
+
NOVAGEN_ORIGIN_BYTE_ALLOW_LIST_OBJECT,
|
|
6
|
+
ORIGIN_BYTE_ALLOW_LIST_OBJECT,
|
|
7
|
+
SACABAM_ORIGIN_BYTE_ALLOW_LIST_OBJECT,
|
|
8
|
+
STORKS_ORIGIN_BYTE_ALLOW_LIST,
|
|
9
|
+
SUISHI_ORIGIN_BYTE_ALLOW_LIST_OBJECT,
|
|
10
|
+
SUI_ECOSYSTEM_ORIGIN_BYTE_ALLOW_LIST_OBJECT,
|
|
11
|
+
} from '../constants';
|
|
12
|
+
import { gqlChainRequest } from '../graphql/gqlChainRequest';
|
|
13
|
+
import { fetchSharedObjectsByType } from '../graphql/queries/fetchSharedObjectsByType';
|
|
14
|
+
import { addLeadingZerosAfter0x } from '../utils/addLeadingZerosAfter0x';
|
|
15
|
+
|
|
16
|
+
export type SuiSharedObjects = {
|
|
17
|
+
orderbook: string;
|
|
18
|
+
collection: string;
|
|
19
|
+
royaltyStrategy: string;
|
|
20
|
+
keepsakeRoyaltyStrategy: string;
|
|
21
|
+
transferPolicy: string;
|
|
22
|
+
marketplace: string;
|
|
23
|
+
allowList: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const getSharedObjects = async (nftType: string): Promise<SuiSharedObjects> => {
|
|
27
|
+
const nftTypeSplit = nftType?.split('::');
|
|
28
|
+
if (nftTypeSplit?.[0]) nftTypeSplit[0] = addLeadingZerosAfter0x(nftTypeSplit[0]);
|
|
29
|
+
|
|
30
|
+
const res = await gqlChainRequest({
|
|
31
|
+
chain: 'sui',
|
|
32
|
+
query: fetchSharedObjectsByType,
|
|
33
|
+
variables: { type: nftTypeSplit?.join('::') },
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
let allowList = res?.sharedObjects?.filter((object: any) => object?.module === 'allowlist')?.[0]
|
|
37
|
+
?.id;
|
|
38
|
+
if (!allowList) allowList = ORIGIN_BYTE_ALLOW_LIST_OBJECT;
|
|
39
|
+
if (
|
|
40
|
+
nftType === '0x5f1fa51a6d5c52df7dfe0ff7efaab7cc769d81e51cf208a424e455575aa1ed7a::stork::Stork'
|
|
41
|
+
) {
|
|
42
|
+
allowList = STORKS_ORIGIN_BYTE_ALLOW_LIST;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (
|
|
46
|
+
nftType === '0xf1681f601a1c021a0b4c8c8859d50917308fcbebfd19364c4e856ac670bb8496::suishi::Suishi'
|
|
47
|
+
) {
|
|
48
|
+
allowList = SUISHI_ORIGIN_BYTE_ALLOW_LIST_OBJECT;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (
|
|
52
|
+
nftType?.includes(
|
|
53
|
+
'ac176715abe5bcdaae627c5048958bbe320a8474f524674f3278e31af3c8b86b::fuddies::Fuddies',
|
|
54
|
+
)
|
|
55
|
+
) {
|
|
56
|
+
allowList = FUDDIES_ORIGIN_BYTE_ALLOW_LIST_OBJECT;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (
|
|
60
|
+
nftType ===
|
|
61
|
+
'0x71bd3651e47a7590e607b976a332338e2230e995fa96de430703af537086b643::cryptopedia::Cryptopedia'
|
|
62
|
+
) {
|
|
63
|
+
allowList = CRYPTOPEDIA_ORIGIN_BYTE_ALLOW_LIST_OBJECT;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (
|
|
67
|
+
nftType === '0xe81341eba87d19f8d53ee237b3666cff6a74c9fd7a960cf5753af69bc7c6a221::gnomes::Gnome'
|
|
68
|
+
) {
|
|
69
|
+
allowList = GNOMES_ORIGIN_BYTE_ALLOW_LIST_OBJECT;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (
|
|
73
|
+
nftType ===
|
|
74
|
+
'0x7f481ffff2b72f3f1d9b70d5ad999d8b514a6281aa29aedbb6c537bd4b0d04ad::sacabam::Sacabam'
|
|
75
|
+
) {
|
|
76
|
+
allowList = SACABAM_ORIGIN_BYTE_ALLOW_LIST_OBJECT;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (
|
|
80
|
+
nftType ===
|
|
81
|
+
'0x5fe8e884960f6977f813d871a3d43049d72d19d4ad07819b979c06434f60af4d::mint::SuiEcosystemNFT'
|
|
82
|
+
) {
|
|
83
|
+
allowList = SUI_ECOSYSTEM_ORIGIN_BYTE_ALLOW_LIST_OBJECT;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (
|
|
87
|
+
nftType ===
|
|
88
|
+
'0xf417417b1914266b634b3dc90050be9f28fb755e9d29f36d1892012e0ad6f816::novagen::Novagen'
|
|
89
|
+
) {
|
|
90
|
+
allowList = NOVAGEN_ORIGIN_BYTE_ALLOW_LIST_OBJECT;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const transferPolicy = res?.sharedObjects?.filter(
|
|
94
|
+
(object: any) => object?.module === 'transfer_policy',
|
|
95
|
+
)?.[0]?.id;
|
|
96
|
+
|
|
97
|
+
let orderbook = res?.sharedObjects?.filter((object: any) => object?.module === 'orderbook')?.[0]
|
|
98
|
+
?.id;
|
|
99
|
+
|
|
100
|
+
if (nftTypeSplit?.join('::')?.includes('keepsake_nft::KEEPSAKE')) {
|
|
101
|
+
orderbook = null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
orderbook,
|
|
106
|
+
collection: res?.sharedObjects?.filter((object: any) => object?.module === 'collection')?.[0]
|
|
107
|
+
?.id,
|
|
108
|
+
marketplace: res?.sharedObjects?.filter((object: any) => object?.module === 'marketplace')?.[0]
|
|
109
|
+
?.id,
|
|
110
|
+
royaltyStrategy: res?.sharedObjects?.filter(
|
|
111
|
+
(object: any) => object?.module === 'royalty_strategy_bps',
|
|
112
|
+
)?.[0]?.id,
|
|
113
|
+
keepsakeRoyaltyStrategy: res?.sharedObjects?.filter(
|
|
114
|
+
(object: any) => object?.module === 'keepsake_royalties',
|
|
115
|
+
)?.[0]?.id,
|
|
116
|
+
transferPolicy,
|
|
117
|
+
allowList,
|
|
118
|
+
};
|
|
119
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { gqlChainRequest } from '../graphql/gqlChainRequest';
|
|
2
|
+
import { fetchCryptoToUsdRate } from '../graphql/queries/fetchCryptoToUsdRate';
|
|
3
|
+
|
|
4
|
+
export const getSuiToUsdRate = async (): Promise<number> => {
|
|
5
|
+
try {
|
|
6
|
+
const res = await gqlChainRequest({
|
|
7
|
+
chain: 'sui',
|
|
8
|
+
query: fetchCryptoToUsdRate,
|
|
9
|
+
variables: { crypto: 'sui' },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
return res?.crypto_rates?.[0]?.rate;
|
|
13
|
+
} catch (e) {}
|
|
14
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BASC_ROYALTY_DECIMAL_PERCENT,
|
|
3
|
+
DSL_LEGACY_ROYALTY_DECIMAL_PERCENT,
|
|
4
|
+
MASC_ROYALTY_DECIMAL_PERCENT,
|
|
5
|
+
} from '../constants';
|
|
6
|
+
|
|
7
|
+
interface Args {
|
|
8
|
+
bidAmount: number;
|
|
9
|
+
collectionId: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const getTradeportBiddingContractBidAmount = ({ bidAmount, collectionId }: Args) => {
|
|
13
|
+
let amount = bidAmount;
|
|
14
|
+
|
|
15
|
+
// MASC
|
|
16
|
+
if (collectionId === '8568521c-73a3-4beb-b830-d1ff27a3f1ca') {
|
|
17
|
+
amount = bidAmount - bidAmount * MASC_ROYALTY_DECIMAL_PERCENT;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// BASC
|
|
21
|
+
if (collectionId === '6824e1ff-477e-4810-9ba7-8d6387b68c7d') {
|
|
22
|
+
amount = bidAmount - bidAmount * BASC_ROYALTY_DECIMAL_PERCENT;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// DSL Legacy
|
|
26
|
+
if (collectionId === '307c7e7a-be3a-43a5-ae44-37f3a37d01f9') {
|
|
27
|
+
amount = bidAmount - bidAmount * DSL_LEGACY_ROYALTY_DECIMAL_PERCENT;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return amount;
|
|
31
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
|
+
import { normalizeStructTag, normalizeSuiObjectId } from '@mysten/sui/utils';
|
|
3
|
+
|
|
4
|
+
export const getTransferPolicyRuleNamesFromSuiObject = async ({
|
|
5
|
+
suiClient,
|
|
6
|
+
transferPolicyId,
|
|
7
|
+
}: {
|
|
8
|
+
suiClient: SuiGrpcClient;
|
|
9
|
+
transferPolicyId: string;
|
|
10
|
+
}) => {
|
|
11
|
+
const { object } = await suiClient.getObject({
|
|
12
|
+
objectId: normalizeSuiObjectId(transferPolicyId),
|
|
13
|
+
include: { json: true },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const content = object.json as unknown as {
|
|
17
|
+
rules: {
|
|
18
|
+
contents: string[];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const ruleNames = content.rules.contents.map((rule) => normalizeStructTag(rule));
|
|
22
|
+
|
|
23
|
+
return ruleNames;
|
|
24
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getNativeKioskTransferPolicies } from './kiosk/getNativeKioskTransferPolicies';
|
|
2
|
+
|
|
3
|
+
export const hasPersonalKioskRule = (transferPolicies: any): boolean =>
|
|
4
|
+
getNativeKioskTransferPolicies(transferPolicies)?.some(
|
|
5
|
+
(policy: any) =>
|
|
6
|
+
policy?.rules?.filter((rule: any) => rule?.type?.includes('personal_kiosk_rule'))?.length > 0,
|
|
7
|
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getNativeKioskTransferPolicies } from './kiosk/getNativeKioskTransferPolicies';
|
|
2
|
+
|
|
3
|
+
export const hasRoyaltyRule = (transferPolicies: any): boolean =>
|
|
4
|
+
getNativeKioskTransferPolicies(transferPolicies)?.some(
|
|
5
|
+
(policy: any) =>
|
|
6
|
+
policy?.rules?.filter((rule: any) => rule?.type?.includes('royalty_rule'))?.length > 0,
|
|
7
|
+
);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { getNativeKioskTransferPolicies } from './kiosk/getNativeKioskTransferPolicies';
|
|
2
|
+
|
|
3
|
+
export const hasNativeKioskTransferPolicyRules = (transferPolicies: any): boolean => {
|
|
4
|
+
const nativeKioskTransferPolicies = getNativeKioskTransferPolicies(transferPolicies);
|
|
5
|
+
return nativeKioskTransferPolicies?.some((policy: any) => policy?.rules?.length > 0);
|
|
6
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { normalizeSuiAddress } from '@mysten/sui/utils';
|
|
2
|
+
|
|
3
|
+
export const isExpiredListing = (
|
|
4
|
+
listing: { nonce?: string; seller?: string },
|
|
5
|
+
walletAddress: string,
|
|
6
|
+
) =>
|
|
7
|
+
listing.nonce &&
|
|
8
|
+
listing.seller &&
|
|
9
|
+
normalizeSuiAddress(listing.seller) === normalizeSuiAddress(walletAddress);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
2
|
+
import { NON_KIOSK_LISTING_NONCE_TYPE } from '../constants';
|
|
3
|
+
import { getObjectType } from './rpc/getObjectType';
|
|
4
|
+
|
|
5
|
+
export const isNonKioskListing = async ({
|
|
6
|
+
suiClient,
|
|
7
|
+
listingNonce,
|
|
8
|
+
}: {
|
|
9
|
+
suiClient: SuiGrpcClient;
|
|
10
|
+
listingNonce: string;
|
|
11
|
+
}): Promise<boolean> => {
|
|
12
|
+
const listingType = await getObjectType({ suiClient, objectId: listingNonce });
|
|
13
|
+
return listingType === NON_KIOSK_LISTING_NONCE_TYPE;
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TRADEPORT_MULTI_BID_PACKAGE_ORIGINAL } from '../constants';
|
|
2
|
+
|
|
3
|
+
export const isSingleBid = (bidType: string): boolean => {
|
|
4
|
+
if (!bidType) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (!bidType.startsWith('0x')) {
|
|
9
|
+
bidType = `0x${bidType}`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return bidType === `${TRADEPORT_MULTI_BID_PACKAGE_ORIGINAL}::tradeport_biddings::SingleBid`;
|
|
13
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { gqlChainRequest } from '../../graphql/gqlChainRequest';
|
|
2
|
+
import { fetchKiosksByOwner } from '../../graphql/queries/fetchKiosksByOwner';
|
|
3
|
+
import { addLeadingZerosAfter0x } from '../../utils/addLeadingZerosAfter0x';
|
|
4
|
+
import { type SharedKioskState } from './sharedKioskState.type';
|
|
5
|
+
|
|
6
|
+
export const assertNftInSharedKiosk = async ({
|
|
7
|
+
kioskId,
|
|
8
|
+
walletAddress,
|
|
9
|
+
sharedKioskState,
|
|
10
|
+
}: {
|
|
11
|
+
kioskId: string;
|
|
12
|
+
walletAddress: string;
|
|
13
|
+
sharedKioskState?: SharedKioskState;
|
|
14
|
+
}): Promise<void> => {
|
|
15
|
+
if (!sharedKioskState?.ownerKiosks) {
|
|
16
|
+
const res = await gqlChainRequest({
|
|
17
|
+
chain: 'sui',
|
|
18
|
+
query: fetchKiosksByOwner,
|
|
19
|
+
variables: { ownerAddress: addLeadingZerosAfter0x(walletAddress) },
|
|
20
|
+
});
|
|
21
|
+
if (sharedKioskState) {
|
|
22
|
+
sharedKioskState.ownerKiosks = res?.kiosks;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const nftKiosk = sharedKioskState?.ownerKiosks?.find((k: any) => k.id === kioskId);
|
|
27
|
+
|
|
28
|
+
if (nftKiosk && !nftKiosk?.is_shared) {
|
|
29
|
+
throw new Error('NFT is inside a kiosk that is not shared');
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
2
|
+
import { type SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
|
+
import {
|
|
4
|
+
Transaction,
|
|
5
|
+
type TransactionArgument,
|
|
6
|
+
type TransactionObjectInput,
|
|
7
|
+
} from '@mysten/sui/transactions';
|
|
8
|
+
import { addLeadingZerosAfter0x } from '../../utils/addLeadingZerosAfter0x';
|
|
9
|
+
|
|
10
|
+
interface Args {
|
|
11
|
+
tx: Transaction;
|
|
12
|
+
suiClient: SuiGrpcClient;
|
|
13
|
+
walletAddress: string;
|
|
14
|
+
royaltyRulePackageId: string;
|
|
15
|
+
royaltyRuleModule: string;
|
|
16
|
+
transferPolicyId: string | TransactionObjectInput;
|
|
17
|
+
price: number | string;
|
|
18
|
+
nftType: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function getKioskCollectionRoyaltyFeeAmount({
|
|
22
|
+
tx,
|
|
23
|
+
suiClient,
|
|
24
|
+
walletAddress,
|
|
25
|
+
royaltyRulePackageId,
|
|
26
|
+
royaltyRuleModule,
|
|
27
|
+
transferPolicyId,
|
|
28
|
+
price,
|
|
29
|
+
nftType,
|
|
30
|
+
}: Args): Promise<TransactionArgument | bigint | undefined> {
|
|
31
|
+
if (!royaltyRulePackageId || !royaltyRuleModule || !transferPolicyId || !nftType) {
|
|
32
|
+
console.warn('Missing required parameters for royalty fee calculation');
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!price) {
|
|
37
|
+
console.warn('Price is undefined or 0');
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const feeTx = new Transaction();
|
|
42
|
+
feeTx.moveCall({
|
|
43
|
+
target: `${royaltyRulePackageId}::${royaltyRuleModule}::fee_amount`,
|
|
44
|
+
arguments: [feeTx.object(transferPolicyId), feeTx.pure.u64(price)],
|
|
45
|
+
typeArguments: [nftType],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
feeTx.setSender(addLeadingZerosAfter0x(walletAddress));
|
|
49
|
+
const res = await suiClient.simulateTransaction({
|
|
50
|
+
transaction: feeTx,
|
|
51
|
+
include: { commandResults: true },
|
|
52
|
+
checksEnabled: false,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
let feeAmount: TransactionArgument | bigint | undefined;
|
|
56
|
+
const returnedAmount = res?.commandResults?.[0]?.returnValues?.[0]?.bcs;
|
|
57
|
+
if (returnedAmount) {
|
|
58
|
+
feeAmount = BigInt(bcs.U64.parse(returnedAmount));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// We were not able to calculate the amount outside of the transaction, so fall back to resolving it within the PTB
|
|
62
|
+
if (!feeAmount && feeAmount !== 0n) {
|
|
63
|
+
[feeAmount] = tx.moveCall({
|
|
64
|
+
target: `${royaltyRulePackageId}::${royaltyRuleModule}::fee_amount`,
|
|
65
|
+
typeArguments: [nftType],
|
|
66
|
+
arguments: [tx.object(transferPolicyId), tx.pure.u64(price)],
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return feeAmount;
|
|
71
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type KioskTransaction } from '@mysten/kiosk';
|
|
2
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
3
|
+
|
|
4
|
+
export const getKioskIdFromKioskTx = ({
|
|
5
|
+
kioskTx,
|
|
6
|
+
tx,
|
|
7
|
+
}: {
|
|
8
|
+
kioskTx: KioskTransaction;
|
|
9
|
+
tx: Transaction;
|
|
10
|
+
}): string => {
|
|
11
|
+
const kioskArg = kioskTx.kiosk as any;
|
|
12
|
+
|
|
13
|
+
if (!kioskArg || !('Input' in kioskArg)) {
|
|
14
|
+
throw new Error('Invalid kiosk transaction structure');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const input = (tx as any).getData().inputs[kioskArg.Input];
|
|
18
|
+
const kioskId =
|
|
19
|
+
input?.UnresolvedObject?.objectId ??
|
|
20
|
+
input?.Object?.ImmOrOwnedObject?.objectId ??
|
|
21
|
+
input?.Object?.SharedObject?.objectId ??
|
|
22
|
+
input?.Object?.Receiving?.objectId;
|
|
23
|
+
|
|
24
|
+
if (!kioskId) {
|
|
25
|
+
throw new Error('Invalid kiosk transaction structure');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return kioskId;
|
|
29
|
+
};
|