@novasamatech/host-api 0.7.1-1 → 0.7.1
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/hostApi.d.ts +1 -1
- package/dist/protocol/impl.d.ts +52 -17
- package/dist/protocol/impl.js +24 -19
- package/dist/protocol/messageCodec.d.ts +118 -27
- package/dist/protocol/messageCodec.js +1 -1
- package/dist/protocol/v1/accounts.d.ts +1 -0
- package/dist/protocol/v1/accounts.js +1 -0
- package/dist/protocol/v1/chainInteraction.d.ts +1 -0
- package/dist/protocol/v1/chainInteraction.js +1 -0
- package/dist/protocol/v1/chat.d.ts +3 -0
- package/dist/protocol/v1/chat.js +3 -0
- package/dist/protocol/v1/jsonRpc.d.ts +1 -0
- package/dist/protocol/v1/jsonRpc.js +1 -0
- package/dist/protocol/v1/payments.d.ts +34 -0
- package/dist/protocol/v1/payments.js +2 -0
- package/dist/protocol/v1/preimage.d.ts +1 -0
- package/dist/protocol/v1/preimage.js +2 -1
- package/dist/protocol/v1/remotePermission.d.ts +2 -2
- package/dist/protocol/v1/remotePermission.js +1 -1
- package/dist/protocol/v1/statementStore.d.ts +1 -0
- package/dist/protocol/v1/statementStore.js +1 -0
- package/dist/protocol/v1/theme.d.ts +1 -0
- package/dist/protocol/v1/theme.js +1 -0
- package/dist/transport.js +4 -4
- package/dist/types.d.ts +5 -4
- package/package.json +2 -2
package/dist/hostApi.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ type ErrorResponse<T> = T extends {
|
|
|
24
24
|
value: infer U;
|
|
25
25
|
} ? U : never;
|
|
26
26
|
type InferRequestMethod<Method extends VersionedProtocolRequest> = (args: Value<Method['request']>) => UnwrapVersionedResult<Value<Method['response']>>;
|
|
27
|
-
type InferSubscribeMethod<Method extends VersionedProtocolSubscription> = (args: Value<Method['start']>, callback: (payload: Value<Method['receive']>) => void) => Subscription
|
|
27
|
+
type InferSubscribeMethod<Method extends VersionedProtocolSubscription> = (args: Value<Method['start']>, callback: (payload: Value<Method['receive']>) => void) => Subscription<Value<Method['interrupt']>>;
|
|
28
28
|
type InferMethod<Method extends VersionedProtocolRequest | VersionedProtocolSubscription> = Method extends VersionedProtocolRequest ? InferRequestMethod<Method> : Method extends VersionedProtocolSubscription ? InferSubscribeMethod<Method> : never;
|
|
29
29
|
export type HostApi = {
|
|
30
30
|
[K in keyof HostApiProtocol as SnakeToCamelCase<StripNamespace<K>>]: InferMethod<HostApiProtocol[K]>;
|
package/dist/protocol/impl.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import type { EnumCodec } from '@novasamatech/scale';
|
|
2
2
|
import type { Codec } from 'scale-ts';
|
|
3
|
-
export type
|
|
4
|
-
type
|
|
3
|
+
export type VersionedRequestArguments = Record<string, [Codec<any>, Codec<any>]>;
|
|
4
|
+
export type VersionedSubscriptionArguments = Record<string, [Codec<any>, Codec<any>, Codec<any>]>;
|
|
5
|
+
export type VersionedArguments = VersionedRequestArguments;
|
|
6
|
+
type InferVersionedArgument<EnumValues extends Record<string, Codec<any>[]>, N extends number> = {
|
|
5
7
|
[V in keyof EnumValues]: EnumValues[V][N];
|
|
6
8
|
};
|
|
7
|
-
export type VersionedProtocolRequest<T extends
|
|
9
|
+
export type VersionedProtocolRequest<T extends VersionedRequestArguments = VersionedRequestArguments> = {
|
|
8
10
|
method: 'request';
|
|
9
11
|
request: EnumCodec<InferVersionedArgument<T, 0>>;
|
|
10
12
|
response: EnumCodec<InferVersionedArgument<T, 1>>;
|
|
11
13
|
};
|
|
12
|
-
export type VersionedProtocolSubscription<T extends
|
|
14
|
+
export type VersionedProtocolSubscription<T extends VersionedSubscriptionArguments = VersionedSubscriptionArguments> = {
|
|
13
15
|
method: 'subscribe';
|
|
14
16
|
start: EnumCodec<InferVersionedArgument<T, 0>>;
|
|
15
17
|
receive: EnumCodec<InferVersionedArgument<T, 1>>;
|
|
18
|
+
interrupt: EnumCodec<InferVersionedArgument<T, 2>>;
|
|
16
19
|
};
|
|
17
20
|
export type HostApiProtocol = typeof hostApiProtocol;
|
|
18
21
|
export declare const hostApiProtocol: {
|
|
@@ -38,7 +41,7 @@ export declare const hostApiProtocol: {
|
|
|
38
41
|
}, "GenericError">>>];
|
|
39
42
|
}>;
|
|
40
43
|
readonly host_theme_subscribe: VersionedProtocolSubscription<{
|
|
41
|
-
readonly v1: [Codec<undefined>, Codec<"light" | "dark">];
|
|
44
|
+
readonly v1: [Codec<undefined>, Codec<"light" | "dark">, Codec<undefined>];
|
|
42
45
|
}>;
|
|
43
46
|
readonly host_navigate_to: VersionedProtocolRequest<{
|
|
44
47
|
readonly v1: [Codec<string>, Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
|
|
@@ -56,7 +59,7 @@ export declare const hostApiProtocol: {
|
|
|
56
59
|
}, "GenericError">>>];
|
|
57
60
|
}>;
|
|
58
61
|
readonly remote_permission: VersionedProtocolRequest<{
|
|
59
|
-
readonly v1: [Codec<
|
|
62
|
+
readonly v1: [Codec<{
|
|
60
63
|
tag: "Remote";
|
|
61
64
|
value: string[];
|
|
62
65
|
} | {
|
|
@@ -71,7 +74,7 @@ export declare const hostApiProtocol: {
|
|
|
71
74
|
} | {
|
|
72
75
|
tag: "StatementSubmit";
|
|
73
76
|
value: undefined;
|
|
74
|
-
}
|
|
77
|
+
}>, Codec<import("scale-ts").ResultPayload<boolean, import("@novasamatech/scale").CodecError<{
|
|
75
78
|
reason: string;
|
|
76
79
|
}, "GenericError">>>];
|
|
77
80
|
}>;
|
|
@@ -104,7 +107,7 @@ export declare const hostApiProtocol: {
|
|
|
104
107
|
}, "LoginErr::Unknown">>>];
|
|
105
108
|
}>;
|
|
106
109
|
readonly host_account_connection_status_subscribe: VersionedProtocolSubscription<{
|
|
107
|
-
readonly v1: [Codec<undefined>, Codec<"disconnected" | "connected">];
|
|
110
|
+
readonly v1: [Codec<undefined>, Codec<"disconnected" | "connected">, Codec<undefined>];
|
|
108
111
|
}>;
|
|
109
112
|
readonly host_account_get: VersionedProtocolRequest<{
|
|
110
113
|
readonly v1: [Codec<[string, number]>, Codec<import("scale-ts").ResultPayload<{
|
|
@@ -265,7 +268,7 @@ export declare const hostApiProtocol: {
|
|
|
265
268
|
readonly v1: [Codec<undefined>, Codec<{
|
|
266
269
|
roomId: string;
|
|
267
270
|
participatingAs: "RoomHost" | "Bot";
|
|
268
|
-
}[]>];
|
|
271
|
+
}[]>, Codec<undefined>];
|
|
269
272
|
}>;
|
|
270
273
|
readonly host_chat_post_message: VersionedProtocolRequest<{
|
|
271
274
|
readonly v1: [Codec<{
|
|
@@ -394,14 +397,14 @@ export declare const hostApiProtocol: {
|
|
|
394
397
|
payload: string;
|
|
395
398
|
};
|
|
396
399
|
};
|
|
397
|
-
}>];
|
|
400
|
+
}>, Codec<undefined>];
|
|
398
401
|
}>;
|
|
399
402
|
readonly product_chat_custom_message_render_subscribe: VersionedProtocolSubscription<{
|
|
400
403
|
readonly v1: [Codec<{
|
|
401
404
|
messageId: string;
|
|
402
405
|
messageType: string;
|
|
403
406
|
payload: Uint8Array<ArrayBufferLike>;
|
|
404
|
-
}>, Codec<import("./v1/customRenderer.js").CustomRendererNodeType>];
|
|
407
|
+
}>, Codec<import("./v1/customRenderer.js").CustomRendererNodeType>, Codec<undefined>];
|
|
405
408
|
}>;
|
|
406
409
|
readonly remote_statement_store_subscribe: VersionedProtocolSubscription<{
|
|
407
410
|
readonly v1: [Codec<{
|
|
@@ -445,7 +448,7 @@ export declare const hostApiProtocol: {
|
|
|
445
448
|
data: Uint8Array<ArrayBufferLike> | undefined;
|
|
446
449
|
}[];
|
|
447
450
|
isComplete: boolean;
|
|
448
|
-
}>];
|
|
451
|
+
}>, Codec<undefined>];
|
|
449
452
|
}>;
|
|
450
453
|
readonly remote_statement_store_create_proof: VersionedProtocolRequest<{
|
|
451
454
|
readonly v1: [Codec<[[string, number], {
|
|
@@ -547,7 +550,7 @@ export declare const hostApiProtocol: {
|
|
|
547
550
|
}, "GenericError">>>];
|
|
548
551
|
}>;
|
|
549
552
|
readonly remote_preimage_lookup_subscribe: VersionedProtocolSubscription<{
|
|
550
|
-
readonly v1: [Codec<`0x${string}`>, Codec<Uint8Array<ArrayBufferLike> | null>];
|
|
553
|
+
readonly v1: [Codec<`0x${string}`>, Codec<Uint8Array<ArrayBufferLike> | null>, Codec<undefined>];
|
|
551
554
|
}>;
|
|
552
555
|
readonly remote_preimage_submit: VersionedProtocolRequest<{
|
|
553
556
|
readonly v1: [Codec<Uint8Array<ArrayBufferLike>>, Codec<import("scale-ts").ResultPayload<`0x${string}`, import("@novasamatech/scale").CodecError<{
|
|
@@ -557,7 +560,23 @@ export declare const hostApiProtocol: {
|
|
|
557
560
|
readonly host_payment_balance_subscribe: VersionedProtocolSubscription<{
|
|
558
561
|
readonly v1: [Codec<undefined>, Codec<{
|
|
559
562
|
available: bigint;
|
|
560
|
-
}
|
|
563
|
+
}>, [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
564
|
+
reason: string;
|
|
565
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
566
|
+
reason: string;
|
|
567
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>] & {
|
|
568
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
569
|
+
reason: string;
|
|
570
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>;
|
|
571
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
572
|
+
reason: string;
|
|
573
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>;
|
|
574
|
+
} & {
|
|
575
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "PaymentBalanceErr::PermissionDenied">;
|
|
576
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
577
|
+
reason: string;
|
|
578
|
+
}, "PaymentBalanceErr::Unknown">;
|
|
579
|
+
}];
|
|
561
580
|
}>;
|
|
562
581
|
readonly host_payment_top_up: VersionedProtocolRequest<{
|
|
563
582
|
readonly v1: [Codec<{
|
|
@@ -593,7 +612,23 @@ export declare const hostApiProtocol: {
|
|
|
593
612
|
} | {
|
|
594
613
|
tag: "Failed";
|
|
595
614
|
value: string;
|
|
596
|
-
}
|
|
615
|
+
}>, [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
616
|
+
reason: string;
|
|
617
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
618
|
+
reason: string;
|
|
619
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>] & {
|
|
620
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
621
|
+
reason: string;
|
|
622
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>;
|
|
623
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
624
|
+
reason: string;
|
|
625
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>;
|
|
626
|
+
} & {
|
|
627
|
+
readonly PaymentNotFound: import("@novasamatech/scale").ErrCodec<undefined, "PaymentStatusErr::PaymentNotFound">;
|
|
628
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
629
|
+
reason: string;
|
|
630
|
+
}, "PaymentStatusErr::Unknown">;
|
|
631
|
+
}];
|
|
597
632
|
}>;
|
|
598
633
|
readonly host_jsonrpc_message_send: VersionedProtocolRequest<{
|
|
599
634
|
readonly v1: [Codec<[`0x${string}`, string]>, Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
|
|
@@ -601,7 +636,7 @@ export declare const hostApiProtocol: {
|
|
|
601
636
|
}, "GenericError">>>];
|
|
602
637
|
}>;
|
|
603
638
|
readonly host_jsonrpc_message_subscribe: VersionedProtocolSubscription<{
|
|
604
|
-
readonly v1: [Codec<`0x${string}`>, Codec<string>];
|
|
639
|
+
readonly v1: [Codec<`0x${string}`>, Codec<string>, Codec<undefined>];
|
|
605
640
|
}>;
|
|
606
641
|
readonly remote_chain_head_follow: VersionedProtocolSubscription<{
|
|
607
642
|
readonly v1: [Codec<{
|
|
@@ -708,7 +743,7 @@ export declare const hostApiProtocol: {
|
|
|
708
743
|
} | {
|
|
709
744
|
tag: "Stop";
|
|
710
745
|
value: undefined;
|
|
711
|
-
}>];
|
|
746
|
+
}>, Codec<undefined>];
|
|
712
747
|
}>;
|
|
713
748
|
readonly remote_chain_head_header: VersionedProtocolRequest<{
|
|
714
749
|
readonly v1: [Codec<{
|
package/dist/protocol/impl.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { Enum } from '@novasamatech/scale';
|
|
2
|
-
import { AccountConnectionStatusV1_receive, AccountConnectionStatusV1_start, AccountCreateProofV1_request, AccountCreateProofV1_response, AccountGetAliasV1_request, AccountGetAliasV1_response, AccountGetRootV1_request, AccountGetRootV1_response, AccountGetV1_request, AccountGetV1_response, GetLegacyAccountsV1_request, GetLegacyAccountsV1_response, RequestLoginV1_request, RequestLoginV1_response, } from './v1/accounts.js';
|
|
3
|
-
import { ChainHeadBodyV1_request, ChainHeadBodyV1_response, ChainHeadCallV1_request, ChainHeadCallV1_response, ChainHeadContinueV1_request, ChainHeadContinueV1_response, ChainHeadFollowV1_receive, ChainHeadFollowV1_start, ChainHeadHeaderV1_request, ChainHeadHeaderV1_response, ChainHeadStopOperationV1_request, ChainHeadStopOperationV1_response, ChainHeadStorageV1_request, ChainHeadStorageV1_response, ChainHeadUnpinV1_request, ChainHeadUnpinV1_response, ChainSpecChainNameV1_request, ChainSpecChainNameV1_response, ChainSpecGenesisHashV1_request, ChainSpecGenesisHashV1_response, ChainSpecPropertiesV1_request, ChainSpecPropertiesV1_response, TransactionBroadcastV1_request, TransactionBroadcastV1_response, TransactionStopV1_request, TransactionStopV1_response, } from './v1/chainInteraction.js';
|
|
4
|
-
import { ChatActionSubscribeV1_receive, ChatActionSubscribeV1_start, ChatCreateRoomV1_request, ChatCreateRoomV1_response, ChatCustomMessageRenderingV1_receive, ChatCustomMessageRenderingV1_start, ChatListSubscribeV1_receive, ChatListSubscribeV1_start, ChatPostMessageV1_request, ChatPostMessageV1_response, ChatRegisterBotV1_request, ChatRegisterBotV1_response, } from './v1/chat.js';
|
|
2
|
+
import { AccountConnectionStatusV1_interrupt, AccountConnectionStatusV1_receive, AccountConnectionStatusV1_start, AccountCreateProofV1_request, AccountCreateProofV1_response, AccountGetAliasV1_request, AccountGetAliasV1_response, AccountGetRootV1_request, AccountGetRootV1_response, AccountGetV1_request, AccountGetV1_response, GetLegacyAccountsV1_request, GetLegacyAccountsV1_response, RequestLoginV1_request, RequestLoginV1_response, } from './v1/accounts.js';
|
|
3
|
+
import { ChainHeadBodyV1_request, ChainHeadBodyV1_response, ChainHeadCallV1_request, ChainHeadCallV1_response, ChainHeadContinueV1_request, ChainHeadContinueV1_response, ChainHeadFollowV1_interrupt, ChainHeadFollowV1_receive, ChainHeadFollowV1_start, ChainHeadHeaderV1_request, ChainHeadHeaderV1_response, ChainHeadStopOperationV1_request, ChainHeadStopOperationV1_response, ChainHeadStorageV1_request, ChainHeadStorageV1_response, ChainHeadUnpinV1_request, ChainHeadUnpinV1_response, ChainSpecChainNameV1_request, ChainSpecChainNameV1_response, ChainSpecGenesisHashV1_request, ChainSpecGenesisHashV1_response, ChainSpecPropertiesV1_request, ChainSpecPropertiesV1_response, TransactionBroadcastV1_request, TransactionBroadcastV1_response, TransactionStopV1_request, TransactionStopV1_response, } from './v1/chainInteraction.js';
|
|
4
|
+
import { ChatActionSubscribeV1_interrupt, ChatActionSubscribeV1_receive, ChatActionSubscribeV1_start, ChatCreateRoomV1_request, ChatCreateRoomV1_response, ChatCustomMessageRenderingV1_interrupt, ChatCustomMessageRenderingV1_receive, ChatCustomMessageRenderingV1_start, ChatListSubscribeV1_interrupt, ChatListSubscribeV1_receive, ChatListSubscribeV1_start, ChatPostMessageV1_request, ChatPostMessageV1_response, ChatRegisterBotV1_request, ChatRegisterBotV1_response, } from './v1/chat.js';
|
|
5
5
|
import { CreateTransactionV1_request, CreateTransactionV1_response, CreateTransactionWithLegacyAccountV1_request, CreateTransactionWithLegacyAccountV1_response, } from './v1/createTransaction.js';
|
|
6
6
|
import { DeriveEntropyV1_request, DeriveEntropyV1_response } from './v1/deriveEntropy.js';
|
|
7
7
|
import { DevicePermissionV1_request, DevicePermissionV1_response } from './v1/devicePermission.js';
|
|
8
8
|
import { FeatureV1_request, FeatureV1_response } from './v1/feature.js';
|
|
9
9
|
import { HandshakeV1_request, HandshakeV1_response } from './v1/handshake.js';
|
|
10
|
-
import { JsonRpcMessageSendV1_request, JsonRpcMessageSendV1_response, JsonRpcMessageSubscribeV1_receive, JsonRpcMessageSubscribeV1_start, } from './v1/jsonRpc.js';
|
|
10
|
+
import { JsonRpcMessageSendV1_request, JsonRpcMessageSendV1_response, JsonRpcMessageSubscribeV1_interrupt, JsonRpcMessageSubscribeV1_receive, JsonRpcMessageSubscribeV1_start, } from './v1/jsonRpc.js';
|
|
11
11
|
import { StorageClearV1_request, StorageClearV1_response, StorageReadV1_request, StorageReadV1_response, StorageWriteV1_request, StorageWriteV1_response, } from './v1/localStorage.js';
|
|
12
12
|
import { NavigateToV1_request, NavigateToV1_response } from './v1/navigation.js';
|
|
13
13
|
import { PushNotificationV1_request, PushNotificationV1_response } from './v1/notification.js';
|
|
14
|
-
import { PaymentBalanceSubscribeV1_receive, PaymentBalanceSubscribeV1_start, PaymentRequestV1_request, PaymentRequestV1_response, PaymentStatusSubscribeV1_receive, PaymentStatusSubscribeV1_start, PaymentTopUpV1_request, PaymentTopUpV1_response, } from './v1/payments.js';
|
|
15
|
-
import { PreimageLookupSubscribeV1_receive, PreimageLookupSubscribeV1_start, PreimageSubmitV1_request, PreimageSubmitV1_response, } from './v1/preimage.js';
|
|
14
|
+
import { PaymentBalanceSubscribeV1_interrupt, PaymentBalanceSubscribeV1_receive, PaymentBalanceSubscribeV1_start, PaymentRequestV1_request, PaymentRequestV1_response, PaymentStatusSubscribeV1_interrupt, PaymentStatusSubscribeV1_receive, PaymentStatusSubscribeV1_start, PaymentTopUpV1_request, PaymentTopUpV1_response, } from './v1/payments.js';
|
|
15
|
+
import { PreimageLookupSubscribeV1_interrupt, PreimageLookupSubscribeV1_receive, PreimageLookupSubscribeV1_start, PreimageSubmitV1_request, PreimageSubmitV1_response, } from './v1/preimage.js';
|
|
16
16
|
import { RemotePermissionV1_request, RemotePermissionV1_response } from './v1/remotePermission.js';
|
|
17
17
|
import { SignPayloadV1_request, SignPayloadV1_response, SignPayloadWithLegacyAccountV1_request, SignPayloadWithLegacyAccountV1_response, SignRawV1_request, SignRawV1_response, SignRawWithLegacyAccountV1_request, SignRawWithLegacyAccountV1_response, } from './v1/sign.js';
|
|
18
|
-
import { StatementStoreCreateProofV1_request, StatementStoreCreateProofV1_response, StatementStoreSubmitV1_request, StatementStoreSubmitV1_response, StatementStoreSubscribeV1_receive, StatementStoreSubscribeV1_start, } from './v1/statementStore.js';
|
|
19
|
-
import { ThemeSubscribeV1_receive, ThemeSubscribeV1_start } from './v1/theme.js';
|
|
18
|
+
import { StatementStoreCreateProofV1_request, StatementStoreCreateProofV1_response, StatementStoreSubmitV1_request, StatementStoreSubmitV1_response, StatementStoreSubscribeV1_interrupt, StatementStoreSubscribeV1_receive, StatementStoreSubscribeV1_start, } from './v1/statementStore.js';
|
|
19
|
+
import { ThemeSubscribeV1_interrupt, ThemeSubscribeV1_receive, ThemeSubscribeV1_start } from './v1/theme.js';
|
|
20
20
|
const enumFromArg = (enumValues, n) => {
|
|
21
21
|
return Enum(Object.fromEntries(Object.entries(enumValues).map(([key, value]) => [key, value[n]])));
|
|
22
22
|
};
|
|
@@ -32,6 +32,7 @@ const versionedSubscription = (values) => {
|
|
|
32
32
|
method: 'subscribe',
|
|
33
33
|
start: enumFromArg(values, 0),
|
|
34
34
|
receive: enumFromArg(values, 1),
|
|
35
|
+
interrupt: enumFromArg(values, 2),
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
export const hostApiProtocol = {
|
|
@@ -46,7 +47,7 @@ export const hostApiProtocol = {
|
|
|
46
47
|
v1: [PushNotificationV1_request, PushNotificationV1_response],
|
|
47
48
|
}),
|
|
48
49
|
host_theme_subscribe: versionedSubscription({
|
|
49
|
-
v1: [ThemeSubscribeV1_start, ThemeSubscribeV1_receive],
|
|
50
|
+
v1: [ThemeSubscribeV1_start, ThemeSubscribeV1_receive, ThemeSubscribeV1_interrupt],
|
|
50
51
|
}),
|
|
51
52
|
host_navigate_to: versionedRequest({
|
|
52
53
|
v1: [NavigateToV1_request, NavigateToV1_response],
|
|
@@ -79,7 +80,7 @@ export const hostApiProtocol = {
|
|
|
79
80
|
v1: [RequestLoginV1_request, RequestLoginV1_response],
|
|
80
81
|
}),
|
|
81
82
|
host_account_connection_status_subscribe: versionedSubscription({
|
|
82
|
-
v1: [AccountConnectionStatusV1_start, AccountConnectionStatusV1_receive],
|
|
83
|
+
v1: [AccountConnectionStatusV1_start, AccountConnectionStatusV1_receive, AccountConnectionStatusV1_interrupt],
|
|
83
84
|
}),
|
|
84
85
|
host_account_get: versionedRequest({
|
|
85
86
|
v1: [AccountGetV1_request, AccountGetV1_response],
|
|
@@ -120,20 +121,24 @@ export const hostApiProtocol = {
|
|
|
120
121
|
v1: [ChatRegisterBotV1_request, ChatRegisterBotV1_response],
|
|
121
122
|
}),
|
|
122
123
|
host_chat_list_subscribe: versionedSubscription({
|
|
123
|
-
v1: [ChatListSubscribeV1_start, ChatListSubscribeV1_receive],
|
|
124
|
+
v1: [ChatListSubscribeV1_start, ChatListSubscribeV1_receive, ChatListSubscribeV1_interrupt],
|
|
124
125
|
}),
|
|
125
126
|
host_chat_post_message: versionedRequest({
|
|
126
127
|
v1: [ChatPostMessageV1_request, ChatPostMessageV1_response],
|
|
127
128
|
}),
|
|
128
129
|
host_chat_action_subscribe: versionedSubscription({
|
|
129
|
-
v1: [ChatActionSubscribeV1_start, ChatActionSubscribeV1_receive],
|
|
130
|
+
v1: [ChatActionSubscribeV1_start, ChatActionSubscribeV1_receive, ChatActionSubscribeV1_interrupt],
|
|
130
131
|
}),
|
|
131
132
|
product_chat_custom_message_render_subscribe: versionedSubscription({
|
|
132
|
-
v1: [
|
|
133
|
+
v1: [
|
|
134
|
+
ChatCustomMessageRenderingV1_start,
|
|
135
|
+
ChatCustomMessageRenderingV1_receive,
|
|
136
|
+
ChatCustomMessageRenderingV1_interrupt,
|
|
137
|
+
],
|
|
133
138
|
}),
|
|
134
139
|
// Statement store (remote namespace)
|
|
135
140
|
remote_statement_store_subscribe: versionedSubscription({
|
|
136
|
-
v1: [StatementStoreSubscribeV1_start, StatementStoreSubscribeV1_receive],
|
|
141
|
+
v1: [StatementStoreSubscribeV1_start, StatementStoreSubscribeV1_receive, StatementStoreSubscribeV1_interrupt],
|
|
137
142
|
}),
|
|
138
143
|
remote_statement_store_create_proof: versionedRequest({
|
|
139
144
|
v1: [StatementStoreCreateProofV1_request, StatementStoreCreateProofV1_response],
|
|
@@ -143,14 +148,14 @@ export const hostApiProtocol = {
|
|
|
143
148
|
}),
|
|
144
149
|
// Preimage lookup
|
|
145
150
|
remote_preimage_lookup_subscribe: versionedSubscription({
|
|
146
|
-
v1: [PreimageLookupSubscribeV1_start, PreimageLookupSubscribeV1_receive],
|
|
151
|
+
v1: [PreimageLookupSubscribeV1_start, PreimageLookupSubscribeV1_receive, PreimageLookupSubscribeV1_interrupt],
|
|
147
152
|
}),
|
|
148
153
|
remote_preimage_submit: versionedRequest({
|
|
149
154
|
v1: [PreimageSubmitV1_request, PreimageSubmitV1_response],
|
|
150
155
|
}),
|
|
151
156
|
// Payments
|
|
152
157
|
host_payment_balance_subscribe: versionedSubscription({
|
|
153
|
-
v1: [PaymentBalanceSubscribeV1_start, PaymentBalanceSubscribeV1_receive],
|
|
158
|
+
v1: [PaymentBalanceSubscribeV1_start, PaymentBalanceSubscribeV1_receive, PaymentBalanceSubscribeV1_interrupt],
|
|
154
159
|
}),
|
|
155
160
|
host_payment_top_up: versionedRequest({
|
|
156
161
|
v1: [PaymentTopUpV1_request, PaymentTopUpV1_response],
|
|
@@ -159,18 +164,18 @@ export const hostApiProtocol = {
|
|
|
159
164
|
v1: [PaymentRequestV1_request, PaymentRequestV1_response],
|
|
160
165
|
}),
|
|
161
166
|
host_payment_status_subscribe: versionedSubscription({
|
|
162
|
-
v1: [PaymentStatusSubscribeV1_start, PaymentStatusSubscribeV1_receive],
|
|
167
|
+
v1: [PaymentStatusSubscribeV1_start, PaymentStatusSubscribeV1_receive, PaymentStatusSubscribeV1_interrupt],
|
|
163
168
|
}),
|
|
164
169
|
// json rpc (deprecated: use remote_chain_* methods instead)
|
|
165
170
|
host_jsonrpc_message_send: versionedRequest({
|
|
166
171
|
v1: [JsonRpcMessageSendV1_request, JsonRpcMessageSendV1_response],
|
|
167
172
|
}),
|
|
168
173
|
host_jsonrpc_message_subscribe: versionedSubscription({
|
|
169
|
-
v1: [JsonRpcMessageSubscribeV1_start, JsonRpcMessageSubscribeV1_receive],
|
|
174
|
+
v1: [JsonRpcMessageSubscribeV1_start, JsonRpcMessageSubscribeV1_receive, JsonRpcMessageSubscribeV1_interrupt],
|
|
170
175
|
}),
|
|
171
176
|
// chain interaction (remote namespace)
|
|
172
177
|
remote_chain_head_follow: versionedSubscription({
|
|
173
|
-
v1: [ChainHeadFollowV1_start, ChainHeadFollowV1_receive],
|
|
178
|
+
v1: [ChainHeadFollowV1_start, ChainHeadFollowV1_receive, ChainHeadFollowV1_interrupt],
|
|
174
179
|
}),
|
|
175
180
|
remote_chain_head_header: versionedRequest({
|
|
176
181
|
v1: [ChainHeadHeaderV1_request, ChainHeadHeaderV1_response],
|
|
@@ -3,7 +3,7 @@ import type { Codec, CodecType } from 'scale-ts';
|
|
|
3
3
|
import type { HostApiProtocol, VersionedProtocolRequest, VersionedProtocolSubscription } from './impl.js';
|
|
4
4
|
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
5
5
|
type InferRequest<Method extends string, R extends VersionedProtocolRequest<any>> = Record<`${Method}_request`, R['request']> & Record<`${Method}_response`, R['response']>;
|
|
6
|
-
type InferSubscription<Method extends string, R extends VersionedProtocolSubscription<any>> = Record<`${Method}_start`, R['start']> & Record<`${Method}_receive`, R['receive']> & Record<`${Method}_interrupt`,
|
|
6
|
+
type InferSubscription<Method extends string, R extends VersionedProtocolSubscription<any>> = Record<`${Method}_start`, R['start']> & Record<`${Method}_receive`, R['receive']> & Record<`${Method}_interrupt`, R['interrupt']> & Record<`${Method}_stop`, Codec<undefined>>;
|
|
7
7
|
type InferHostApiMethod<Method extends string, Payload> = Payload extends VersionedProtocolRequest<any> ? InferRequest<Method, Payload> : Payload extends VersionedProtocolSubscription<any> ? InferSubscription<Method, Payload> : Codec<undefined>;
|
|
8
8
|
type HostApiPayloadFields = UnionToIntersection<{
|
|
9
9
|
[Method in keyof HostApiProtocol]: InferHostApiMethod<Method, HostApiProtocol[Method]>;
|
|
@@ -37,7 +37,9 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
37
37
|
readonly v1: Codec<undefined>;
|
|
38
38
|
}>> & Record<"host_theme_subscribe_receive", EnumCodec<{
|
|
39
39
|
readonly v1: Codec<"light" | "dark">;
|
|
40
|
-
}>> & Record<"host_theme_subscribe_interrupt",
|
|
40
|
+
}>> & Record<"host_theme_subscribe_interrupt", EnumCodec<{
|
|
41
|
+
readonly v1: Codec<undefined>;
|
|
42
|
+
}>> & Record<"host_theme_subscribe_stop", Codec<undefined>> & Record<"host_navigate_to_request", EnumCodec<{
|
|
41
43
|
readonly v1: Codec<string>;
|
|
42
44
|
}>> & Record<"host_navigate_to_response", EnumCodec<{
|
|
43
45
|
readonly v1: Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
|
|
@@ -56,7 +58,7 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
56
58
|
reason: string;
|
|
57
59
|
}, "GenericError">>>;
|
|
58
60
|
}>> & Record<"remote_permission_request", EnumCodec<{
|
|
59
|
-
readonly v1: Codec<
|
|
61
|
+
readonly v1: Codec<{
|
|
60
62
|
tag: "Remote";
|
|
61
63
|
value: string[];
|
|
62
64
|
} | {
|
|
@@ -71,7 +73,7 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
71
73
|
} | {
|
|
72
74
|
tag: "StatementSubmit";
|
|
73
75
|
value: undefined;
|
|
74
|
-
}
|
|
76
|
+
}>;
|
|
75
77
|
}>> & Record<"remote_permission_response", EnumCodec<{
|
|
76
78
|
readonly v1: Codec<import("scale-ts").ResultPayload<boolean, import("@novasamatech/scale").CodecError<{
|
|
77
79
|
reason: string;
|
|
@@ -113,7 +115,9 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
113
115
|
readonly v1: Codec<undefined>;
|
|
114
116
|
}>> & Record<"host_account_connection_status_subscribe_receive", EnumCodec<{
|
|
115
117
|
readonly v1: Codec<"disconnected" | "connected">;
|
|
116
|
-
}>> & Record<"host_account_connection_status_subscribe_interrupt",
|
|
118
|
+
}>> & Record<"host_account_connection_status_subscribe_interrupt", EnumCodec<{
|
|
119
|
+
readonly v1: Codec<undefined>;
|
|
120
|
+
}>> & Record<"host_account_connection_status_subscribe_stop", Codec<undefined>> & Record<"host_account_get_request", EnumCodec<{
|
|
117
121
|
readonly v1: Codec<[string, number]>;
|
|
118
122
|
}>> & Record<"host_account_get_response", EnumCodec<{
|
|
119
123
|
readonly v1: Codec<import("scale-ts").ResultPayload<{
|
|
@@ -287,7 +291,9 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
287
291
|
roomId: string;
|
|
288
292
|
participatingAs: "RoomHost" | "Bot";
|
|
289
293
|
}[]>;
|
|
290
|
-
}>> & Record<"host_chat_list_subscribe_interrupt",
|
|
294
|
+
}>> & Record<"host_chat_list_subscribe_interrupt", EnumCodec<{
|
|
295
|
+
readonly v1: Codec<undefined>;
|
|
296
|
+
}>> & Record<"host_chat_list_subscribe_stop", Codec<undefined>> & Record<"host_chat_post_message_request", EnumCodec<{
|
|
291
297
|
readonly v1: Codec<{
|
|
292
298
|
roomId: string;
|
|
293
299
|
payload: {
|
|
@@ -418,7 +424,9 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
418
424
|
};
|
|
419
425
|
};
|
|
420
426
|
}>;
|
|
421
|
-
}>> & Record<"host_chat_action_subscribe_interrupt",
|
|
427
|
+
}>> & Record<"host_chat_action_subscribe_interrupt", EnumCodec<{
|
|
428
|
+
readonly v1: Codec<undefined>;
|
|
429
|
+
}>> & Record<"host_chat_action_subscribe_stop", Codec<undefined>> & Record<"product_chat_custom_message_render_subscribe_start", EnumCodec<{
|
|
422
430
|
readonly v1: Codec<{
|
|
423
431
|
messageId: string;
|
|
424
432
|
messageType: string;
|
|
@@ -426,7 +434,9 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
426
434
|
}>;
|
|
427
435
|
}>> & Record<"product_chat_custom_message_render_subscribe_receive", EnumCodec<{
|
|
428
436
|
readonly v1: Codec<import("./v1/customRenderer.js").CustomRendererNodeType>;
|
|
429
|
-
}>> & Record<"product_chat_custom_message_render_subscribe_interrupt",
|
|
437
|
+
}>> & Record<"product_chat_custom_message_render_subscribe_interrupt", EnumCodec<{
|
|
438
|
+
readonly v1: Codec<undefined>;
|
|
439
|
+
}>> & Record<"product_chat_custom_message_render_subscribe_stop", Codec<undefined>> & Record<"remote_statement_store_subscribe_start", EnumCodec<{
|
|
430
440
|
readonly v1: Codec<{
|
|
431
441
|
tag: "MatchAll";
|
|
432
442
|
value: Uint8Array<ArrayBufferLike>[];
|
|
@@ -471,7 +481,9 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
471
481
|
}[];
|
|
472
482
|
isComplete: boolean;
|
|
473
483
|
}>;
|
|
474
|
-
}>> & Record<"remote_statement_store_subscribe_interrupt",
|
|
484
|
+
}>> & Record<"remote_statement_store_subscribe_interrupt", EnumCodec<{
|
|
485
|
+
readonly v1: Codec<undefined>;
|
|
486
|
+
}>> & Record<"remote_statement_store_subscribe_stop", Codec<undefined>> & Record<"remote_statement_store_create_proof_request", EnumCodec<{
|
|
475
487
|
readonly v1: Codec<[[string, number], {
|
|
476
488
|
proof: {
|
|
477
489
|
tag: "Sr25519";
|
|
@@ -576,7 +588,9 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
576
588
|
readonly v1: Codec<`0x${string}`>;
|
|
577
589
|
}>> & Record<"remote_preimage_lookup_subscribe_receive", EnumCodec<{
|
|
578
590
|
readonly v1: Codec<Uint8Array<ArrayBufferLike> | null>;
|
|
579
|
-
}>> & Record<"remote_preimage_lookup_subscribe_interrupt",
|
|
591
|
+
}>> & Record<"remote_preimage_lookup_subscribe_interrupt", EnumCodec<{
|
|
592
|
+
readonly v1: Codec<undefined>;
|
|
593
|
+
}>> & Record<"remote_preimage_lookup_subscribe_stop", Codec<undefined>> & Record<"remote_preimage_submit_request", EnumCodec<{
|
|
580
594
|
readonly v1: Codec<Uint8Array<ArrayBufferLike>>;
|
|
581
595
|
}>> & Record<"remote_preimage_submit_response", EnumCodec<{
|
|
582
596
|
readonly v1: Codec<import("scale-ts").ResultPayload<`0x${string}`, import("@novasamatech/scale").CodecError<{
|
|
@@ -588,7 +602,25 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
588
602
|
readonly v1: Codec<{
|
|
589
603
|
available: bigint;
|
|
590
604
|
}>;
|
|
591
|
-
}>> & Record<"host_payment_balance_subscribe_interrupt",
|
|
605
|
+
}>> & Record<"host_payment_balance_subscribe_interrupt", EnumCodec<{
|
|
606
|
+
readonly v1: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
607
|
+
reason: string;
|
|
608
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
609
|
+
reason: string;
|
|
610
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>] & {
|
|
611
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
612
|
+
reason: string;
|
|
613
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>;
|
|
614
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
615
|
+
reason: string;
|
|
616
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>;
|
|
617
|
+
} & {
|
|
618
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "PaymentBalanceErr::PermissionDenied">;
|
|
619
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
620
|
+
reason: string;
|
|
621
|
+
}, "PaymentBalanceErr::Unknown">;
|
|
622
|
+
};
|
|
623
|
+
}>> & Record<"host_payment_balance_subscribe_stop", Codec<undefined>> & Record<"host_payment_top_up_request", EnumCodec<{
|
|
592
624
|
readonly v1: Codec<{
|
|
593
625
|
amount: bigint;
|
|
594
626
|
source: {
|
|
@@ -627,7 +659,25 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
627
659
|
tag: "Failed";
|
|
628
660
|
value: string;
|
|
629
661
|
}>;
|
|
630
|
-
}>> & Record<"host_payment_status_subscribe_interrupt",
|
|
662
|
+
}>> & Record<"host_payment_status_subscribe_interrupt", EnumCodec<{
|
|
663
|
+
readonly v1: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
664
|
+
reason: string;
|
|
665
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
666
|
+
reason: string;
|
|
667
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>] & {
|
|
668
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
669
|
+
reason: string;
|
|
670
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>;
|
|
671
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
672
|
+
reason: string;
|
|
673
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>;
|
|
674
|
+
} & {
|
|
675
|
+
readonly PaymentNotFound: import("@novasamatech/scale").ErrCodec<undefined, "PaymentStatusErr::PaymentNotFound">;
|
|
676
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
677
|
+
reason: string;
|
|
678
|
+
}, "PaymentStatusErr::Unknown">;
|
|
679
|
+
};
|
|
680
|
+
}>> & Record<"host_payment_status_subscribe_stop", Codec<undefined>> & Record<"host_jsonrpc_message_send_request", EnumCodec<{
|
|
631
681
|
readonly v1: Codec<[`0x${string}`, string]>;
|
|
632
682
|
}>> & Record<"host_jsonrpc_message_send_response", EnumCodec<{
|
|
633
683
|
readonly v1: Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
|
|
@@ -637,7 +687,9 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
637
687
|
readonly v1: Codec<`0x${string}`>;
|
|
638
688
|
}>> & Record<"host_jsonrpc_message_subscribe_receive", EnumCodec<{
|
|
639
689
|
readonly v1: Codec<string>;
|
|
640
|
-
}>> & Record<"host_jsonrpc_message_subscribe_interrupt",
|
|
690
|
+
}>> & Record<"host_jsonrpc_message_subscribe_interrupt", EnumCodec<{
|
|
691
|
+
readonly v1: Codec<undefined>;
|
|
692
|
+
}>> & Record<"host_jsonrpc_message_subscribe_stop", Codec<undefined>> & Record<"remote_chain_head_follow_start", EnumCodec<{
|
|
641
693
|
readonly v1: Codec<{
|
|
642
694
|
genesisHash: `0x${string}`;
|
|
643
695
|
withRuntime: boolean;
|
|
@@ -745,7 +797,9 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
745
797
|
tag: "Stop";
|
|
746
798
|
value: undefined;
|
|
747
799
|
}>;
|
|
748
|
-
}>> & Record<"remote_chain_head_follow_interrupt",
|
|
800
|
+
}>> & Record<"remote_chain_head_follow_interrupt", EnumCodec<{
|
|
801
|
+
readonly v1: Codec<undefined>;
|
|
802
|
+
}>> & Record<"remote_chain_head_follow_stop", Codec<undefined>> & Record<"remote_chain_head_header_request", EnumCodec<{
|
|
749
803
|
readonly v1: Codec<{
|
|
750
804
|
genesisHash: `0x${string}`;
|
|
751
805
|
followSubscriptionId: string;
|
|
@@ -947,7 +1001,10 @@ export declare const Message: Codec<{
|
|
|
947
1001
|
};
|
|
948
1002
|
} | {
|
|
949
1003
|
tag: "host_theme_subscribe_interrupt";
|
|
950
|
-
value:
|
|
1004
|
+
value: {
|
|
1005
|
+
tag: "v1";
|
|
1006
|
+
value: undefined;
|
|
1007
|
+
};
|
|
951
1008
|
} | {
|
|
952
1009
|
tag: "host_theme_subscribe_stop";
|
|
953
1010
|
value: undefined;
|
|
@@ -997,7 +1054,7 @@ export declare const Message: Codec<{
|
|
|
997
1054
|
tag: "remote_permission_request";
|
|
998
1055
|
value: {
|
|
999
1056
|
tag: "v1";
|
|
1000
|
-
value:
|
|
1057
|
+
value: {
|
|
1001
1058
|
tag: "Remote";
|
|
1002
1059
|
value: string[];
|
|
1003
1060
|
} | {
|
|
@@ -1012,7 +1069,7 @@ export declare const Message: Codec<{
|
|
|
1012
1069
|
} | {
|
|
1013
1070
|
tag: "StatementSubmit";
|
|
1014
1071
|
value: undefined;
|
|
1015
|
-
}
|
|
1072
|
+
};
|
|
1016
1073
|
};
|
|
1017
1074
|
} | {
|
|
1018
1075
|
tag: "remote_permission_response";
|
|
@@ -1109,7 +1166,10 @@ export declare const Message: Codec<{
|
|
|
1109
1166
|
};
|
|
1110
1167
|
} | {
|
|
1111
1168
|
tag: "host_account_connection_status_subscribe_interrupt";
|
|
1112
|
-
value:
|
|
1169
|
+
value: {
|
|
1170
|
+
tag: "v1";
|
|
1171
|
+
value: undefined;
|
|
1172
|
+
};
|
|
1113
1173
|
} | {
|
|
1114
1174
|
tag: "host_account_connection_status_subscribe_stop";
|
|
1115
1175
|
value: undefined;
|
|
@@ -1393,7 +1453,10 @@ export declare const Message: Codec<{
|
|
|
1393
1453
|
};
|
|
1394
1454
|
} | {
|
|
1395
1455
|
tag: "host_chat_list_subscribe_interrupt";
|
|
1396
|
-
value:
|
|
1456
|
+
value: {
|
|
1457
|
+
tag: "v1";
|
|
1458
|
+
value: undefined;
|
|
1459
|
+
};
|
|
1397
1460
|
} | {
|
|
1398
1461
|
tag: "host_chat_list_subscribe_stop";
|
|
1399
1462
|
value: undefined;
|
|
@@ -1546,7 +1609,10 @@ export declare const Message: Codec<{
|
|
|
1546
1609
|
};
|
|
1547
1610
|
} | {
|
|
1548
1611
|
tag: "host_chat_action_subscribe_interrupt";
|
|
1549
|
-
value:
|
|
1612
|
+
value: {
|
|
1613
|
+
tag: "v1";
|
|
1614
|
+
value: undefined;
|
|
1615
|
+
};
|
|
1550
1616
|
} | {
|
|
1551
1617
|
tag: "host_chat_action_subscribe_stop";
|
|
1552
1618
|
value: undefined;
|
|
@@ -1568,7 +1634,10 @@ export declare const Message: Codec<{
|
|
|
1568
1634
|
};
|
|
1569
1635
|
} | {
|
|
1570
1636
|
tag: "product_chat_custom_message_render_subscribe_interrupt";
|
|
1571
|
-
value:
|
|
1637
|
+
value: {
|
|
1638
|
+
tag: "v1";
|
|
1639
|
+
value: undefined;
|
|
1640
|
+
};
|
|
1572
1641
|
} | {
|
|
1573
1642
|
tag: "product_chat_custom_message_render_subscribe_stop";
|
|
1574
1643
|
value: undefined;
|
|
@@ -1627,7 +1696,10 @@ export declare const Message: Codec<{
|
|
|
1627
1696
|
};
|
|
1628
1697
|
} | {
|
|
1629
1698
|
tag: "remote_statement_store_subscribe_interrupt";
|
|
1630
|
-
value:
|
|
1699
|
+
value: {
|
|
1700
|
+
tag: "v1";
|
|
1701
|
+
value: undefined;
|
|
1702
|
+
};
|
|
1631
1703
|
} | {
|
|
1632
1704
|
tag: "remote_statement_store_subscribe_stop";
|
|
1633
1705
|
value: undefined;
|
|
@@ -1762,7 +1834,10 @@ export declare const Message: Codec<{
|
|
|
1762
1834
|
};
|
|
1763
1835
|
} | {
|
|
1764
1836
|
tag: "remote_preimage_lookup_subscribe_interrupt";
|
|
1765
|
-
value:
|
|
1837
|
+
value: {
|
|
1838
|
+
tag: "v1";
|
|
1839
|
+
value: undefined;
|
|
1840
|
+
};
|
|
1766
1841
|
} | {
|
|
1767
1842
|
tag: "remote_preimage_lookup_subscribe_stop";
|
|
1768
1843
|
value: undefined;
|
|
@@ -1796,7 +1871,12 @@ export declare const Message: Codec<{
|
|
|
1796
1871
|
};
|
|
1797
1872
|
} | {
|
|
1798
1873
|
tag: "host_payment_balance_subscribe_interrupt";
|
|
1799
|
-
value:
|
|
1874
|
+
value: {
|
|
1875
|
+
tag: "v1";
|
|
1876
|
+
value: import("@novasamatech/scale").CodecError<{
|
|
1877
|
+
reason: string;
|
|
1878
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">;
|
|
1879
|
+
};
|
|
1800
1880
|
} | {
|
|
1801
1881
|
tag: "host_payment_balance_subscribe_stop";
|
|
1802
1882
|
value: undefined;
|
|
@@ -1865,7 +1945,12 @@ export declare const Message: Codec<{
|
|
|
1865
1945
|
};
|
|
1866
1946
|
} | {
|
|
1867
1947
|
tag: "host_payment_status_subscribe_interrupt";
|
|
1868
|
-
value:
|
|
1948
|
+
value: {
|
|
1949
|
+
tag: "v1";
|
|
1950
|
+
value: import("@novasamatech/scale").CodecError<{
|
|
1951
|
+
reason: string;
|
|
1952
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">;
|
|
1953
|
+
};
|
|
1869
1954
|
} | {
|
|
1870
1955
|
tag: "host_payment_status_subscribe_stop";
|
|
1871
1956
|
value: undefined;
|
|
@@ -1897,7 +1982,10 @@ export declare const Message: Codec<{
|
|
|
1897
1982
|
};
|
|
1898
1983
|
} | {
|
|
1899
1984
|
tag: "host_jsonrpc_message_subscribe_interrupt";
|
|
1900
|
-
value:
|
|
1985
|
+
value: {
|
|
1986
|
+
tag: "v1";
|
|
1987
|
+
value: undefined;
|
|
1988
|
+
};
|
|
1901
1989
|
} | {
|
|
1902
1990
|
tag: "host_jsonrpc_message_subscribe_stop";
|
|
1903
1991
|
value: undefined;
|
|
@@ -2019,7 +2107,10 @@ export declare const Message: Codec<{
|
|
|
2019
2107
|
};
|
|
2020
2108
|
} | {
|
|
2021
2109
|
tag: "remote_chain_head_follow_interrupt";
|
|
2022
|
-
value:
|
|
2110
|
+
value: {
|
|
2111
|
+
tag: "v1";
|
|
2112
|
+
value: undefined;
|
|
2113
|
+
};
|
|
2023
2114
|
} | {
|
|
2024
2115
|
tag: "remote_chain_head_follow_stop";
|
|
2025
2116
|
value: undefined;
|
|
@@ -11,7 +11,7 @@ const createPayload = (hostApi) => {
|
|
|
11
11
|
if (payload.method === 'subscribe') {
|
|
12
12
|
fields[`${method}_start`] = payload.start;
|
|
13
13
|
fields[`${method}_stop`] = _void;
|
|
14
|
-
fields[`${method}_interrupt`] =
|
|
14
|
+
fields[`${method}_interrupt`] = payload.interrupt;
|
|
15
15
|
fields[`${method}_receive`] = payload.receive;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -63,6 +63,7 @@ export declare const CreateProofErr: [import("scale-ts").Encoder<import("@novasa
|
|
|
63
63
|
export declare const AccountConnectionStatus: import("scale-ts").Codec<"disconnected" | "connected">;
|
|
64
64
|
export declare const AccountConnectionStatusV1_start: import("scale-ts").Codec<undefined>;
|
|
65
65
|
export declare const AccountConnectionStatusV1_receive: import("scale-ts").Codec<"disconnected" | "connected">;
|
|
66
|
+
export declare const AccountConnectionStatusV1_interrupt: import("scale-ts").Codec<undefined>;
|
|
66
67
|
export declare const AccountGetRootV1_request: import("scale-ts").Codec<undefined>;
|
|
67
68
|
export declare const AccountGetRootV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
68
69
|
publicKey: Uint8Array<ArrayBufferLike>;
|
|
@@ -42,6 +42,7 @@ export const CreateProofErr = ErrEnum('CreateProofErr', {
|
|
|
42
42
|
export const AccountConnectionStatus = Status('disconnected', 'connected');
|
|
43
43
|
export const AccountConnectionStatusV1_start = _void;
|
|
44
44
|
export const AccountConnectionStatusV1_receive = AccountConnectionStatus;
|
|
45
|
+
export const AccountConnectionStatusV1_interrupt = _void;
|
|
45
46
|
// account_get_root
|
|
46
47
|
export const AccountGetRootV1_request = _void;
|
|
47
48
|
export const AccountGetRootV1_response = Result(Account, RequestCredentialsErr);
|
|
@@ -242,6 +242,7 @@ export declare const ChainHeadFollowV1_receive: import("scale-ts").Codec<{
|
|
|
242
242
|
tag: "Stop";
|
|
243
243
|
value: undefined;
|
|
244
244
|
}>;
|
|
245
|
+
export declare const ChainHeadFollowV1_interrupt: import("scale-ts").Codec<undefined>;
|
|
245
246
|
export declare const ChainHeadHeaderV1_request: import("scale-ts").Codec<{
|
|
246
247
|
genesisHash: `0x${string}`;
|
|
247
248
|
followSubscriptionId: string;
|
|
@@ -85,6 +85,7 @@ export const ChainHeadEvent = Enum({
|
|
|
85
85
|
Stop: _void,
|
|
86
86
|
});
|
|
87
87
|
export const ChainHeadFollowV1_receive = ChainHeadEvent;
|
|
88
|
+
export const ChainHeadFollowV1_interrupt = _void;
|
|
88
89
|
// === ChainHead Header ===
|
|
89
90
|
export const ChainHeadHeaderV1_request = Struct({
|
|
90
91
|
genesisHash: GenesisHash,
|
|
@@ -82,6 +82,7 @@ export declare const ChatListSubscribeV1_receive: Codec<{
|
|
|
82
82
|
roomId: string;
|
|
83
83
|
participatingAs: "RoomHost" | "Bot";
|
|
84
84
|
}[]>;
|
|
85
|
+
export declare const ChatListSubscribeV1_interrupt: Codec<undefined>;
|
|
85
86
|
export declare const ChatAction: Codec<{
|
|
86
87
|
actionId: string;
|
|
87
88
|
title: string;
|
|
@@ -458,9 +459,11 @@ export declare const ChatActionSubscribeV1_receive: Codec<{
|
|
|
458
459
|
};
|
|
459
460
|
};
|
|
460
461
|
}>;
|
|
462
|
+
export declare const ChatActionSubscribeV1_interrupt: Codec<undefined>;
|
|
461
463
|
export declare const ChatCustomMessageRenderingV1_start: Codec<{
|
|
462
464
|
messageId: string;
|
|
463
465
|
messageType: string;
|
|
464
466
|
payload: Uint8Array<ArrayBufferLike>;
|
|
465
467
|
}>;
|
|
466
468
|
export declare const ChatCustomMessageRenderingV1_receive: Codec<CustomRendererNodeType>;
|
|
469
|
+
export declare const ChatCustomMessageRenderingV1_interrupt: Codec<undefined>;
|
package/dist/protocol/v1/chat.js
CHANGED
|
@@ -42,6 +42,7 @@ export const ChatRoom = Struct({
|
|
|
42
42
|
});
|
|
43
43
|
export const ChatListSubscribeV1_start = _void;
|
|
44
44
|
export const ChatListSubscribeV1_receive = Vector(ChatRoom);
|
|
45
|
+
export const ChatListSubscribeV1_interrupt = _void;
|
|
45
46
|
// message format
|
|
46
47
|
export const ChatAction = Struct({
|
|
47
48
|
actionId: str,
|
|
@@ -119,6 +120,8 @@ export const ReceivedChatAction = Struct({
|
|
|
119
120
|
});
|
|
120
121
|
export const ChatActionSubscribeV1_start = _void;
|
|
121
122
|
export const ChatActionSubscribeV1_receive = ReceivedChatAction;
|
|
123
|
+
export const ChatActionSubscribeV1_interrupt = _void;
|
|
122
124
|
// custom message rendering
|
|
123
125
|
export const ChatCustomMessageRenderingV1_start = Struct({ messageId: str, messageType: str, payload: Bytes() });
|
|
124
126
|
export const ChatCustomMessageRenderingV1_receive = CustomRendererNode;
|
|
127
|
+
export const ChatCustomMessageRenderingV1_interrupt = _void;
|
|
@@ -4,3 +4,4 @@ export declare const JsonRpcMessageSendV1_response: import("scale-ts").Codec<imp
|
|
|
4
4
|
}, "GenericError">>>;
|
|
5
5
|
export declare const JsonRpcMessageSubscribeV1_start: import("scale-ts").Codec<`0x${string}`>;
|
|
6
6
|
export declare const JsonRpcMessageSubscribeV1_receive: import("scale-ts").Codec<string>;
|
|
7
|
+
export declare const JsonRpcMessageSubscribeV1_interrupt: import("scale-ts").Codec<undefined>;
|
|
@@ -4,3 +4,4 @@ export const JsonRpcMessageSendV1_request = Tuple(GenesisHash, str);
|
|
|
4
4
|
export const JsonRpcMessageSendV1_response = Result(_void, GenericError);
|
|
5
5
|
export const JsonRpcMessageSubscribeV1_start = GenesisHash;
|
|
6
6
|
export const JsonRpcMessageSubscribeV1_receive = str;
|
|
7
|
+
export const JsonRpcMessageSubscribeV1_interrupt = _void;
|
|
@@ -97,6 +97,23 @@ export declare const PaymentBalanceSubscribeV1_start: import("scale-ts").Codec<u
|
|
|
97
97
|
export declare const PaymentBalanceSubscribeV1_receive: import("scale-ts").Codec<{
|
|
98
98
|
available: bigint;
|
|
99
99
|
}>;
|
|
100
|
+
export declare const PaymentBalanceSubscribeV1_interrupt: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
101
|
+
reason: string;
|
|
102
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
103
|
+
reason: string;
|
|
104
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>] & {
|
|
105
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
106
|
+
reason: string;
|
|
107
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>;
|
|
108
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
109
|
+
reason: string;
|
|
110
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>;
|
|
111
|
+
} & {
|
|
112
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "PaymentBalanceErr::PermissionDenied">;
|
|
113
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
114
|
+
reason: string;
|
|
115
|
+
}, "PaymentBalanceErr::Unknown">;
|
|
116
|
+
};
|
|
100
117
|
export declare const PaymentTopUpV1_request: import("scale-ts").Codec<{
|
|
101
118
|
amount: bigint;
|
|
102
119
|
source: {
|
|
@@ -130,3 +147,20 @@ export declare const PaymentStatusSubscribeV1_receive: import("scale-ts").Codec<
|
|
|
130
147
|
tag: "Failed";
|
|
131
148
|
value: string;
|
|
132
149
|
}>;
|
|
150
|
+
export declare const PaymentStatusSubscribeV1_interrupt: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
151
|
+
reason: string;
|
|
152
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
153
|
+
reason: string;
|
|
154
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>] & {
|
|
155
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
156
|
+
reason: string;
|
|
157
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>;
|
|
158
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
159
|
+
reason: string;
|
|
160
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>;
|
|
161
|
+
} & {
|
|
162
|
+
readonly PaymentNotFound: import("@novasamatech/scale").ErrCodec<undefined, "PaymentStatusErr::PaymentNotFound">;
|
|
163
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
164
|
+
reason: string;
|
|
165
|
+
}, "PaymentStatusErr::Unknown">;
|
|
166
|
+
};
|
|
@@ -42,6 +42,7 @@ export const PaymentStatusErr = ErrEnum('PaymentStatusErr', {
|
|
|
42
42
|
// host_payment_balance_subscribe
|
|
43
43
|
export const PaymentBalanceSubscribeV1_start = _void;
|
|
44
44
|
export const PaymentBalanceSubscribeV1_receive = PaymentBalance;
|
|
45
|
+
export const PaymentBalanceSubscribeV1_interrupt = PaymentBalanceErr;
|
|
45
46
|
// host_payment_top_up
|
|
46
47
|
export const PaymentTopUpV1_request = Struct({
|
|
47
48
|
amount: u128,
|
|
@@ -57,3 +58,4 @@ export const PaymentRequestV1_response = Result(PaymentReceipt, PaymentRequestEr
|
|
|
57
58
|
// host_payment_status_subscribe
|
|
58
59
|
export const PaymentStatusSubscribeV1_start = PaymentId;
|
|
59
60
|
export const PaymentStatusSubscribeV1_receive = PaymentStatus;
|
|
61
|
+
export const PaymentStatusSubscribeV1_interrupt = PaymentStatusErr;
|
|
@@ -2,6 +2,7 @@ export declare const PreimageKey: import("scale-ts").Codec<`0x${string}`>;
|
|
|
2
2
|
export declare const PreimageValue: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
|
|
3
3
|
export declare const PreimageLookupSubscribeV1_start: import("scale-ts").Codec<`0x${string}`>;
|
|
4
4
|
export declare const PreimageLookupSubscribeV1_receive: import("scale-ts").Codec<Uint8Array<ArrayBufferLike> | null>;
|
|
5
|
+
export declare const PreimageLookupSubscribeV1_interrupt: import("scale-ts").Codec<undefined>;
|
|
5
6
|
export declare const PreimageSubmitErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
6
7
|
reason: string;
|
|
7
8
|
}, "PreimageSubmitErr::Unknown">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ErrEnum, Hex, Nullable } from '@novasamatech/scale';
|
|
2
|
-
import { Bytes, Result } from 'scale-ts';
|
|
2
|
+
import { Bytes, Result, _void } from 'scale-ts';
|
|
3
3
|
import { GenericErr } from '../commonCodecs.js';
|
|
4
4
|
export const PreimageKey = Hex();
|
|
5
5
|
export const PreimageValue = Bytes();
|
|
6
6
|
export const PreimageLookupSubscribeV1_start = PreimageKey;
|
|
7
7
|
export const PreimageLookupSubscribeV1_receive = Nullable(PreimageValue);
|
|
8
|
+
export const PreimageLookupSubscribeV1_interrupt = _void;
|
|
8
9
|
export const PreimageSubmitErr = ErrEnum('PreimageSubmitErr', {
|
|
9
10
|
Unknown: [GenericErr, 'Unknown error'],
|
|
10
11
|
});
|
|
@@ -14,7 +14,7 @@ export declare const RemotePermission: import("scale-ts").Codec<{
|
|
|
14
14
|
tag: "StatementSubmit";
|
|
15
15
|
value: undefined;
|
|
16
16
|
}>;
|
|
17
|
-
export declare const RemotePermissionV1_request: import("scale-ts").Codec<
|
|
17
|
+
export declare const RemotePermissionV1_request: import("scale-ts").Codec<{
|
|
18
18
|
tag: "Remote";
|
|
19
19
|
value: string[];
|
|
20
20
|
} | {
|
|
@@ -29,7 +29,7 @@ export declare const RemotePermissionV1_request: import("scale-ts").Codec<({
|
|
|
29
29
|
} | {
|
|
30
30
|
tag: "StatementSubmit";
|
|
31
31
|
value: undefined;
|
|
32
|
-
}
|
|
32
|
+
}>;
|
|
33
33
|
export declare const RemotePermissionV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<boolean, import("@novasamatech/scale").CodecError<{
|
|
34
34
|
reason: string;
|
|
35
35
|
}, "GenericError">>>;
|
|
@@ -8,5 +8,5 @@ export const RemotePermission = Enum({
|
|
|
8
8
|
PreimageSubmit: _void,
|
|
9
9
|
StatementSubmit: _void,
|
|
10
10
|
});
|
|
11
|
-
export const RemotePermissionV1_request =
|
|
11
|
+
export const RemotePermissionV1_request = RemotePermission;
|
|
12
12
|
export const RemotePermissionV1_response = Result(bool, GenericError);
|
|
@@ -153,6 +153,7 @@ export declare const StatementStoreSubscribeV1_receive: import("scale-ts").Codec
|
|
|
153
153
|
}[];
|
|
154
154
|
isComplete: boolean;
|
|
155
155
|
}>;
|
|
156
|
+
export declare const StatementStoreSubscribeV1_interrupt: import("scale-ts").Codec<undefined>;
|
|
156
157
|
export declare const StatementProofErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
157
158
|
reason: string;
|
|
158
159
|
}, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
@@ -57,6 +57,7 @@ export const SignedStatementsPage = Struct({
|
|
|
57
57
|
});
|
|
58
58
|
export const StatementStoreSubscribeV1_start = TopicFilter;
|
|
59
59
|
export const StatementStoreSubscribeV1_receive = SignedStatementsPage;
|
|
60
|
+
export const StatementStoreSubscribeV1_interrupt = _void;
|
|
60
61
|
// creating proof
|
|
61
62
|
export const StatementProofErr = ErrEnum('StatementProofErr', {
|
|
62
63
|
UnableToSign: [_void, 'StatementProof: unable to sign'],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const Theme: import("scale-ts").Codec<"light" | "dark">;
|
|
2
2
|
export declare const ThemeSubscribeV1_start: import("scale-ts").Codec<undefined>;
|
|
3
3
|
export declare const ThemeSubscribeV1_receive: import("scale-ts").Codec<"light" | "dark">;
|
|
4
|
+
export declare const ThemeSubscribeV1_interrupt: import("scale-ts").Codec<undefined>;
|
package/dist/transport.js
CHANGED
|
@@ -187,9 +187,9 @@ export function createTransport(provider) {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
|
-
const unsubscribeInterrupt = transport.listenMessages(interruptAction, receivedId => {
|
|
190
|
+
const unsubscribeInterrupt = transport.listenMessages(interruptAction, (receivedId, data) => {
|
|
191
191
|
if (receivedId === requestId) {
|
|
192
|
-
events.emit('interrupt');
|
|
192
|
+
events.emit('interrupt', data.value);
|
|
193
193
|
stopSubscription();
|
|
194
194
|
}
|
|
195
195
|
});
|
|
@@ -230,10 +230,10 @@ export function createTransport(provider) {
|
|
|
230
230
|
const unsubscribe = handler(payload.value, value => {
|
|
231
231
|
const receivePayload = enumValue(receiveAction, value);
|
|
232
232
|
transport.postMessage(requestId, receivePayload);
|
|
233
|
-
},
|
|
233
|
+
}, value => {
|
|
234
234
|
interrupted = true;
|
|
235
235
|
subscriptions.delete(requestId);
|
|
236
|
-
transport.postMessage(requestId, enumValue(interruptAction,
|
|
236
|
+
transport.postMessage(requestId, enumValue(interruptAction, value));
|
|
237
237
|
});
|
|
238
238
|
if (interrupted) {
|
|
239
239
|
unsubscribe();
|
package/dist/types.d.ts
CHANGED
|
@@ -7,11 +7,12 @@ export type Logger = Record<'info' | 'warn' | 'error' | 'log', (...args: unknown
|
|
|
7
7
|
};
|
|
8
8
|
export type ConnectionStatus = 'connecting' | 'connected' | 'disconnected';
|
|
9
9
|
export type RequestHandler<Method extends string> = (message: PickMessagePayloadValue<ComposeMessageAction<Method, 'request'>>) => PromiseLike<PickMessagePayloadValue<ComposeMessageAction<Method, 'response'>>>;
|
|
10
|
-
export type SubscriptionHandler<Method extends string> = (params: PickMessagePayloadValue<ComposeMessageAction<Method, 'start'>>, send: (value: PickMessagePayloadValue<ComposeMessageAction<Method, 'receive'>>) => void, interrupt: () => void) => VoidFunction;
|
|
11
|
-
export type Subscription = {
|
|
10
|
+
export type SubscriptionHandler<Method extends string> = (params: PickMessagePayloadValue<ComposeMessageAction<Method, 'start'>>, send: (value: PickMessagePayloadValue<ComposeMessageAction<Method, 'receive'>>) => void, interrupt: (value: PickMessagePayloadValue<ComposeMessageAction<Method, 'interrupt'>>) => void) => VoidFunction;
|
|
11
|
+
export type Subscription<InterruptPayload = unknown> = {
|
|
12
12
|
unsubscribe: VoidFunction;
|
|
13
|
-
onInterrupt(callback:
|
|
13
|
+
onInterrupt(callback: (payload: InterruptPayload) => void): VoidFunction;
|
|
14
14
|
};
|
|
15
|
+
export type SubscriptionFor<Method extends HostApiMethod> = Subscription<PickMessagePayloadValue<ComposeMessageAction<Method, 'interrupt'>>>;
|
|
15
16
|
export type Transport = {
|
|
16
17
|
readonly provider: Provider;
|
|
17
18
|
isCorrectEnvironment(): boolean;
|
|
@@ -21,7 +22,7 @@ export type Transport = {
|
|
|
21
22
|
onDestroy(callback: VoidFunction): VoidFunction;
|
|
22
23
|
request<const Method extends HostApiMethod>(method: Method, payload: PickMessagePayloadValue<ComposeMessageAction<Method, 'request'>>, signal?: AbortSignal): Promise<PickMessagePayloadValue<ComposeMessageAction<Method, 'response'>>>;
|
|
23
24
|
handleRequest<const Method extends HostApiMethod>(method: Method, handler: RequestHandler<Method>): VoidFunction;
|
|
24
|
-
subscribe<const Method extends HostApiMethod>(method: Method, payload: PickMessagePayloadValue<ComposeMessageAction<Method, 'start'>>, callback: (payload: PickMessagePayloadValue<ComposeMessageAction<Method, 'receive'>>) => void):
|
|
25
|
+
subscribe<const Method extends HostApiMethod>(method: Method, payload: PickMessagePayloadValue<ComposeMessageAction<Method, 'start'>>, callback: (payload: PickMessagePayloadValue<ComposeMessageAction<Method, 'receive'>>) => void): SubscriptionFor<Method>;
|
|
25
26
|
handleSubscription<const Method extends HostApiMethod>(method: Method, handler: SubscriptionHandler<Method>): VoidFunction;
|
|
26
27
|
postMessage(requestId: string, payload: MessagePayloadSchema): void;
|
|
27
28
|
listenMessages<const Action extends MessageAction>(action: Action, callback: (requestId: string, data: PickMessagePayload<Action>) => void, onError?: (error: unknown) => void): VoidFunction;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novasamatech/host-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.1
|
|
4
|
+
"version": "0.7.1",
|
|
5
5
|
"description": "Host API: transport implementation for host - product integration.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@novasamatech/scale": "0.7.1
|
|
25
|
+
"@novasamatech/scale": "0.7.1",
|
|
26
26
|
"nanoevents": "9.1.0",
|
|
27
27
|
"nanoid": "5.1.9",
|
|
28
28
|
"neverthrow": "^8.2.0",
|