@tradeport/sui-trading-sdk 0.3.6 → 0.3.7

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tradeport/sui-trading-sdk",
3
3
  "license": "MIT",
4
- "version": "0.3.6",
4
+ "version": "0.3.7",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
@@ -169,40 +169,12 @@ export function canBeTransferedDirectly(collectionChainState?: CollectionChainSt
169
169
  export function getTransferPolicyForDirectTransfer(
170
170
  collectionChainState?: CollectionChainState,
171
171
  ): TransferPolicy | undefined {
172
- if (!collectionChainState?.transfer_policies?.length) {
173
- return undefined;
174
- }
175
-
176
- const usablePolicies = collectionChainState.transfer_policies.filter(
172
+ return collectionChainState?.transfer_policies?.find(
177
173
  (policy) =>
178
174
  !policy.is_origin_byte &&
175
+ policy.rules.length > 0 &&
179
176
  policy.rules?.filter(
180
177
  (rule) => rule.type !== 'kiosk_lock_rule' && rule.type !== 'royalty_rule',
181
178
  ).length === 0,
182
179
  );
183
-
184
- const lockAndRoyaltyPolicy = usablePolicies.find(
185
- (policy) =>
186
- policy.rules?.some((rule) => rule.type === 'kiosk_lock_rule') &&
187
- !policy.rules?.some((rule) => rule.type === 'royalty_rule'),
188
- );
189
- if (lockAndRoyaltyPolicy) {
190
- return lockAndRoyaltyPolicy;
191
- }
192
-
193
- const royaltyPolicy = usablePolicies.find((policy) =>
194
- policy.rules?.some((rule) => rule.type === 'royalty_rule'),
195
- );
196
- if (royaltyPolicy) {
197
- return royaltyPolicy;
198
- }
199
-
200
- const lockPolicy = usablePolicies.find((policy) =>
201
- policy.rules?.some((rule) => rule.type === 'kiosk_lock_rule'),
202
- );
203
- if (lockPolicy) {
204
- return lockPolicy;
205
- }
206
-
207
- return usablePolicies[0];
208
180
  }