@novasamatech/host-api-wrapper 0.8.3 → 0.8.4

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.
Files changed (2) hide show
  1. package/dist/accounts.js +7 -1
  2. package/package.json +2 -2
package/dist/accounts.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { CreateProofErr, GetUserIdErr, LoginErr, RequestCredentialsErr, RingLocation, SigningPayload, SigningPayloadWithoutAccount, SigningRawPayload, SigningRawPayloadWithoutAccount, assertEnumVariant, createHostApi, enumValue, fromHex, isEnumVariant, toHex, } from '@novasamatech/host-api';
2
2
  import { decAnyMetadata, unifyMetadata } from '@polkadot-api/substrate-bindings';
3
3
  import { err, ok } from 'neverthrow';
4
+ import { AccountId } from 'polkadot-api';
4
5
  import { getPolkadotSignerFromPjs } from 'polkadot-api/pjs-signer';
5
6
  import { sandboxTransport } from './sandboxTransport.js';
6
7
  const UNSUPPORTED_VERSION_ERROR = 'Unsupported message version';
@@ -198,7 +199,12 @@ export const createAccountsProvider = (transport = sandboxTransport) => {
198
199
  };
199
200
  },
200
201
  getLegacyAccountSigner(account) {
201
- return getPolkadotSignerFromPjs(toHex(account.publicKey), async (payload) => {
202
+ // The pjs `address` is propagated verbatim into the wire `signer` field
203
+ // (see `signer: payload.address` / `signer: raw.address` below), so it
204
+ // must be an SS58 address the wallet can match — not a raw hex public
205
+ // key. Mirrors the injected-extension path, which uses accountId.dec.
206
+ const accountId = AccountId();
207
+ return getPolkadotSignerFromPjs(accountId.dec(account.publicKey), async (payload) => {
202
208
  const codecPayload = {
203
209
  signer: payload.address,
204
210
  payload: buildSigningPayloadFields(payload),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@novasamatech/host-api-wrapper",
3
3
  "type": "module",
4
- "version": "0.8.3",
4
+ "version": "0.8.4",
5
5
  "description": "Host API wrapper: integrate and run your product inside Polkadot browser.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -28,7 +28,7 @@
28
28
  "@polkadot/extension-inject": "^0.63.1",
29
29
  "@polkadot-api/json-rpc-provider-proxy": "^0.4.0",
30
30
  "@polkadot-api/substrate-bindings": "^0.20.3",
31
- "@novasamatech/host-api": "0.8.3",
31
+ "@novasamatech/host-api": "0.8.4",
32
32
  "polkadot-api": ">=2",
33
33
  "neverthrow": "^8.2.0"
34
34
  },