@tradeport/sui-trading-sdk 0.4.64 → 0.4.65

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,60 +1,66 @@
1
1
  {
2
- "name": "@tradeport/sui-trading-sdk",
3
- "license": "MIT",
4
- "version": "0.4.64",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "devDependencies": {
9
- "@babel/core": "^7.23.3",
10
- "@babel/preset-env": "^7.23.3",
11
- "@changesets/cli": "^2.26.2",
12
- "@types/jest": "^29.5.10",
13
- "@types/ms": "^2.1.0",
14
- "@types/node": "^20.10.0",
15
- "@typescript-eslint/eslint-plugin": "^6.13.1",
16
- "@typescript-eslint/parser": "^6.13.1",
17
- "babel-jest": "^29.7.0",
18
- "dotenv": "^16.3.1",
19
- "eslint": "^8.54.0",
20
- "eslint-config-prettier": "^9.0.0",
21
- "eslint-config-xo": "^0.43.1",
22
- "eslint-config-xo-typescript": "^1.0.1",
23
- "husky": "^8.0.0",
24
- "jest": "^29.7.0",
25
- "lint-staged": "^16.2.7",
26
- "prettier": "^3.1.0",
27
- "ts-jest": "^29.1.1",
28
- "tsup": "^8.0.1",
29
- "typescript": "^5.3.2"
30
- },
31
- "dependencies": {
32
- "@mysten/kiosk": "^0.7.13",
33
- "@mysten/sui": "^1.17.0",
34
- "@types/analytics-node": "^3.1.14",
35
- "analytics-node": "^6.2.0",
36
- "bignumber.js": "^9.3.1",
37
- "graphql": "^16.12.0",
38
- "graphql-request": "^6.1.0",
39
- "ms": "^2.1.3"
40
- },
41
- "publishConfig": {
42
- "access": "public",
43
- "registry": "https://registry.npmjs.org/"
44
- },
45
- "lint-staged": {
46
- "*.ts": [
47
- "eslint --fix",
48
- "bash -c 'tsc --noEmit'",
49
- "prettier --write"
50
- ]
51
- },
52
- "scripts": {
53
- "build": "tsup src/index.ts --sourcemap --format cjs,esm --dts",
54
- "release": "pnpm run build && changeset publish",
55
- "lint": "tsc && eslint --fix src/* --ignore-path .gitignore --ext .js,.ts",
56
- "format": "prettier --write \"**/*.+(js|ts|json)\"",
57
- "test": "jest",
58
- "pre-commit": "lint-staged"
59
- }
60
- }
2
+ "name": "@tradeport/sui-trading-sdk",
3
+ "license": "MIT",
4
+ "version": "0.4.65",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsup src/index.ts --sourcemap --format cjs,esm --dts",
10
+ "release": "pnpm run build && changeset publish",
11
+ "lint": "tsc && eslint --fix src/* --ignore-path .gitignore --ext .js,.ts",
12
+ "format": "prettier --write \"**/*.+(js|ts|json)\"",
13
+ "test": "jest",
14
+ "prepare": "husky install",
15
+ "pre-commit": "lint-staged"
16
+ },
17
+ "devDependencies": {
18
+ "@babel/core": "^7.23.3",
19
+ "@babel/preset-env": "^7.23.3",
20
+ "@changesets/cli": "^2.26.2",
21
+ "@types/jest": "^29.5.10",
22
+ "@types/ms": "^2.1.0",
23
+ "@types/node": "^20.10.0",
24
+ "@typescript-eslint/eslint-plugin": "^6.13.1",
25
+ "@typescript-eslint/parser": "^6.13.1",
26
+ "babel-jest": "^29.7.0",
27
+ "dotenv": "^16.3.1",
28
+ "eslint": "^8.54.0",
29
+ "eslint-config-prettier": "^9.0.0",
30
+ "eslint-config-xo": "^0.43.1",
31
+ "eslint-config-xo-typescript": "^1.0.1",
32
+ "husky": "^8.0.0",
33
+ "jest": "^29.7.0",
34
+ "lint-staged": "^16.2.7",
35
+ "prettier": "^3.1.0",
36
+ "ts-jest": "^29.1.1",
37
+ "tsup": "^8.0.1",
38
+ "typescript": "^5.3.2"
39
+ },
40
+ "dependencies": {
41
+ "@mysten/kiosk": "^0.7.13",
42
+ "@mysten/sui": "^1.17.0",
43
+ "@types/analytics-node": "^3.1.14",
44
+ "analytics-node": "^6.2.0",
45
+ "bignumber.js": "^9.3.1",
46
+ "graphql": "^16.12.0",
47
+ "graphql-request": "^6.1.0",
48
+ "ms": "^2.1.3"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public",
52
+ "registry": "https://registry.npmjs.org/"
53
+ },
54
+ "lint-staged": {
55
+ "*.ts": [
56
+ "eslint --fix",
57
+ "bash -c 'tsc --noEmit'",
58
+ "prettier --write"
59
+ ]
60
+ },
61
+ "pnpm": {
62
+ "overrides": {
63
+ "@mysten/sui": "^1.45.2"
64
+ }
65
+ }
66
+ }
@@ -4,6 +4,7 @@ import { addHexPrefix } from '../../utils/addHexPrefix';
4
4
  import { normalizedNftType } from '../../utils/normalizeNftType';
