@novasamatech/host-container 0.7.6 → 0.7.7
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/createContainer.js +14 -13
- package/dist/createWebviewProvider.js +6 -3
- package/package.json +2 -2
package/dist/createContainer.js
CHANGED
|
@@ -553,26 +553,27 @@ export function createContainer(provider) {
|
|
|
553
553
|
return enumValue('v1', resultErr(new GenericError({ reason: UNSUPPORTED_MESSAGE_FORMAT_ERROR })));
|
|
554
554
|
}
|
|
555
555
|
const { genesisHash, transaction } = message.value;
|
|
556
|
+
const permissionResponse = await handleRemotePermissionSlot.call(enumValue('v1', enumValue('ChainSubmit', undefined)));
|
|
557
|
+
const permissionGranted = isEnumVariant(permissionResponse, 'v1') &&
|
|
558
|
+
permissionResponse.value.success === true &&
|
|
559
|
+
permissionResponse.value.value === true;
|
|
560
|
+
if (!permissionGranted) {
|
|
561
|
+
return enumValue('v1', resultErr(new GenericError({ reason: 'Permission denied' })));
|
|
562
|
+
}
|
|
563
|
+
const entry = manager.getOrCreateChain(genesisHash);
|
|
564
|
+
if (!entry) {
|
|
565
|
+
return enumValue('v1', resultErr(new GenericError({ reason: 'Chain not supported' })));
|
|
566
|
+
}
|
|
556
567
|
try {
|
|
557
|
-
const permissionResponse = await handleRemotePermissionSlot.call(enumValue('v1', enumValue('ChainSubmit', undefined)));
|
|
558
|
-
const permissionGranted = isEnumVariant(permissionResponse, 'v1') &&
|
|
559
|
-
permissionResponse.value.success === true &&
|
|
560
|
-
permissionResponse.value.value === true;
|
|
561
|
-
if (!permissionGranted) {
|
|
562
|
-
return enumValue('v1', resultErr(new GenericError({ reason: 'Permission denied' })));
|
|
563
|
-
}
|
|
564
|
-
const entry = manager.getOrCreateChain(genesisHash);
|
|
565
|
-
if (!entry) {
|
|
566
|
-
return enumValue('v1', resultErr(new GenericError({ reason: 'Chain not supported' })));
|
|
567
|
-
}
|
|
568
568
|
const result = await manager.sendRequest(genesisHash, 'transaction_v1_broadcast', [transaction]);
|
|
569
|
-
manager.releaseChain(genesisHash);
|
|
570
569
|
return enumValue('v1', resultOk(result ?? null));
|
|
571
570
|
}
|
|
572
571
|
catch (e) {
|
|
573
|
-
manager.releaseChain(genesisHash);
|
|
574
572
|
return enumValue('v1', resultErr(new GenericError({ reason: String(e) })));
|
|
575
573
|
}
|
|
574
|
+
finally {
|
|
575
|
+
manager.releaseChain(genesisHash);
|
|
576
|
+
}
|
|
576
577
|
}));
|
|
577
578
|
// Transaction stop
|
|
578
579
|
cleanups.push(transport.handleRequest('remote_chain_transaction_stop', async (message) => {
|
|
@@ -25,14 +25,17 @@ export function createWebviewProvider({ webview, logger, openDevTools }) {
|
|
|
25
25
|
const portInitMessage = `HOST_API_PORT_INIT_${nanoid(12)}`;
|
|
26
26
|
await webview
|
|
27
27
|
.executeJavaScript(`
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
(function() {
|
|
29
|
+
function handler(e) {
|
|
30
|
+
if (e.data !== '${portInitMessage}') return;
|
|
31
|
+
window.removeEventListener('message', handler);
|
|
30
32
|
const port = e.ports[0];
|
|
31
33
|
if (port) {
|
|
32
34
|
window['${WEBVIEW_HOST_PORT_NAME}'] = port;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
|
|
37
|
+
window.addEventListener('message', handler);
|
|
38
|
+
})();
|
|
36
39
|
`)
|
|
37
40
|
.catch(reject);
|
|
38
41
|
// @ts-expect-error contentWindow is undefined somehow
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novasamatech/host-container",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.7",
|
|
5
5
|
"description": "Host container for hosting and managing products within the Polkadot ecosystem.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@noble/hashes": "2.2.0",
|
|
29
29
|
"polkadot-api": ">=2",
|
|
30
30
|
"@polkadot-api/substrate-client": "^0.7.0",
|
|
31
|
-
"@novasamatech/host-api": "0.7.
|
|
31
|
+
"@novasamatech/host-api": "0.7.7",
|
|
32
32
|
"nanoid": "5.1.9",
|
|
33
33
|
"neverthrow": "^8.2.0"
|
|
34
34
|
},
|