@novasamatech/host-api-wrapper 0.8.2 → 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.
- package/dist/accounts.js +7 -1
- package/dist/payments.d.ts +3 -0
- package/dist/payments.js +3 -1
- 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
|
-
|
|
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/dist/payments.d.ts
CHANGED
package/dist/payments.js
CHANGED
|
@@ -22,7 +22,9 @@ export const createPaymentManager = (transport = sandboxTransport) => {
|
|
|
22
22
|
tag: 'ProductAccount',
|
|
23
23
|
value: source.derivationIndex,
|
|
24
24
|
}
|
|
25
|
-
:
|
|
25
|
+
: source.type === 'privateKey'
|
|
26
|
+
? { tag: 'PrivateKey', value: source.key }
|
|
27
|
+
: { tag: 'Coins', value: source.keys };
|
|
26
28
|
return resultToPromise(unwrapVersionedResult(version, hostApi.paymentTopUp(enumValue(version, { into, amount, source: sourceCodec }))));
|
|
27
29
|
},
|
|
28
30
|
requestPayment(amount, destination, from) {
|
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.
|
|
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.
|
|
31
|
+
"@novasamatech/host-api": "0.8.4",
|
|
32
32
|
"polkadot-api": ">=2",
|
|
33
33
|
"neverthrow": "^8.2.0"
|
|
34
34
|
},
|