Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dual compatibility with Polymesh v6 and v7 #276

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-any.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
# with:
# args: yarn e2e
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build
path: |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@polkadot/dev": "^0.79.3",
"@polkadot/dev-test": "^0.79.3",
"@polkadot/types": "^12.3.1",
"@polymeshassociation/polymesh-sdk": "^24.6.0",
"@polymeshassociation/polymesh-sdk": "^26.0.0-beta.2",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
Expand Down
16 changes: 14 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,23 @@ const initApiPromise = (network: NetworkName, networkUrl: string) =>

did = isMsPrimaryKey
? msLinkedKeyInfoObj.asPrimaryKey.toString()
: msLinkedKeyInfoObj.asSecondaryKey[0].toString();
: (
// This check is required for backwards compatibility with Polymesh v6
// TODO: remove after v7 update
msLinkedKeyInfoObj.asSecondaryKey.length === 32
? msLinkedKeyInfoObj.asSecondaryKey.toString()
: msLinkedKeyInfoObj.asSecondaryKey[0].toString()
);
} else {
did = isPrimary
? linkedKeyInfoObj.asPrimaryKey.toString()
: linkedKeyInfoObj.asSecondaryKey[0].toString();
: (
// This check is required for backwards compatibility with Polymesh v6
// TODO: remove after v7 update
linkedKeyInfoObj.asSecondaryKey.length === 32
? linkedKeyInfoObj.asSecondaryKey.toString()
: linkedKeyInfoObj.asSecondaryKey[0].toString()
);
}

// Initialize identity state for network:did pair
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2268,9 +2268,9 @@ __metadata:
languageName: unknown
linkType: soft

"@polymeshassociation/polymesh-sdk@npm:^24.6.0":
version: 24.6.0
resolution: "@polymeshassociation/polymesh-sdk@npm:24.6.0"
"@polymeshassociation/polymesh-sdk@npm:^26.0.0-beta.2":
version: 26.0.0-beta.2
resolution: "@polymeshassociation/polymesh-sdk@npm:26.0.0-beta.2"
dependencies:
"@apollo/client": "npm:^3.8.1"
"@polkadot/api": "npm:11.2.1"
Expand All @@ -2288,7 +2288,7 @@ __metadata:
patch-package: "npm:^8.0.0"
semver: "npm:^7.5.4"
websocket: "npm:^1.0.34"
checksum: 10c0/6c604be2cf0cc465613225e511b84b886b17087a966ae6166fe84022029bb6ada10c1d9b7c31efa3036e1a0d1d5615e547d38a94c2d2aea998462880df7812d8
checksum: 10c0/4d4065328aeefa4b947fde8e8d037024b7af38283a5117651c043c3ef509a34520b52ee91487157b8a17a87a18a58e011f85ab39a03e1512afb40ed0d5947c6a
languageName: node
linkType: hard

Expand Down Expand Up @@ -14811,7 +14811,7 @@ __metadata:
"@polkadot/dev": "npm:^0.79.3"
"@polkadot/dev-test": "npm:^0.79.3"
"@polkadot/types": "npm:^12.3.1"
"@polymeshassociation/polymesh-sdk": "npm:^24.6.0"
"@polymeshassociation/polymesh-sdk": "npm:^26.0.0-beta.2"
"@semantic-release/changelog": "npm:^6.0.3"
"@semantic-release/exec": "npm:^6.0.3"
"@semantic-release/git": "npm:^10.0.1"
Expand Down
Loading