Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #24 from Phala-Network/fix-all-wallet-extensions-s…
Browse files Browse the repository at this point in the history
…upport-wrap-bytes

Fix all wallet extensions support wrap bytes
  • Loading branch information
Leechael authored Jan 30, 2023
2 parents af8b539 + e4b8742 commit c358f2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@phala/sdk",
"version": "0.3.5",
"version": "0.3.6",
"description": "Phala Phat Contract JS SDK",
"homepage": "https:/Phala-Network/js-sdk/tree/main/packages/sdk#readme",
"repository": {
Expand Down
14 changes: 3 additions & 11 deletions packages/sdk/src/certificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,13 @@ export const signCertificate = async (

const getSignatureTypeFromAccount = (account: InjectedAccountWithMeta) => {
const keypairType = account.type || "sr25519";
// Polkadot JS signature use wrapBytes
const useWrapBytes = account.meta.source === "polkadot-js";
switch (keypairType) {
case "sr25519":
return useWrapBytes
? pruntimeRpc.SignatureType.Sr25519WrapBytes
: pruntimeRpc.SignatureType.Sr25519;
return pruntimeRpc.SignatureType.Sr25519WrapBytes;
case "ed25519":
return useWrapBytes
? pruntimeRpc.SignatureType.Ed25519WrapBytes
: pruntimeRpc.SignatureType.Ed25519;
return pruntimeRpc.SignatureType.Ed25519WrapBytes;
case "ecdsa":
return useWrapBytes
? pruntimeRpc.SignatureType.EcdsaWrapBytes
: pruntimeRpc.SignatureType.Ecdsa;
return pruntimeRpc.SignatureType.EcdsaWrapBytes;
default:
throw new Error("Unsupported keypair type");
}
Expand Down

0 comments on commit c358f2c

Please sign in to comment.