@novasamatech/product-sdk 0.5.0-1 → 0.5.0-11
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unwrapResultOrThrow } from '@novasamatech/host-api';
|
|
2
2
|
import { getSyncProvider } from '@polkadot-api/json-rpc-provider-proxy';
|
|
3
3
|
import { defaultTransport } from './defaultTransport.js';
|
|
4
4
|
export function createSpektrPapiProvider({ chainId, fallback }, internal) {
|
|
@@ -7,7 +7,7 @@ export function createSpektrPapiProvider({ chainId, fallback }, internal) {
|
|
|
7
7
|
return fallback;
|
|
8
8
|
const spektrProvider = onMessage => {
|
|
9
9
|
const unsubscribe = transport.subscribe('papiProviderReceiveMessageV1', (_, payload) => {
|
|
10
|
-
const unwrapped =
|
|
10
|
+
const unwrapped = unwrapResultOrThrow(payload);
|
|
11
11
|
if (unwrapped.chainId === chainId) {
|
|
12
12
|
onMessage(unwrapped.message);
|
|
13
13
|
}
|
|
@@ -28,7 +28,7 @@ export function createSpektrPapiProvider({ chainId, fallback }, internal) {
|
|
|
28
28
|
return transport
|
|
29
29
|
.request({ tag: 'supportFeatureRequestV1', value: { tag: 'chain', value: { chainId } } }, 'supportFeatureResponseV1')
|
|
30
30
|
.then(payload => {
|
|
31
|
-
const result =
|
|
31
|
+
const result = unwrapResultOrThrow(payload);
|
|
32
32
|
if (result.tag === 'chain' && result.value.chainId === chainId) {
|
|
33
33
|
return result.value.result;
|
|
34
34
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unwrapResultOrThrow } from '@novasamatech/host-api';
|
|
2
2
|
import { injectExtension } from '@polkadot/extension-inject';
|
|
3
3
|
import { SpektrExtensionName, Version } from './constants.js';
|
|
4
4
|
import { defaultTransport } from './defaultTransport.js';
|
|
@@ -12,12 +12,12 @@ export async function createExtensionEnableFactory(transport) {
|
|
|
12
12
|
get() {
|
|
13
13
|
return transport
|
|
14
14
|
.request({ tag: 'getAccountsRequestV1', value: undefined }, 'getAccountsResponseV1')
|
|
15
|
-
.then(
|
|
15
|
+
.then(unwrapResultOrThrow);
|
|
16
16
|
},
|
|
17
17
|
subscribe(callback) {
|
|
18
18
|
const unsubscribe = transport.subscribe('getAccountsResponseV1', (_, payload) => {
|
|
19
19
|
try {
|
|
20
|
-
const accounts =
|
|
20
|
+
const accounts = unwrapResultOrThrow(payload);
|
|
21
21
|
callback(accounts);
|
|
22
22
|
}
|
|
23
23
|
catch {
|
|
@@ -33,19 +33,17 @@ export async function createExtensionEnableFactory(transport) {
|
|
|
33
33
|
},
|
|
34
34
|
signer: {
|
|
35
35
|
signRaw(raw) {
|
|
36
|
-
return transport
|
|
37
|
-
.request({ tag: 'signRawRequestV1', value: raw }, 'signResponseV1')
|
|
38
|
-
.then(unwrapResponseOrThrow);
|
|
36
|
+
return transport.request({ tag: 'signRawRequestV1', value: raw }, 'signResponseV1').then(unwrapResultOrThrow);
|
|
39
37
|
},
|
|
40
38
|
signPayload(payload) {
|
|
41
39
|
return transport
|
|
42
40
|
.request({ tag: 'signPayloadRequestV1', value: payload }, 'signResponseV1')
|
|
43
|
-
.then(
|
|
41
|
+
.then(unwrapResultOrThrow);
|
|
44
42
|
},
|
|
45
43
|
createTransaction(payload) {
|
|
46
44
|
return transport
|
|
47
45
|
.request({ tag: 'createTransactionRequestV1', value: payload }, 'createTransactionResponseV1')
|
|
48
|
-
.then(
|
|
46
|
+
.then(unwrapResultOrThrow);
|
|
49
47
|
},
|
|
50
48
|
},
|
|
51
49
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novasamatech/product-sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.0-
|
|
4
|
+
"version": "0.5.0-11",
|
|
5
5
|
"description": "Polkadot product SDK: integrate and run your product inside Polkadot browser.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"README.md"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@polkadot/extension-inject": "0.62.
|
|
30
|
-
"@polkadot-api/json-rpc-provider": "0.0.4",
|
|
31
|
-
"@polkadot-api/json-rpc-provider-proxy": "0.2.7",
|
|
32
|
-
"@novasamatech/host-api": "0.5.0-
|
|
29
|
+
"@polkadot/extension-inject": "^0.62.6",
|
|
30
|
+
"@polkadot-api/json-rpc-provider": "^0.0.4",
|
|
31
|
+
"@polkadot-api/json-rpc-provider-proxy": "^0.2.7",
|
|
32
|
+
"@novasamatech/host-api": "0.5.0-11"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|