@novasamatech/host-api 0.5.4-9 → 0.5.5
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/README.md +2 -2
- package/dist/helpers.js +1 -1
- package/dist/hostApi.d.ts +2 -1
- package/dist/hostApi.js +127 -32
- package/dist/index.d.ts +7 -2
- package/dist/index.js +7 -2
- package/dist/protocol/impl.d.ts +418 -60
- package/dist/protocol/impl.js +60 -35
- package/dist/protocol/messageCodec.d.ts +315 -225
- package/dist/protocol/v1/chat.d.ts +11 -3
- package/dist/protocol/v1/chat.js +8 -3
- package/dist/protocol/v1/devicePermission.d.ts +5 -0
- package/dist/protocol/v1/devicePermission.js +6 -0
- package/dist/protocol/v1/localStorage.d.ts +31 -0
- package/dist/protocol/v1/localStorage.js +17 -0
- package/dist/protocol/v1/navigation.d.ts +21 -0
- package/dist/protocol/v1/navigation.js +9 -0
- package/dist/protocol/v1/notification.d.ts +11 -0
- package/dist/protocol/v1/notification.js +8 -0
- package/dist/protocol/v1/preimage.d.ts +24 -0
- package/dist/protocol/v1/preimage.js +12 -0
- package/dist/protocol/v1/remotePermission.d.ts +17 -0
- package/dist/protocol/v1/remotePermission.js +9 -0
- package/dist/protocol/v1/statementStore.d.ts +0 -36
- package/dist/protocol/v1/statementStore.js +1 -3
- package/dist/transport.js +3 -3
- package/package.json +3 -3
package/dist/protocol/impl.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { Enum } from '@novasamatech/scale';
|
|
2
2
|
import { AccountCreateProofV1_request, AccountCreateProofV1_response, AccountGetAliasV1_request, AccountGetAliasV1_response, AccountGetV1_request, AccountGetV1_response, GetNonProductAccountsV1_request, GetNonProductAccountsV1_response, } from './v1/accounts.js';
|
|
3
|
-
import { ChatActionSubscribeV1_receive, ChatActionSubscribeV1_start, ChatCreateRoomV1_request, ChatCreateRoomV1_response, ChatListSubscribeV1_receive, ChatListSubscribeV1_start, ChatPostMessageV1_request, ChatPostMessageV1_response, } from './v1/chat.js';
|
|
3
|
+
import { ChatActionSubscribeV1_receive, ChatActionSubscribeV1_start, ChatCreateRoomV1_request, ChatCreateRoomV1_response, ChatListSubscribeV1_receive, ChatListSubscribeV1_start, ChatPostMessageV1_request, ChatPostMessageV1_response, ChatRegisterBotV1_request, ChatRegisterBotV1_response, } from './v1/chat.js';
|
|
4
4
|
import { CreateTransactionV1_request, CreateTransactionV1_response, CreateTransactionWithNonProductAccountV1_request, CreateTransactionWithNonProductAccountV1_response, } from './v1/createTransaction.js';
|
|
5
|
+
import { DevicePermissionV1_request, DevicePermissionV1_response } from './v1/devicePermission.js';
|
|
5
6
|
import { FeatureV1_request, FeatureV1_response } from './v1/feature.js';
|
|
6
7
|
import { HandshakeV1_request, HandshakeV1_response } from './v1/handshake.js';
|
|
7
8
|
import { JsonRpcMessageSendV1_request, JsonRpcMessageSendV1_response, JsonRpcMessageSubscribeV1_receive, JsonRpcMessageSubscribeV1_start, } from './v1/jsonRpc.js';
|
|
9
|
+
import { StorageClearV1_request, StorageClearV1_response, StorageReadV1_request, StorageReadV1_response, StorageWriteV1_request, StorageWriteV1_response, } from './v1/localStorage.js';
|
|
10
|
+
import { NavigateToV1_request, NavigateToV1_response } from './v1/navigation.js';
|
|
11
|
+
import { PushNotificationV1_request, PushNotificationV1_response } from './v1/notification.js';
|
|
12
|
+
import { PreimageLookupSubscribeV1_receive, PreimageLookupSubscribeV1_start, PreimageSubmitV1_request, PreimageSubmitV1_response, } from './v1/preimage.js';
|
|
13
|
+
import { RemotePermissionV1_request, RemotePermissionV1_response } from './v1/remotePermission.js';
|
|
8
14
|
import { SignPayloadV1_request, SignPayloadV1_response, SignRawV1_request, SignRawV1_response } from './v1/sign.js';
|
|
9
|
-
import { StatementStoreCreateProofV1_request, StatementStoreCreateProofV1_response,
|
|
10
|
-
import { StorageClearV1_request, StorageClearV1_response, StorageReadV1_request, StorageReadV1_response, StorageWriteV1_request, StorageWriteV1_response, } from './v1/storage.js';
|
|
15
|
+
import { StatementStoreCreateProofV1_request, StatementStoreCreateProofV1_response, StatementStoreSubmitV1_request, StatementStoreSubmitV1_response, StatementStoreSubscribeV1_receive, StatementStoreSubscribeV1_start, } from './v1/statementStore.js';
|
|
11
16
|
const enumFromArg = (enumValues, n) => {
|
|
12
17
|
return Enum(Object.fromEntries(Object.entries(enumValues).map(([key, value]) => [key, value[n]])));
|
|
13
18
|
};
|
|
@@ -26,80 +31,100 @@ const versionedSubscription = (values) => {
|
|
|
26
31
|
};
|
|
27
32
|
};
|
|
28
33
|
export const hostApiProtocol = {
|
|
29
|
-
//
|
|
30
|
-
|
|
34
|
+
// Host calls
|
|
35
|
+
host_handshake: versionedRequest({
|
|
31
36
|
v1: [HandshakeV1_request, HandshakeV1_response],
|
|
32
37
|
}),
|
|
33
|
-
|
|
38
|
+
host_feature_supported: versionedRequest({
|
|
34
39
|
v1: [FeatureV1_request, FeatureV1_response],
|
|
35
40
|
}),
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
host_push_notification: versionedRequest({
|
|
42
|
+
v1: [PushNotificationV1_request, PushNotificationV1_response],
|
|
43
|
+
}),
|
|
44
|
+
host_navigate_to: versionedRequest({
|
|
45
|
+
v1: [NavigateToV1_request, NavigateToV1_response],
|
|
46
|
+
}),
|
|
47
|
+
// Permissions
|
|
48
|
+
host_device_permission: versionedRequest({
|
|
49
|
+
v1: [DevicePermissionV1_request, DevicePermissionV1_response],
|
|
50
|
+
}),
|
|
51
|
+
remote_permission: versionedRequest({
|
|
52
|
+
v1: [RemotePermissionV1_request, RemotePermissionV1_response],
|
|
53
|
+
}),
|
|
54
|
+
// Local storage
|
|
55
|
+
host_local_storage_read: versionedRequest({
|
|
38
56
|
v1: [StorageReadV1_request, StorageReadV1_response],
|
|
39
57
|
}),
|
|
40
|
-
|
|
58
|
+
host_local_storage_write: versionedRequest({
|
|
41
59
|
v1: [StorageWriteV1_request, StorageWriteV1_response],
|
|
42
60
|
}),
|
|
43
|
-
|
|
61
|
+
host_local_storage_clear: versionedRequest({
|
|
44
62
|
v1: [StorageClearV1_request, StorageClearV1_response],
|
|
45
63
|
}),
|
|
46
|
-
//
|
|
47
|
-
|
|
64
|
+
// Account management
|
|
65
|
+
host_account_get: versionedRequest({
|
|
48
66
|
v1: [AccountGetV1_request, AccountGetV1_response],
|
|
49
67
|
}),
|
|
50
|
-
|
|
68
|
+
host_account_get_alias: versionedRequest({
|
|
51
69
|
v1: [AccountGetAliasV1_request, AccountGetAliasV1_response],
|
|
52
70
|
}),
|
|
53
|
-
|
|
71
|
+
host_account_create_proof: versionedRequest({
|
|
54
72
|
v1: [AccountCreateProofV1_request, AccountCreateProofV1_response],
|
|
55
73
|
}),
|
|
56
|
-
|
|
74
|
+
host_get_non_product_accounts: versionedRequest({
|
|
57
75
|
v1: [GetNonProductAccountsV1_request, GetNonProductAccountsV1_response],
|
|
58
76
|
}),
|
|
59
|
-
//
|
|
60
|
-
|
|
77
|
+
// Signing
|
|
78
|
+
host_create_transaction: versionedRequest({
|
|
61
79
|
v1: [CreateTransactionV1_request, CreateTransactionV1_response],
|
|
62
80
|
}),
|
|
63
|
-
|
|
81
|
+
host_create_transaction_with_non_product_account: versionedRequest({
|
|
64
82
|
v1: [CreateTransactionWithNonProductAccountV1_request, CreateTransactionWithNonProductAccountV1_response],
|
|
65
83
|
}),
|
|
66
|
-
|
|
84
|
+
host_sign_raw: versionedRequest({
|
|
67
85
|
v1: [SignRawV1_request, SignRawV1_response],
|
|
68
86
|
}),
|
|
69
|
-
|
|
87
|
+
host_sign_payload: versionedRequest({
|
|
70
88
|
v1: [SignPayloadV1_request, SignPayloadV1_response],
|
|
71
89
|
}),
|
|
72
|
-
//
|
|
73
|
-
|
|
90
|
+
// Chat
|
|
91
|
+
host_chat_create_room: versionedRequest({
|
|
74
92
|
v1: [ChatCreateRoomV1_request, ChatCreateRoomV1_response],
|
|
75
93
|
}),
|
|
76
|
-
|
|
94
|
+
host_chat_register_bot: versionedRequest({
|
|
95
|
+
v1: [ChatRegisterBotV1_request, ChatRegisterBotV1_response],
|
|
96
|
+
}),
|
|
97
|
+
host_chat_list_subscribe: versionedSubscription({
|
|
77
98
|
v1: [ChatListSubscribeV1_start, ChatListSubscribeV1_receive],
|
|
78
99
|
}),
|
|
79
|
-
|
|
100
|
+
host_chat_post_message: versionedRequest({
|
|
80
101
|
v1: [ChatPostMessageV1_request, ChatPostMessageV1_response],
|
|
81
102
|
}),
|
|
82
|
-
|
|
103
|
+
host_chat_action_subscribe: versionedSubscription({
|
|
83
104
|
v1: [ChatActionSubscribeV1_start, ChatActionSubscribeV1_receive],
|
|
84
105
|
}),
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
v1: [StatementStoreQueryV1_request, StatementStoreQueryV1_response],
|
|
88
|
-
}),
|
|
89
|
-
statement_store_subscribe: versionedSubscription({
|
|
106
|
+
// Statement store (remote namespace)
|
|
107
|
+
remote_statement_store_subscribe: versionedSubscription({
|
|
90
108
|
v1: [StatementStoreSubscribeV1_start, StatementStoreSubscribeV1_receive],
|
|
91
109
|
}),
|
|
92
|
-
|
|
110
|
+
remote_statement_store_create_proof: versionedRequest({
|
|
93
111
|
v1: [StatementStoreCreateProofV1_request, StatementStoreCreateProofV1_response],
|
|
94
112
|
}),
|
|
95
|
-
|
|
113
|
+
remote_statement_store_submit: versionedRequest({
|
|
96
114
|
v1: [StatementStoreSubmitV1_request, StatementStoreSubmitV1_response],
|
|
97
115
|
}),
|
|
98
|
-
//
|
|
99
|
-
|
|
116
|
+
// Preimage lookup
|
|
117
|
+
remote_preimage_lookup_subscribe: versionedSubscription({
|
|
118
|
+
v1: [PreimageLookupSubscribeV1_start, PreimageLookupSubscribeV1_receive],
|
|
119
|
+
}),
|
|
120
|
+
remote_preimage_submit: versionedRequest({
|
|
121
|
+
v1: [PreimageSubmitV1_request, PreimageSubmitV1_response],
|
|
122
|
+
}),
|
|
123
|
+
// json rpc (temporary, kept until chain methods are added)
|
|
124
|
+
host_jsonrpc_message_send: versionedRequest({
|
|
100
125
|
v1: [JsonRpcMessageSendV1_request, JsonRpcMessageSendV1_response],
|
|
101
126
|
}),
|
|
102
|
-
|
|
127
|
+
host_jsonrpc_message_subscribe: versionedSubscription({
|
|
103
128
|
v1: [JsonRpcMessageSubscribeV1_start, JsonRpcMessageSubscribeV1_receive],
|
|
104
129
|
}),
|
|
105
130
|
};
|