5
5
  import { getTransferPolicyRuleNamesFromSuiObject } from '../getTransferPolicyRuleNamesFromSuiObject';
6
6
  import { getNativeKioskTransferPolicies } from './getNativeKioskTransferPolicies';
7
+ import { upgradeKioskRulesPackageId } from './upgradeKioskRulesPackageId';
7
8
 
8
9
  type RuleType = 'kiosk_royalty_rule' | 'royalty_rule' | 'personal_kiosk_rule' | 'kiosk_lock_rule';
9
10
 
@@ -54,5 +55,5 @@ export const getRulePackageId = async ({
54
55
  rulePackageId = rule?.split('::')?.[0];
55
56
  }
56
57
 
57
- return addHexPrefix(rulePackageId);
58
+ return upgradeKioskRulesPackageId(addHexPrefix(rulePackageId));
58
59
  };
@@ -6,6 +6,7 @@ import {
6
6
  getNativeKioskTransferPolicies,
7
7
  knownTransferPolicyRules,
8
8
  } from './getNativeKioskTransferPolicies';
9
+ import { upgradeKioskRulesPackageId } from './upgradeKioskRulesPackageId';
9
10
 
10
11
  interface RuleData {
11
12
  rule: string;
@@ -132,6 +133,8 @@ export const getTransferPoliciesToResolve = async ({
132
133
  rulePackageId = ruleData?.rule?.split('::')?.[0];
133
134
  }
134
135
 
136
+ rulePackageId = upgradeKioskRulesPackageId(rulePackageId);
137
+
135
138
  const moduleName = ruleData?.rule?.split('::')?.[1];
136
139
 
137
140
  if (originByteRuleModules.includes(moduleName)) {
@@ -0,0 +1,17 @@
1
+ import { normalizeSuiAddress } from '@mysten/sui/utils';
2
+
3
+ // @mysten/kiosk's mainnet rule defaults still point at v1 of the kiosk rules
4
+ // package. The package has since been upgraded; newer collections (e.g. suirocks)
5
+ // have linkage constraints that require the upgraded version, so calling v1
6
+ // fails with InvalidLinkage. Remap the original packageId to the upgraded one
7
+ // when it shows up in rule lookups.
8
+ const KIOSK_RULES_ORIGINAL_PACKAGE_ID = normalizeSuiAddress(
9
+ '0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879',
10
+ );
11
+ const KIOSK_RULES_UPGRADED_PACKAGE_ID =
12
+ '0xdfb4f1d4e43e0c3ad834dcd369f0d39005c872e118c9dc1c5da9765bb93ee5f3';
13
+
14
+ export const upgradeKioskRulesPackageId = (packageId: string): string =>
15
+ normalizeSuiAddress(packageId) === KIOSK_RULES_ORIGINAL_PACKAGE_ID
16
+ ? KIOSK_RULES_UPGRADED_PACKAGE_ID
17
+ : packageId;