@novasamatech/host-api 0.5.2 → 0.5.4-0
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 +3 -3
- package/dist/helpers.d.ts +0 -29
- package/dist/helpers.js +0 -30
- package/dist/hostApi.d.ts +3 -2
- package/dist/hostApi.js +65 -42
- package/dist/index.d.ts +8 -7
- package/dist/index.js +5 -5
- package/dist/protocol/commonCodecs.d.ts +3 -38
- package/dist/protocol/commonCodecs.js +2 -59
- package/dist/protocol/impl.d.ts +22 -14
- package/dist/protocol/impl.js +23 -15
- package/dist/protocol/messageCodec.d.ts +554 -668
- package/dist/protocol/messageCodec.js +3 -3
- package/dist/protocol/v1/accounts.d.ts +37 -209
- package/dist/protocol/v1/accounts.js +2 -1
- package/dist/protocol/v1/chat.d.ts +224 -149
- package/dist/protocol/v1/chat.js +51 -12
- package/dist/protocol/v1/createTransaction.d.ts +21 -116
- package/dist/protocol/v1/createTransaction.js +7 -5
- package/dist/protocol/v1/feature.d.ts +3 -7
- package/dist/protocol/v1/feature.js +2 -1
- package/dist/protocol/v1/handshake.d.ts +15 -75
- package/dist/protocol/v1/handshake.js +2 -1
- package/dist/protocol/v1/jsonRpc.d.ts +3 -7
- package/dist/protocol/v1/permission.d.ts +14 -54
- package/dist/protocol/v1/permission.js +2 -1
- package/dist/protocol/v1/sign.d.ts +19 -90
- package/dist/protocol/v1/sign.js +6 -4
- package/dist/protocol/v1/statementStore.d.ts +153 -74
- package/dist/protocol/v1/statementStore.js +18 -1
- package/dist/protocol/v1/storage.d.ts +24 -80
- package/dist/protocol/v1/storage.js +5 -4
- package/dist/transport.js +5 -4
- package/dist/types.d.ts +6 -4
- package/package.json +2 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { Enum } from '@novasamatech/scale';
|
|
1
2
|
import { Struct, _void, str } from 'scale-ts';
|
|
2
|
-
import { Enum } from './commonCodecs.js';
|
|
3
3
|
import { hostApiProtocol } from './impl.js';
|
|
4
4
|
const createPayload = (hostApi) => {
|
|
5
5
|
const fields = {};
|
|
6
6
|
for (const [method, payload] of Object.entries(hostApi)) {
|
|
7
|
-
if (payload.
|
|
7
|
+
if (payload.method === 'request') {
|
|
8
8
|
fields[`${method}_request`] = payload.request;
|
|
9
9
|
fields[`${method}_response`] = payload.response;
|
|
10
10
|
}
|
|
11
|
-
if (payload.
|
|
11
|
+
if (payload.method === 'subscribe') {
|
|
12
12
|
fields[`${method}_start`] = payload.start;
|
|
13
13
|
fields[`${method}_stop`] = _void;
|
|
14
14
|
fields[`${method}_interrupt`] = _void;
|
|
@@ -23,152 +23,40 @@ export declare const RingLocation: import("scale-ts").Codec<{
|
|
|
23
23
|
palletInstance: number | undefined;
|
|
24
24
|
} | undefined;
|
|
25
25
|
}>;
|
|
26
|
-
export declare const RequestCredentialsErr: [import("scale-ts").Encoder<(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
className: string;
|
|
33
|
-
payload: undefined;
|
|
34
|
-
}) | (Error & {
|
|
35
|
-
name: "RequestCredentialsErr::DomainNotValid";
|
|
36
|
-
className: string;
|
|
37
|
-
payload: undefined;
|
|
38
|
-
}) | (Error & {
|
|
39
|
-
name: "RequestCredentialsErr::Unknown";
|
|
40
|
-
className: string;
|
|
41
|
-
payload: {
|
|
26
|
+
export declare const RequestCredentialsErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::NotConnected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::Rejected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::DomainNotValid"> | import("@novasamatech/scale").CodecError<{
|
|
27
|
+
reason: string;
|
|
28
|
+
}, "RequestCredentialsErr::Unknown">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::NotConnected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::Rejected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::DomainNotValid"> | import("@novasamatech/scale").CodecError<{
|
|
29
|
+
reason: string;
|
|
30
|
+
}, "RequestCredentialsErr::Unknown">>] & {
|
|
31
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::NotConnected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::Rejected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::DomainNotValid"> | import("@novasamatech/scale").CodecError<{
|
|
42
32
|
reason: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
name: "RequestCredentialsErr::NotConnected";
|
|
46
|
-
className: string;
|
|
47
|
-
payload: undefined;
|
|
48
|
-
}) | (Error & {
|
|
49
|
-
name: "RequestCredentialsErr::Rejected";
|
|
50
|
-
className: string;
|
|
51
|
-
payload: undefined;
|
|
52
|
-
}) | (Error & {
|
|
53
|
-
name: "RequestCredentialsErr::DomainNotValid";
|
|
54
|
-
className: string;
|
|
55
|
-
payload: undefined;
|
|
56
|
-
}) | (Error & {
|
|
57
|
-
name: "RequestCredentialsErr::Unknown";
|
|
58
|
-
className: string;
|
|
59
|
-
payload: {
|
|
33
|
+
}, "RequestCredentialsErr::Unknown">>;
|
|
34
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::NotConnected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::Rejected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::DomainNotValid"> | import("@novasamatech/scale").CodecError<{
|
|
60
35
|
reason: string;
|
|
61
|
-
}
|
|
62
|
-
})>] & {
|
|
63
|
-
enc: import("scale-ts").Encoder<(Error & {
|
|
64
|
-
name: "RequestCredentialsErr::NotConnected";
|
|
65
|
-
className: string;
|
|
66
|
-
payload: undefined;
|
|
67
|
-
}) | (Error & {
|
|
68
|
-
name: "RequestCredentialsErr::Rejected";
|
|
69
|
-
className: string;
|
|
70
|
-
payload: undefined;
|
|
71
|
-
}) | (Error & {
|
|
72
|
-
name: "RequestCredentialsErr::DomainNotValid";
|
|
73
|
-
className: string;
|
|
74
|
-
payload: undefined;
|
|
75
|
-
}) | (Error & {
|
|
76
|
-
name: "RequestCredentialsErr::Unknown";
|
|
77
|
-
className: string;
|
|
78
|
-
payload: {
|
|
79
|
-
reason: string;
|
|
80
|
-
};
|
|
81
|
-
})>;
|
|
82
|
-
dec: import("scale-ts").Decoder<(Error & {
|
|
83
|
-
name: "RequestCredentialsErr::NotConnected";
|
|
84
|
-
className: string;
|
|
85
|
-
payload: undefined;
|
|
86
|
-
}) | (Error & {
|
|
87
|
-
name: "RequestCredentialsErr::Rejected";
|
|
88
|
-
className: string;
|
|
89
|
-
payload: undefined;
|
|
90
|
-
}) | (Error & {
|
|
91
|
-
name: "RequestCredentialsErr::DomainNotValid";
|
|
92
|
-
className: string;
|
|
93
|
-
payload: undefined;
|
|
94
|
-
}) | (Error & {
|
|
95
|
-
name: "RequestCredentialsErr::Unknown";
|
|
96
|
-
className: string;
|
|
97
|
-
payload: {
|
|
98
|
-
reason: string;
|
|
99
|
-
};
|
|
100
|
-
})>;
|
|
36
|
+
}, "RequestCredentialsErr::Unknown">>;
|
|
101
37
|
} & {
|
|
102
|
-
readonly NotConnected: import("
|
|
103
|
-
readonly Rejected: import("
|
|
104
|
-
readonly DomainNotValid: import("
|
|
105
|
-
readonly Unknown: import("
|
|
38
|
+
readonly NotConnected: import("@novasamatech/scale").ErrCodec<undefined, "RequestCredentialsErr::NotConnected">;
|
|
39
|
+
readonly Rejected: import("@novasamatech/scale").ErrCodec<undefined, "RequestCredentialsErr::Rejected">;
|
|
40
|
+
readonly DomainNotValid: import("@novasamatech/scale").ErrCodec<undefined, "RequestCredentialsErr::DomainNotValid">;
|
|
41
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
106
42
|
reason: string;
|
|
107
43
|
}, "RequestCredentialsErr::Unknown">;
|
|
108
44
|
};
|
|
109
|
-
export declare const CreateProofErr: [import("scale-ts").Encoder<(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
className: string;
|
|
116
|
-
payload: {
|
|
45
|
+
export declare const CreateProofErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
46
|
+
reason: string;
|
|
47
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
48
|
+
reason: string;
|
|
49
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>] & {
|
|
50
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
117
51
|
reason: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
name: "CreateProofErr::RingNotFound";
|
|
121
|
-
className: string;
|
|
122
|
-
payload: undefined;
|
|
123
|
-
})>, import("scale-ts").Decoder<(Error & {
|
|
124
|
-
name: "CreateProofErr::Rejected";
|
|
125
|
-
className: string;
|
|
126
|
-
payload: undefined;
|
|
127
|
-
}) | (Error & {
|
|
128
|
-
name: "CreateProofErr::Unknown";
|
|
129
|
-
className: string;
|
|
130
|
-
payload: {
|
|
52
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>;
|
|
53
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
131
54
|
reason: string;
|
|
132
|
-
}
|
|
133
|
-
}) | (Error & {
|
|
134
|
-
name: "CreateProofErr::RingNotFound";
|
|
135
|
-
className: string;
|
|
136
|
-
payload: undefined;
|
|
137
|
-
})>] & {
|
|
138
|
-
enc: import("scale-ts").Encoder<(Error & {
|
|
139
|
-
name: "CreateProofErr::Rejected";
|
|
140
|
-
className: string;
|
|
141
|
-
payload: undefined;
|
|
142
|
-
}) | (Error & {
|
|
143
|
-
name: "CreateProofErr::Unknown";
|
|
144
|
-
className: string;
|
|
145
|
-
payload: {
|
|
146
|
-
reason: string;
|
|
147
|
-
};
|
|
148
|
-
}) | (Error & {
|
|
149
|
-
name: "CreateProofErr::RingNotFound";
|
|
150
|
-
className: string;
|
|
151
|
-
payload: undefined;
|
|
152
|
-
})>;
|
|
153
|
-
dec: import("scale-ts").Decoder<(Error & {
|
|
154
|
-
name: "CreateProofErr::Rejected";
|
|
155
|
-
className: string;
|
|
156
|
-
payload: undefined;
|
|
157
|
-
}) | (Error & {
|
|
158
|
-
name: "CreateProofErr::Unknown";
|
|
159
|
-
className: string;
|
|
160
|
-
payload: {
|
|
161
|
-
reason: string;
|
|
162
|
-
};
|
|
163
|
-
}) | (Error & {
|
|
164
|
-
name: "CreateProofErr::RingNotFound";
|
|
165
|
-
className: string;
|
|
166
|
-
payload: undefined;
|
|
167
|
-
})>;
|
|
55
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>;
|
|
168
56
|
} & {
|
|
169
|
-
readonly RingNotFound: import("
|
|
170
|
-
readonly Rejected: import("
|
|
171
|
-
readonly Unknown: import("
|
|
57
|
+
readonly RingNotFound: import("@novasamatech/scale").ErrCodec<undefined, "CreateProofErr::RingNotFound">;
|
|
58
|
+
readonly Rejected: import("@novasamatech/scale").ErrCodec<undefined, "CreateProofErr::Rejected">;
|
|
59
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
172
60
|
reason: string;
|
|
173
61
|
}, "CreateProofErr::Unknown">;
|
|
174
62
|
};
|
|
@@ -176,48 +64,16 @@ export declare const AccountGetV1_request: import("scale-ts").Codec<[string, num
|
|
|
176
64
|
export declare const AccountGetV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
177
65
|
publicKey: Uint8Array<ArrayBufferLike>;
|
|
178
66
|
name: string | undefined;
|
|
179
|
-
}, (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
payload: undefined;
|
|
183
|
-
}) | (Error & {
|
|
184
|
-
name: "RequestCredentialsErr::Rejected";
|
|
185
|
-
className: string;
|
|
186
|
-
payload: undefined;
|
|
187
|
-
}) | (Error & {
|
|
188
|
-
name: "RequestCredentialsErr::DomainNotValid";
|
|
189
|
-
className: string;
|
|
190
|
-
payload: undefined;
|
|
191
|
-
}) | (Error & {
|
|
192
|
-
name: "RequestCredentialsErr::Unknown";
|
|
193
|
-
className: string;
|
|
194
|
-
payload: {
|
|
195
|
-
reason: string;
|
|
196
|
-
};
|
|
197
|
-
})>>;
|
|
67
|
+
}, import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::NotConnected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::Rejected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::DomainNotValid"> | import("@novasamatech/scale").CodecError<{
|
|
68
|
+
reason: string;
|
|
69
|
+
}, "RequestCredentialsErr::Unknown">>>;
|
|
198
70
|
export declare const AccountGetAliasV1_request: import("scale-ts").Codec<[string, number]>;
|
|
199
71
|
export declare const AccountGetAliasV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
200
72
|
context: Uint8Array<ArrayBufferLike>;
|
|
201
73
|
alias: Uint8Array<ArrayBufferLike>;
|
|
202
|
-
}, (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
payload: undefined;
|
|
206
|
-
}) | (Error & {
|
|
207
|
-
name: "RequestCredentialsErr::Rejected";
|
|
208
|
-
className: string;
|
|
209
|
-
payload: undefined;
|
|
210
|
-
}) | (Error & {
|
|
211
|
-
name: "RequestCredentialsErr::DomainNotValid";
|
|
212
|
-
className: string;
|
|
213
|
-
payload: undefined;
|
|
214
|
-
}) | (Error & {
|
|
215
|
-
name: "RequestCredentialsErr::Unknown";
|
|
216
|
-
className: string;
|
|
217
|
-
payload: {
|
|
218
|
-
reason: string;
|
|
219
|
-
};
|
|
220
|
-
})>>;
|
|
74
|
+
}, import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::NotConnected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::Rejected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::DomainNotValid"> | import("@novasamatech/scale").CodecError<{
|
|
75
|
+
reason: string;
|
|
76
|
+
}, "RequestCredentialsErr::Unknown">>>;
|
|
221
77
|
export declare const AccountCreateProofV1_request: import("scale-ts").Codec<[[string, number], {
|
|
222
78
|
genesisHash: `0x${string}`;
|
|
223
79
|
ringRootHash: `0x${string}`;
|
|
@@ -225,41 +81,13 @@ export declare const AccountCreateProofV1_request: import("scale-ts").Codec<[[st
|
|
|
225
81
|
palletInstance: number | undefined;
|
|
226
82
|
} | undefined;
|
|
227
83
|
}, Uint8Array<ArrayBufferLike>]>;
|
|
228
|
-
export declare const AccountCreateProofV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike>, (
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
payload: undefined;
|
|
232
|
-
}) | (Error & {
|
|
233
|
-
name: "CreateProofErr::Unknown";
|
|
234
|
-
className: string;
|
|
235
|
-
payload: {
|
|
236
|
-
reason: string;
|
|
237
|
-
};
|
|
238
|
-
}) | (Error & {
|
|
239
|
-
name: "CreateProofErr::RingNotFound";
|
|
240
|
-
className: string;
|
|
241
|
-
payload: undefined;
|
|
242
|
-
})>>;
|
|
84
|
+
export declare const AccountCreateProofV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike>, import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
85
|
+
reason: string;
|
|
86
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>>;
|
|
243
87
|
export declare const GetNonProductAccountsV1_request: import("scale-ts").Codec<undefined>;
|
|
244
88
|
export declare const GetNonProductAccountsV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
245
89
|
publicKey: Uint8Array<ArrayBufferLike>;
|
|
246
90
|
name: string | undefined;
|
|
247
|
-
}[], (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
payload: undefined;
|
|
251
|
-
}) | (Error & {
|
|
252
|
-
name: "RequestCredentialsErr::Rejected";
|
|
253
|
-
className: string;
|
|
254
|
-
payload: undefined;
|
|
255
|
-
}) | (Error & {
|
|
256
|
-
name: "RequestCredentialsErr::DomainNotValid";
|
|
257
|
-
className: string;
|
|
258
|
-
payload: undefined;
|
|
259
|
-
}) | (Error & {
|
|
260
|
-
name: "RequestCredentialsErr::Unknown";
|
|
261
|
-
className: string;
|
|
262
|
-
payload: {
|
|
263
|
-
reason: string;
|
|
264
|
-
};
|
|
265
|
-
})>>;
|
|
91
|
+
}[], import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::NotConnected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::Rejected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::DomainNotValid"> | import("@novasamatech/scale").CodecError<{
|
|
92
|
+
reason: string;
|
|
93
|
+
}, "RequestCredentialsErr::Unknown">>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ErrEnum, Hex } from '@novasamatech/scale';
|
|
1
2
|
import { Bytes, Option, Result, Struct, Tuple, Vector, _void, str, u32 } from 'scale-ts';
|
|
2
|
-
import {
|
|
3
|
+
import { GenericErr, GenesisHash } from '../commonCodecs.js';
|
|
3
4
|
// common types
|
|
4
5
|
export const AccountId = Bytes(32);
|
|
5
6
|
export const PublicKey = Bytes();
|