@novasamatech/host-api 0.5.0-18 → 0.5.0-19
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 +103 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/helpers.d.ts +33 -0
- package/dist/helpers.js +46 -0
- package/dist/hostApi.d.ts +31 -0
- package/dist/hostApi.js +345 -0
- package/dist/index.d.ts +18 -7
- package/dist/index.js +14 -6
- package/dist/protocol/commonCodecs.d.ts +42 -0
- package/dist/protocol/commonCodecs.js +64 -0
- package/dist/protocol/commonCodecs.spec.js +72 -0
- package/dist/protocol/impl.d.ts +93 -0
- package/dist/protocol/impl.js +97 -0
- package/dist/protocol/messageCodec.d.ts +1245 -0
- package/dist/protocol/messageCodec.js +24 -0
- package/dist/protocol/types.js +1 -0
- package/dist/protocol/v1/accounts.d.ts +265 -0
- package/dist/{interactions → protocol}/v1/accounts.js +11 -11
- package/dist/{interactions → protocol}/v1/chat.d.ts +129 -83
- package/dist/{interactions → protocol}/v1/chat.js +12 -14
- package/dist/{interactions → protocol}/v1/createTransaction.d.ts +119 -78
- package/dist/protocol/v1/createTransaction.js +58 -0
- package/dist/{interactions → protocol}/v1/feature.d.ts +8 -4
- package/dist/protocol/v1/feature.js +7 -0
- package/dist/protocol/v1/handshake.d.ts +85 -0
- package/dist/protocol/v1/handshake.js +12 -0
- package/dist/{interactions → protocol}/v1/jsonRpc.d.ts +6 -2
- package/dist/{interactions → protocol}/v1/jsonRpc.js +2 -2
- package/dist/protocol/v1/permission.d.ts +90 -0
- package/dist/protocol/v1/permission.js +18 -0
- package/dist/protocol/v1/sign.d.ts +152 -0
- package/dist/{interactions → protocol}/v1/sign.js +6 -6
- package/dist/{interactions → protocol}/v1/statementStore.d.ts +77 -20
- package/dist/{interactions → protocol}/v1/statementStore.js +6 -6
- package/dist/protocol/v1/storage.d.ts +87 -0
- package/dist/{interactions → protocol}/v1/storage.js +5 -5
- package/dist/provider.d.ts +8 -0
- package/dist/provider.js +1 -0
- package/dist/transport.d.ts +3 -0
- package/dist/transport.js +248 -0
- package/dist/types.d.ts +15 -15
- package/package.json +2 -4
- package/dist/commonEncoders.d.ts +0 -2
- package/dist/commonEncoders.js +0 -8
- package/dist/createTransport.d.ts +0 -6
- package/dist/createTransport.js +0 -183
- package/dist/createTransportEncoder.d.ts +0 -7
- package/dist/createTransportEncoder.js +0 -5
- package/dist/interactions/accounts.d.ts +0 -12
- package/dist/interactions/accounts.js +0 -40
- package/dist/interactions/commonCodecs.d.ts +0 -7
- package/dist/interactions/commonCodecs.js +0 -8
- package/dist/interactions/features.d.ts +0 -13
- package/dist/interactions/features.js +0 -13
- package/dist/interactions/handshake.d.ts +0 -2
- package/dist/interactions/handshake.js +0 -3
- package/dist/interactions/message.d.ts +0 -1704
- package/dist/interactions/message.js +0 -60
- package/dist/interactions/papiProvider.d.ts +0 -8
- package/dist/interactions/papiProvider.js +0 -10
- package/dist/interactions/sign.d.ts +0 -118
- package/dist/interactions/sign.js +0 -127
- package/dist/interactions/v1/accounts.d.ts +0 -128
- package/dist/interactions/v1/createTransaction.js +0 -41
- package/dist/interactions/v1/feature.js +0 -7
- package/dist/interactions/v1/handshake.d.ts +0 -28
- package/dist/interactions/v1/handshake.js +0 -12
- package/dist/interactions/v1/permission.d.ts +0 -48
- package/dist/interactions/v1/permission.js +0 -18
- package/dist/interactions/v1/sign.d.ts +0 -92
- package/dist/interactions/v1/storage.d.ts +0 -41
- package/dist/messageEncoder.d.ts +0 -178
- package/dist/messageEncoder.js +0 -34
- /package/dist/{interactions/types.js → protocol/commonCodecs.spec.d.ts} +0 -0
- /package/dist/{interactions → protocol}/types.d.ts +0 -0
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
export declare const SigningErr: import("scale-ts").Codec<{
|
|
2
|
-
tag: "Rejected";
|
|
3
|
-
value: undefined;
|
|
4
|
-
} | {
|
|
5
|
-
tag: "Unknown";
|
|
6
|
-
value: {
|
|
7
|
-
reason: string;
|
|
8
|
-
};
|
|
9
|
-
} | {
|
|
10
|
-
tag: "FailedToDecode";
|
|
11
|
-
value: undefined;
|
|
12
|
-
}>;
|
|
13
|
-
export declare const SigningResult: import("scale-ts").Codec<{
|
|
14
|
-
signature: `0x${string}`;
|
|
15
|
-
signedTransaction: `0x${string}` | undefined;
|
|
16
|
-
}>;
|
|
17
|
-
export declare const SignRawV1_request: import("scale-ts").Codec<{
|
|
18
|
-
address: string;
|
|
19
|
-
data: {
|
|
20
|
-
tag: "Bytes";
|
|
21
|
-
value: Uint8Array<ArrayBufferLike>;
|
|
22
|
-
} | {
|
|
23
|
-
tag: "Payload";
|
|
24
|
-
value: string;
|
|
25
|
-
};
|
|
26
|
-
}>;
|
|
27
|
-
export declare const SignRawV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
28
|
-
signature: `0x${string}`;
|
|
29
|
-
signedTransaction: `0x${string}` | undefined;
|
|
30
|
-
}, {
|
|
31
|
-
tag: "Rejected";
|
|
32
|
-
value: undefined;
|
|
33
|
-
} | {
|
|
34
|
-
tag: "Unknown";
|
|
35
|
-
value: {
|
|
36
|
-
reason: string;
|
|
37
|
-
};
|
|
38
|
-
} | {
|
|
39
|
-
tag: "FailedToDecode";
|
|
40
|
-
value: undefined;
|
|
41
|
-
}>>;
|
|
42
|
-
export declare const SigningPayload: import("scale-ts").Codec<{
|
|
43
|
-
address: string;
|
|
44
|
-
blockHash: `0x${string}`;
|
|
45
|
-
blockNumber: `0x${string}`;
|
|
46
|
-
era: `0x${string}`;
|
|
47
|
-
genesisHash: `0x${string}`;
|
|
48
|
-
method: `0x${string}`;
|
|
49
|
-
nonce: `0x${string}`;
|
|
50
|
-
specVersion: `0x${string}`;
|
|
51
|
-
tip: `0x${string}`;
|
|
52
|
-
transactionVersion: `0x${string}`;
|
|
53
|
-
signedExtensions: string[];
|
|
54
|
-
version: number;
|
|
55
|
-
assetId: `0x${string}` | undefined;
|
|
56
|
-
metadataHash: `0x${string}` | undefined;
|
|
57
|
-
mode: number | undefined;
|
|
58
|
-
withSignedTransaction: boolean | undefined;
|
|
59
|
-
}>;
|
|
60
|
-
export declare const SignPayloadV1_request: import("scale-ts").Codec<{
|
|
61
|
-
address: string;
|
|
62
|
-
blockHash: `0x${string}`;
|
|
63
|
-
blockNumber: `0x${string}`;
|
|
64
|
-
era: `0x${string}`;
|
|
65
|
-
genesisHash: `0x${string}`;
|
|
66
|
-
method: `0x${string}`;
|
|
67
|
-
nonce: `0x${string}`;
|
|
68
|
-
specVersion: `0x${string}`;
|
|
69
|
-
tip: `0x${string}`;
|
|
70
|
-
transactionVersion: `0x${string}`;
|
|
71
|
-
signedExtensions: string[];
|
|
72
|
-
version: number;
|
|
73
|
-
assetId: `0x${string}` | undefined;
|
|
74
|
-
metadataHash: `0x${string}` | undefined;
|
|
75
|
-
mode: number | undefined;
|
|
76
|
-
withSignedTransaction: boolean | undefined;
|
|
77
|
-
}>;
|
|
78
|
-
export declare const SignPayloadV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
79
|
-
signature: `0x${string}`;
|
|
80
|
-
signedTransaction: `0x${string}` | undefined;
|
|
81
|
-
}, {
|
|
82
|
-
tag: "Rejected";
|
|
83
|
-
value: undefined;
|
|
84
|
-
} | {
|
|
85
|
-
tag: "Unknown";
|
|
86
|
-
value: {
|
|
87
|
-
reason: string;
|
|
88
|
-
};
|
|
89
|
-
} | {
|
|
90
|
-
tag: "FailedToDecode";
|
|
91
|
-
value: undefined;
|
|
92
|
-
}>>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export declare const StorageErr: import("scale-ts").Codec<{
|
|
2
|
-
tag: "Unknown";
|
|
3
|
-
value: {
|
|
4
|
-
reason: string;
|
|
5
|
-
};
|
|
6
|
-
} | {
|
|
7
|
-
tag: "Full";
|
|
8
|
-
value: undefined;
|
|
9
|
-
}>;
|
|
10
|
-
export declare const StorageKey: import("scale-ts").Codec<`0x${string}`>;
|
|
11
|
-
export declare const StorageValue: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
|
|
12
|
-
export declare const StorageReadV1_request: import("scale-ts").Codec<`0x${string}`>;
|
|
13
|
-
export declare const StorageReadV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike> | undefined, {
|
|
14
|
-
tag: "Unknown";
|
|
15
|
-
value: {
|
|
16
|
-
reason: string;
|
|
17
|
-
};
|
|
18
|
-
} | {
|
|
19
|
-
tag: "Full";
|
|
20
|
-
value: undefined;
|
|
21
|
-
}>>;
|
|
22
|
-
export declare const StorageWriteV1_request: import("scale-ts").Codec<[`0x${string}`, Uint8Array<ArrayBufferLike>]>;
|
|
23
|
-
export declare const StorageWriteV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, {
|
|
24
|
-
tag: "Unknown";
|
|
25
|
-
value: {
|
|
26
|
-
reason: string;
|
|
27
|
-
};
|
|
28
|
-
} | {
|
|
29
|
-
tag: "Full";
|
|
30
|
-
value: undefined;
|
|
31
|
-
}>>;
|
|
32
|
-
export declare const StorageClearV1_request: import("scale-ts").Codec<`0x${string}`>;
|
|
33
|
-
export declare const StorageClearV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, {
|
|
34
|
-
tag: "Unknown";
|
|
35
|
-
value: {
|
|
36
|
-
reason: string;
|
|
37
|
-
};
|
|
38
|
-
} | {
|
|
39
|
-
tag: "Full";
|
|
40
|
-
value: undefined;
|
|
41
|
-
}>>;
|
package/dist/messageEncoder.d.ts
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import type { CodecType, ResultPayload } from 'scale-ts';
|
|
2
|
-
export declare function unwrapResultOrThrow<Ok, Err>(response: ResultPayload<Ok, Err>, toError: (e: Err) => Error): Ok;
|
|
3
|
-
export type MessagePayloadSchema = CodecType<typeof messagePayloadEncoder>;
|
|
4
|
-
export declare const messagePayloadEncoder: import("scale-ts").Codec<{
|
|
5
|
-
tag: "handshakeRequestV1";
|
|
6
|
-
value: undefined;
|
|
7
|
-
} | {
|
|
8
|
-
tag: "handshakeResponseV1";
|
|
9
|
-
value: ResultPayload<undefined, string>;
|
|
10
|
-
} | {
|
|
11
|
-
tag: "getAccountsRequestV1";
|
|
12
|
-
value: undefined;
|
|
13
|
-
} | {
|
|
14
|
-
tag: "getAccountsResponseV1";
|
|
15
|
-
value: ResultPayload<import("@polkadot-api/pjs-signer").InjectedAccount[], string>;
|
|
16
|
-
} | {
|
|
17
|
-
tag: "accountSubscriptionV1";
|
|
18
|
-
value: undefined;
|
|
19
|
-
} | {
|
|
20
|
-
tag: "accountUnsubscriptionV1";
|
|
21
|
-
value: undefined;
|
|
22
|
-
} | {
|
|
23
|
-
tag: "supportFeatureRequestV1";
|
|
24
|
-
value: {
|
|
25
|
-
tag: "chain";
|
|
26
|
-
value: {
|
|
27
|
-
genesisHash: `0x${string}`;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
} | {
|
|
31
|
-
tag: "supportFeatureResponseV1";
|
|
32
|
-
value: ResultPayload<{
|
|
33
|
-
tag: "chain";
|
|
34
|
-
value: {
|
|
35
|
-
genesisHash: `0x${string}`;
|
|
36
|
-
result: boolean;
|
|
37
|
-
};
|
|
38
|
-
}, string>;
|
|
39
|
-
} | {
|
|
40
|
-
tag: "papiProviderSendMessageV1";
|
|
41
|
-
value: {
|
|
42
|
-
genesisHash: `0x${string}`;
|
|
43
|
-
message: string;
|
|
44
|
-
};
|
|
45
|
-
} | {
|
|
46
|
-
tag: "papiProviderReceiveMessageV1";
|
|
47
|
-
value: ResultPayload<{
|
|
48
|
-
genesisHash: `0x${string}`;
|
|
49
|
-
message: string;
|
|
50
|
-
}, string>;
|
|
51
|
-
} | {
|
|
52
|
-
tag: "signRawRequestV1";
|
|
53
|
-
value: import("@polkadot/types/types").SignerPayloadRaw;
|
|
54
|
-
} | {
|
|
55
|
-
tag: "signPayloadRequestV1";
|
|
56
|
-
value: {
|
|
57
|
-
address: string;
|
|
58
|
-
blockHash: `0x${string}`;
|
|
59
|
-
blockNumber: `0x${string}`;
|
|
60
|
-
era: `0x${string}`;
|
|
61
|
-
genesisHash: `0x${string}`;
|
|
62
|
-
method: string;
|
|
63
|
-
nonce: `0x${string}`;
|
|
64
|
-
specVersion: `0x${string}`;
|
|
65
|
-
tip: `0x${string}`;
|
|
66
|
-
transactionVersion: `0x${string}`;
|
|
67
|
-
signedExtensions: string[];
|
|
68
|
-
version: number;
|
|
69
|
-
assetId: `0x${string}` | undefined;
|
|
70
|
-
metadataHash: `0x${string}` | undefined;
|
|
71
|
-
mode: number | undefined;
|
|
72
|
-
withSignedTransaction: boolean | undefined;
|
|
73
|
-
};
|
|
74
|
-
} | {
|
|
75
|
-
tag: "signResponseV1";
|
|
76
|
-
value: ResultPayload<import("@polkadot/types/types").SignerResult, string>;
|
|
77
|
-
} | {
|
|
78
|
-
tag: "createTransactionRequestV1";
|
|
79
|
-
value: import("./interactions/sign.js").TxPayloadV1;
|
|
80
|
-
} | {
|
|
81
|
-
tag: "createTransactionResponseV1";
|
|
82
|
-
value: ResultPayload<`0x${string}`, string>;
|
|
83
|
-
} | {
|
|
84
|
-
tag: "locationChangedV1";
|
|
85
|
-
value: string;
|
|
86
|
-
}>;
|
|
87
|
-
export type MessageSchema = CodecType<typeof messageEncoder>;
|
|
88
|
-
export declare const messageEncoder: import("scale-ts").Codec<{
|
|
89
|
-
id: string;
|
|
90
|
-
payload: {
|
|
91
|
-
tag: "handshakeRequestV1";
|
|
92
|
-
value: undefined;
|
|
93
|
-
} | {
|
|
94
|
-
tag: "handshakeResponseV1";
|
|
95
|
-
value: ResultPayload<undefined, string>;
|
|
96
|
-
} | {
|
|
97
|
-
tag: "getAccountsRequestV1";
|
|
98
|
-
value: undefined;
|
|
99
|
-
} | {
|
|
100
|
-
tag: "getAccountsResponseV1";
|
|
101
|
-
value: ResultPayload<import("@polkadot-api/pjs-signer").InjectedAccount[], string>;
|
|
102
|
-
} | {
|
|
103
|
-
tag: "accountSubscriptionV1";
|
|
104
|
-
value: undefined;
|
|
105
|
-
} | {
|
|
106
|
-
tag: "accountUnsubscriptionV1";
|
|
107
|
-
value: undefined;
|
|
108
|
-
} | {
|
|
109
|
-
tag: "supportFeatureRequestV1";
|
|
110
|
-
value: {
|
|
111
|
-
tag: "chain";
|
|
112
|
-
value: {
|
|
113
|
-
genesisHash: `0x${string}`;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
} | {
|
|
117
|
-
tag: "supportFeatureResponseV1";
|
|
118
|
-
value: ResultPayload<{
|
|
119
|
-
tag: "chain";
|
|
120
|
-
value: {
|
|
121
|
-
genesisHash: `0x${string}`;
|
|
122
|
-
result: boolean;
|
|
123
|
-
};
|
|
124
|
-
}, string>;
|
|
125
|
-
} | {
|
|
126
|
-
tag: "papiProviderSendMessageV1";
|
|
127
|
-
value: {
|
|
128
|
-
genesisHash: `0x${string}`;
|
|
129
|
-
message: string;
|
|
130
|
-
};
|
|
131
|
-
} | {
|
|
132
|
-
tag: "papiProviderReceiveMessageV1";
|
|
133
|
-
value: ResultPayload<{
|
|
134
|
-
genesisHash: `0x${string}`;
|
|
135
|
-
message: string;
|
|
136
|
-
}, string>;
|
|
137
|
-
} | {
|
|
138
|
-
tag: "signRawRequestV1";
|
|
139
|
-
value: import("@polkadot/types/types").SignerPayloadRaw;
|
|
140
|
-
} | {
|
|
141
|
-
tag: "signPayloadRequestV1";
|
|
142
|
-
value: {
|
|
143
|
-
address: string;
|
|
144
|
-
blockHash: `0x${string}`;
|
|
145
|
-
blockNumber: `0x${string}`;
|
|
146
|
-
era: `0x${string}`;
|
|
147
|
-
genesisHash: `0x${string}`;
|
|
148
|
-
method: string;
|
|
149
|
-
nonce: `0x${string}`;
|
|
150
|
-
specVersion: `0x${string}`;
|
|
151
|
-
tip: `0x${string}`;
|
|
152
|
-
transactionVersion: `0x${string}`;
|
|
153
|
-
signedExtensions: string[];
|
|
154
|
-
version: number;
|
|
155
|
-
assetId: `0x${string}` | undefined;
|
|
156
|
-
metadataHash: `0x${string}` | undefined;
|
|
157
|
-
mode: number | undefined;
|
|
158
|
-
withSignedTransaction: boolean | undefined;
|
|
159
|
-
};
|
|
160
|
-
} | {
|
|
161
|
-
tag: "signResponseV1";
|
|
162
|
-
value: ResultPayload<import("@polkadot/types/types").SignerResult, string>;
|
|
163
|
-
} | {
|
|
164
|
-
tag: "createTransactionRequestV1";
|
|
165
|
-
value: import("./interactions/sign.js").TxPayloadV1;
|
|
166
|
-
} | {
|
|
167
|
-
tag: "createTransactionResponseV1";
|
|
168
|
-
value: ResultPayload<`0x${string}`, string>;
|
|
169
|
-
} | {
|
|
170
|
-
tag: "locationChangedV1";
|
|
171
|
-
value: string;
|
|
172
|
-
};
|
|
173
|
-
}>;
|
|
174
|
-
export type MessageType = MessagePayloadSchema['tag'];
|
|
175
|
-
export type PickMessagePayload<T extends MessageType> = Extract<MessagePayloadSchema, {
|
|
176
|
-
tag: T;
|
|
177
|
-
}>;
|
|
178
|
-
export type PickMessagePayloadValue<T extends MessageType> = PickMessagePayload<T>['value'];
|
package/dist/messageEncoder.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Enum, Result, Struct, str } from 'scale-ts';
|
|
2
|
-
import { accountSubscriptionV1Encoder, accountUnsubscriptionV1Encoder, getAccountsRequestV1Encoder, getAccountsResponseV1Encoder, } from './interactions/accounts.js';
|
|
3
|
-
import { supportFeatureRequestV1Encoder, supportFeatureResponseV1 } from './interactions/features.js';
|
|
4
|
-
import { handshakeRequestV1Encoder, handshakeResponseV1Encoder } from './interactions/handshake.js';
|
|
5
|
-
import { papiProviderReceiveMessageV1Encoder, papiProviderSendMessageV1Encoder } from './interactions/papiProvider.js';
|
|
6
|
-
import { createTransactionRequestV1Encoder, createTransactionResponseV1Encoder, signPayloadRequestV1Encoder, signRawRequestV1Encoder, signResponseV1Encoder, } from './interactions/sign.js';
|
|
7
|
-
export function unwrapResultOrThrow(response, toError) {
|
|
8
|
-
if (response.success) {
|
|
9
|
-
return response.value;
|
|
10
|
-
}
|
|
11
|
-
throw toError(response.value);
|
|
12
|
-
}
|
|
13
|
-
export const messagePayloadEncoder = Enum({
|
|
14
|
-
handshakeRequestV1: handshakeRequestV1Encoder,
|
|
15
|
-
handshakeResponseV1: Result(handshakeResponseV1Encoder, str),
|
|
16
|
-
getAccountsRequestV1: getAccountsRequestV1Encoder,
|
|
17
|
-
getAccountsResponseV1: Result(getAccountsResponseV1Encoder, str),
|
|
18
|
-
accountSubscriptionV1: accountSubscriptionV1Encoder,
|
|
19
|
-
accountUnsubscriptionV1: accountUnsubscriptionV1Encoder,
|
|
20
|
-
supportFeatureRequestV1: supportFeatureRequestV1Encoder,
|
|
21
|
-
supportFeatureResponseV1: Result(supportFeatureResponseV1, str),
|
|
22
|
-
papiProviderSendMessageV1: papiProviderSendMessageV1Encoder,
|
|
23
|
-
papiProviderReceiveMessageV1: Result(papiProviderReceiveMessageV1Encoder, str),
|
|
24
|
-
signRawRequestV1: signRawRequestV1Encoder,
|
|
25
|
-
signPayloadRequestV1: signPayloadRequestV1Encoder,
|
|
26
|
-
signResponseV1: Result(signResponseV1Encoder, str),
|
|
27
|
-
createTransactionRequestV1: createTransactionRequestV1Encoder,
|
|
28
|
-
createTransactionResponseV1: Result(createTransactionResponseV1Encoder, str),
|
|
29
|
-
locationChangedV1: str,
|
|
30
|
-
});
|
|
31
|
-
export const messageEncoder = Struct({
|
|
32
|
-
id: str,
|
|
33
|
-
payload: messagePayloadEncoder,
|
|
34
|
-
});
|
|
File without changes
|
|
File without changes
|