@novasamatech/host-api 0.5.0-17 → 0.5.0-18

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.
@@ -0,0 +1,197 @@
1
+ import type { HexString } from '../types.js';
2
+ /**
3
+ * createTransaction implementation
4
+ * @see https://github.com/polkadot-js/api/issues/6213
5
+ */
6
+ export declare const CreateTransactionErr: import("scale-ts").Codec<{
7
+ tag: "Rejected";
8
+ value: undefined;
9
+ } | {
10
+ tag: "Unknown";
11
+ value: {
12
+ reason: string;
13
+ };
14
+ } | {
15
+ tag: "FailedToDecode";
16
+ value: undefined;
17
+ } | {
18
+ tag: "NotSupported";
19
+ value: string;
20
+ }>;
21
+ export declare const TxPayloadExtensionV1: import("scale-ts").Codec<{
22
+ id: string;
23
+ extra: `0x${string}`;
24
+ additionalSigned: `0x${string}`;
25
+ }>;
26
+ export declare const TxPayloadContextV1: import("scale-ts").Codec<{
27
+ metadata: `0x${string}`;
28
+ tokenSymbol: string;
29
+ tokenDecimals: number;
30
+ bestBlockHeight: number;
31
+ }>;
32
+ export declare const TxPayloadV1: import("scale-ts").Codec<{
33
+ signer: string | null;
34
+ callData: `0x${string}`;
35
+ extensions: {
36
+ id: string;
37
+ extra: `0x${string}`;
38
+ additionalSigned: `0x${string}`;
39
+ }[];
40
+ txExtVersion: number;
41
+ context: {
42
+ metadata: `0x${string}`;
43
+ tokenSymbol: string;
44
+ tokenDecimals: number;
45
+ bestBlockHeight: number;
46
+ };
47
+ }>;
48
+ export declare const VersionedTxPayload: import("scale-ts").Codec<{
49
+ tag: "v1";
50
+ value: {
51
+ signer: string | null;
52
+ callData: `0x${string}`;
53
+ extensions: {
54
+ id: string;
55
+ extra: `0x${string}`;
56
+ additionalSigned: `0x${string}`;
57
+ }[];
58
+ txExtVersion: number;
59
+ context: {
60
+ metadata: `0x${string}`;
61
+ tokenSymbol: string;
62
+ tokenDecimals: number;
63
+ bestBlockHeight: number;
64
+ };
65
+ };
66
+ }>;
67
+ export declare const CreateTransactionV1_request: import("scale-ts").Codec<[[string, number], {
68
+ tag: "v1";
69
+ value: {
70
+ signer: string | null;
71
+ callData: `0x${string}`;
72
+ extensions: {
73
+ id: string;
74
+ extra: `0x${string}`;
75
+ additionalSigned: `0x${string}`;
76
+ }[];
77
+ txExtVersion: number;
78
+ context: {
79
+ metadata: `0x${string}`;
80
+ tokenSymbol: string;
81
+ tokenDecimals: number;
82
+ bestBlockHeight: number;
83
+ };
84
+ };
85
+ }]>;
86
+ export declare const CreateTransactionV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike>, {
87
+ tag: "Rejected";
88
+ value: undefined;
89
+ } | {
90
+ tag: "Unknown";
91
+ value: {
92
+ reason: string;
93
+ };
94
+ } | {
95
+ tag: "FailedToDecode";
96
+ value: undefined;
97
+ } | {
98
+ tag: "NotSupported";
99
+ value: string;
100
+ }>>;
101
+ export declare const CreateTransactionWithNonProductAccountV1_request: import("scale-ts").Codec<[Uint8Array<ArrayBufferLike>, {
102
+ tag: "v1";
103
+ value: {
104
+ signer: string | null;
105
+ callData: `0x${string}`;
106
+ extensions: {
107
+ id: string;
108
+ extra: `0x${string}`;
109
+ additionalSigned: `0x${string}`;
110
+ }[];
111
+ txExtVersion: number;
112
+ context: {
113
+ metadata: `0x${string}`;
114
+ tokenSymbol: string;
115
+ tokenDecimals: number;
116
+ bestBlockHeight: number;
117
+ };
118
+ };
119
+ }]>;
120
+ export declare const CreateTransactionWithNonProductAccountV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike>, {
121
+ tag: "Rejected";
122
+ value: undefined;
123
+ } | {
124
+ tag: "Unknown";
125
+ value: {
126
+ reason: string;
127
+ };
128
+ } | {
129
+ tag: "FailedToDecode";
130
+ value: undefined;
131
+ } | {
132
+ tag: "NotSupported";
133
+ value: string;
134
+ }>>;
135
+ export interface TxPayloadV1Interface {
136
+ /** Payload version. MUST be 1. */
137
+ version: 1;
138
+ /**
139
+ * Signer selection hint. Allows the implementer to identify which private-key / scheme to use.
140
+ * - Use a wallet-defined handle (e.g., address/SS58, account-name, etc). This identifier
141
+ * was previously made available to the consumer.
142
+ * - Set `null` to let the implementer pick the signer (or if the signer is implied).
143
+ */
144
+ signer: string | null;
145
+ /**
146
+ * SCALE-encoded Call (module indicator + function indicator + params).
147
+ */
148
+ callData: HexString;
149
+ /**
150
+ * Transaction extensions supplied by the caller (order irrelevant).
151
+ * The consumer SHOULD provide every extension that is relevant to them.
152
+ * The implementer MAY infer missing ones.
153
+ */
154
+ extensions: Array<{
155
+ /** Identifier as defined in metadata (e.g., "CheckSpecVersion", "ChargeAssetTxPayment"). */
156
+ id: string;
157
+ /**
158
+ * Explicit "extra" to sign (goes into the extrinsic body).
159
+ * SCALE-encoded per the extension's "extra" type as defined in the metadata.
160
+ */
161
+ extra: HexString;
162
+ /**
163
+ * "Implicit" data to sign (known by the chain, not included into the extrinsic body).
164
+ * SCALE-encoded per the extension's "additionalSigned" type as defined in the metadata.
165
+ */
166
+ additionalSigned: HexString;
167
+ }>;
168
+ /**
169
+ * Transaction Extension Version.
170
+ * - For Extrinsic V4 MUST be 0.
171
+ * - For Extrinsic V5, set to any version supported by the runtime.
172
+ * The implementer:
173
+ * - MUST use this field to determine the required extensions for creating the extrinsic.
174
+ * - MAY use this field to infer missing extensions that the implementer could know how to handle.
175
+ */
176
+ txExtVersion: number;
177
+ /**
178
+ * Context needed for decoding, display, and (optionally) inferring certain extensions.
179
+ */
180
+ context: {
181
+ /**
182
+ * RuntimeMetadataPrefixed blob (SCALE), starting with ASCII "meta" magic (`0x6d657461`),
183
+ * then a metadata version (V14+). For V5+ versioned extensions, MUST provide V16+.
184
+ */
185
+ metadata: HexString;
186
+ /**
187
+ * Native token display info (used by some implementers), also needed to compute
188
+ * the `CheckMetadataHash` value.
189
+ */
190
+ tokenSymbol: string;
191
+ tokenDecimals: number;
192
+ /**
193
+ * Highest known block number to aid mortality UX.
194
+ */
195
+ bestBlockHeight: number;
196
+ };
197
+ }
@@ -0,0 +1,41 @@
1
+ import { Bytes, Enum, Result, Struct, Tuple, Vector, _void, str, u32, u8 } from 'scale-ts';
2
+ import { GenericErr, Hex, Nullable } from '../commonCodecs.js';
3
+ import { AccountId, ProductAccountId } from './accounts.js';
4
+ /**
5
+ * createTransaction implementation
6
+ * @see https://github.com/polkadot-js/api/issues/6213
7
+ */
8
+ export const CreateTransactionErr = Enum({
9
+ FailedToDecode: _void,
10
+ Rejected: _void,
11
+ // Unsupported payload version
12
+ // Failed to infer missing extensions, some extension is unsupported, etc.
13
+ NotSupported: str,
14
+ Unknown: GenericErr,
15
+ });
16
+ export const TxPayloadExtensionV1 = Struct({
17
+ id: str,
18
+ extra: Hex(),
19
+ additionalSigned: Hex(),
20
+ });
21
+ export const TxPayloadContextV1 = Struct({
22
+ metadata: Hex(),
23
+ tokenSymbol: str,
24
+ tokenDecimals: u32,
25
+ bestBlockHeight: u32,
26
+ });
27
+ export const TxPayloadV1 = Struct({
28
+ signer: Nullable(str),
29
+ callData: Hex(),
30
+ extensions: Vector(TxPayloadExtensionV1),
31
+ txExtVersion: u8,
32
+ context: TxPayloadContextV1,
33
+ });
34
+ export const VersionedTxPayload = Enum({
35
+ v1: TxPayloadV1,
36
+ });
37
+ // transaction in context of host api account model
38
+ export const CreateTransactionV1_request = Tuple(ProductAccountId, VersionedTxPayload);
39
+ export const CreateTransactionV1_response = Result(Bytes(), CreateTransactionErr);
40
+ export const CreateTransactionWithNonProductAccountV1_request = Tuple(AccountId, VersionedTxPayload);
41
+ export const CreateTransactionWithNonProductAccountV1_response = Result(Bytes(), CreateTransactionErr);
@@ -0,0 +1,11 @@
1
+ export declare const Feature: import("scale-ts").Codec<{
2
+ tag: "chain";
3
+ value: `0x${string}`;
4
+ }>;
5
+ export declare const FeatureV1_request: import("scale-ts").Codec<{
6
+ tag: "chain";
7
+ value: `0x${string}`;
8
+ }>;
9
+ export declare const FeatureV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<boolean, {
10
+ reason: string;
11
+ }>>;
@@ -0,0 +1,7 @@
1
+ import { Enum, Result, bool } from 'scale-ts';
2
+ import { GenericErr, Hex } from '../commonCodecs.js';
3
+ export const Feature = Enum({
4
+ chain: Hex(),
5
+ });
6
+ export const FeatureV1_request = Feature;
7
+ export const FeatureV1_response = Result(bool, GenericErr);
@@ -0,0 +1,28 @@
1
+ export declare const HandshakeErr: import("scale-ts").Codec<{
2
+ tag: "Unknown";
3
+ value: {
4
+ reason: string;
5
+ };
6
+ } | {
7
+ tag: "Timeout";
8
+ value: undefined;
9
+ } | {
10
+ tag: "UnsupportedProtocolVersion";
11
+ value: undefined;
12
+ }>;
13
+ /**
14
+ * HandshakeV1_request = 1 - JAM codec
15
+ */
16
+ export declare const HandshakeV1_request: import("scale-ts").Codec<number>;
17
+ export declare const HandshakeV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, {
18
+ tag: "Unknown";
19
+ value: {
20
+ reason: string;
21
+ };
22
+ } | {
23
+ tag: "Timeout";
24
+ value: undefined;
25
+ } | {
26
+ tag: "UnsupportedProtocolVersion";
27
+ value: undefined;
28
+ }>>;
@@ -0,0 +1,12 @@
1
+ import { Enum, Result, _void, u8 } from 'scale-ts';
2
+ import { GenericErr } from '../commonCodecs.js';
3
+ export const HandshakeErr = Enum({
4
+ Timeout: _void,
5
+ UnsupportedProtocolVersion: _void,
6
+ Unknown: GenericErr,
7
+ });
8
+ /**
9
+ * HandshakeV1_request = 1 - JAM codec
10
+ */
11
+ export const HandshakeV1_request = u8;
12
+ export const HandshakeV1_response = Result(_void, HandshakeErr);
@@ -0,0 +1,6 @@
1
+ export declare const JsonRpcMessageSendV1_request: import("scale-ts").Codec<[`0x${string}`, string]>;
2
+ export declare const JsonRpcMessageSendV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, {
3
+ reason: string;
4
+ }>>;
5
+ export declare const JsonRpcMessageSubscribeV1_start: import("scale-ts").Codec<`0x${string}`>;
6
+ export declare const JsonRpcMessageSubscribeV1_receive: import("scale-ts").Codec<string>;
@@ -0,0 +1,6 @@
1
+ import { Result, Tuple, _void, str } from 'scale-ts';
2
+ import { GenericErr, GenesisHash } from '../commonCodecs.js';
3
+ export const JsonRpcMessageSendV1_request = Tuple(GenesisHash, str);
4
+ export const JsonRpcMessageSendV1_response = Result(_void, GenericErr);
5
+ export const JsonRpcMessageSubscribeV1_start = GenesisHash;
6
+ export const JsonRpcMessageSubscribeV1_receive = str;
@@ -0,0 +1,48 @@
1
+ export declare const PermissionErr: import("scale-ts").Codec<{
2
+ tag: "Rejected";
3
+ value: undefined;
4
+ } | {
5
+ tag: "Unknown";
6
+ value: {
7
+ reason: string;
8
+ };
9
+ }>;
10
+ export declare const ChainConnectPermission: import("scale-ts").Codec<{
11
+ genesisHash: `0x${string}`;
12
+ name: string;
13
+ }>;
14
+ export declare const Permission: import("scale-ts").Codec<{
15
+ tag: "ChainSubmit";
16
+ value: `0x${string}`;
17
+ } | {
18
+ tag: "ChainConnect";
19
+ value: {
20
+ genesisHash: `0x${string}`;
21
+ name: string;
22
+ };
23
+ } | {
24
+ tag: "NetworkRequest";
25
+ value: string[];
26
+ }>;
27
+ export declare const PermissionRequestV1_request: import("scale-ts").Codec<{
28
+ tag: "ChainSubmit";
29
+ value: `0x${string}`;
30
+ } | {
31
+ tag: "ChainConnect";
32
+ value: {
33
+ genesisHash: `0x${string}`;
34
+ name: string;
35
+ };
36
+ } | {
37
+ tag: "NetworkRequest";
38
+ value: string[];
39
+ }>;
40
+ export declare const PermissionRequestV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, {
41
+ tag: "Rejected";
42
+ value: undefined;
43
+ } | {
44
+ tag: "Unknown";
45
+ value: {
46
+ reason: string;
47
+ };
48
+ }>>;
@@ -0,0 +1,18 @@
1
+ import { Enum, Result, Struct, Vector, _void, str } from 'scale-ts';
2
+ import { GenericErr, Hex } from '../commonCodecs.js';
3
+ export const PermissionErr = Enum({
4
+ Rejected: _void,
5
+ Unknown: GenericErr,
6
+ });
7
+ export const ChainConnectPermission = Struct({
8
+ genesisHash: Hex(),
9
+ name: str,
10
+ });
11
+ export const Permission = Enum({
12
+ ChainSubmit: Hex(),
13
+ ChainConnect: ChainConnectPermission,
14
+ NetworkRequest: Vector(str),
15
+ // TBD
16
+ });
17
+ export const PermissionRequestV1_request = Permission;
18
+ export const PermissionRequestV1_response = Result(_void, PermissionErr);
@@ -0,0 +1,92 @@
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
+ }>>;
@@ -0,0 +1,43 @@
1
+ import { Bytes, Enum, Option, Result, Struct, Vector, _void, bool, str, u32 } from 'scale-ts';
2
+ import { GenericErr, GenesisHash, Hex } from '../commonCodecs.js';
3
+ // common structures
4
+ export const SigningErr = Enum({
5
+ FailedToDecode: _void,
6
+ Rejected: _void,
7
+ Unknown: GenericErr,
8
+ });
9
+ export const SigningResult = Struct({
10
+ signature: Hex(),
11
+ signedTransaction: Option(Hex()),
12
+ });
13
+ // sign raw
14
+ const SigningRawPayload = Struct({
15
+ address: str,
16
+ data: Enum({
17
+ Bytes: Bytes(),
18
+ Payload: str,
19
+ }),
20
+ });
21
+ export const SignRawV1_request = SigningRawPayload;
22
+ export const SignRawV1_response = Result(SigningResult, SigningErr);
23
+ // sign payload
24
+ export const SigningPayload = Struct({
25
+ address: str,
26
+ blockHash: Hex(),
27
+ blockNumber: Hex(),
28
+ era: Hex(),
29
+ genesisHash: GenesisHash,
30
+ method: Hex(),
31
+ nonce: Hex(),
32
+ specVersion: Hex(),
33
+ tip: Hex(),
34
+ transactionVersion: Hex(),
35
+ signedExtensions: Vector(str),
36
+ version: u32,
37
+ assetId: Option(Hex()),
38
+ metadataHash: Option(Hex()),
39
+ mode: Option(u32),
40
+ withSignedTransaction: Option(bool),
41
+ });
42
+ export const SignPayloadV1_request = SigningPayload;
43
+ export const SignPayloadV1_response = Result(SigningResult, SigningErr);
@@ -0,0 +1,118 @@
1
+ export declare const Topic: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
2
+ export declare const Channel: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
3
+ export declare const DecryptionKey: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
4
+ export declare const Statement: import("scale-ts").Codec<{
5
+ proof: {
6
+ tag: "Sr25519";
7
+ value: {
8
+ signature: Uint8Array<ArrayBufferLike>;
9
+ signer: Uint8Array<ArrayBufferLike>;
10
+ };
11
+ } | {
12
+ tag: "Ed25519";
13
+ value: {
14
+ signature: Uint8Array<ArrayBufferLike>;
15
+ signer: Uint8Array<ArrayBufferLike>;
16
+ };
17
+ } | {
18
+ tag: "Ecdsa";
19
+ value: {
20
+ signature: Uint8Array<ArrayBufferLike>;
21
+ signer: Uint8Array<ArrayBufferLike>;
22
+ };
23
+ } | {
24
+ tag: "OnChain";
25
+ value: {
26
+ who: Uint8Array<ArrayBufferLike>;
27
+ blockHash: Uint8Array<ArrayBufferLike>;
28
+ event: bigint;
29
+ };
30
+ } | undefined;
31
+ decryptionKey: Uint8Array<ArrayBufferLike> | undefined;
32
+ priority: number | undefined;
33
+ channel: Uint8Array<ArrayBufferLike> | undefined;
34
+ topics: Uint8Array<ArrayBufferLike>[];
35
+ data: Uint8Array<ArrayBufferLike> | undefined;
36
+ }>;
37
+ export declare const StatementProofErr: import("scale-ts").Codec<{
38
+ tag: "Unknown";
39
+ value: {
40
+ reason: string;
41
+ };
42
+ } | {
43
+ tag: "UnableToSign";
44
+ value: undefined;
45
+ } | {
46
+ tag: "UnknownAccount";
47
+ value: undefined;
48
+ }>;
49
+ export declare const StatementStoreCreateProofV1_request: import("scale-ts").Codec<[[string, number], {
50
+ proof: {
51
+ tag: "Sr25519";
52
+ value: {
53
+ signature: Uint8Array<ArrayBufferLike>;
54
+ signer: Uint8Array<ArrayBufferLike>;
55
+ };
56
+ } | {
57
+ tag: "Ed25519";
58
+ value: {
59
+ signature: Uint8Array<ArrayBufferLike>;
60
+ signer: Uint8Array<ArrayBufferLike>;
61
+ };
62
+ } | {
63
+ tag: "Ecdsa";
64
+ value: {
65
+ signature: Uint8Array<ArrayBufferLike>;
66
+ signer: Uint8Array<ArrayBufferLike>;
67
+ };
68
+ } | {
69
+ tag: "OnChain";
70
+ value: {
71
+ who: Uint8Array<ArrayBufferLike>;
72
+ blockHash: Uint8Array<ArrayBufferLike>;
73
+ event: bigint;
74
+ };
75
+ } | undefined;
76
+ decryptionKey: Uint8Array<ArrayBufferLike> | undefined;
77
+ priority: number | undefined;
78
+ channel: Uint8Array<ArrayBufferLike> | undefined;
79
+ topics: Uint8Array<ArrayBufferLike>[];
80
+ data: Uint8Array<ArrayBufferLike> | undefined;
81
+ }]>;
82
+ export declare const StatementStoreCreateProofV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
83
+ tag: "Sr25519";
84
+ value: {
85
+ signature: Uint8Array<ArrayBufferLike>;
86
+ signer: Uint8Array<ArrayBufferLike>;
87
+ };
88
+ } | {
89
+ tag: "Ed25519";
90
+ value: {
91
+ signature: Uint8Array<ArrayBufferLike>;
92
+ signer: Uint8Array<ArrayBufferLike>;
93
+ };
94
+ } | {
95
+ tag: "Ecdsa";
96
+ value: {
97
+ signature: Uint8Array<ArrayBufferLike>;
98
+ signer: Uint8Array<ArrayBufferLike>;
99
+ };
100
+ } | {
101
+ tag: "OnChain";
102
+ value: {
103
+ who: Uint8Array<ArrayBufferLike>;
104
+ blockHash: Uint8Array<ArrayBufferLike>;
105
+ event: bigint;
106
+ };
107
+ }, {
108
+ tag: "Unknown";
109
+ value: {
110
+ reason: string;
111
+ };
112
+ } | {
113
+ tag: "UnableToSign";
114
+ value: undefined;
115
+ } | {
116
+ tag: "UnknownAccount";
117
+ value: undefined;
118
+ }>>;
@@ -0,0 +1,47 @@
1
+ import { Bytes, Enum, Option, Result, Struct, Tuple, Vector, _void, u32, u64 } from 'scale-ts';
2
+ import { GenericErr } from '../commonCodecs.js';
3
+ import { ProductAccountId } from './accounts.js';
4
+ // structs definition
5
+ export const Topic = Bytes(32);
6
+ export const Channel = Bytes(32);
7
+ export const DecryptionKey = Bytes(32);
8
+ // Proof structures
9
+ const Sr25519StatementProof = Struct({
10
+ signature: Bytes(64),
11
+ signer: Bytes(32),
12
+ });
13
+ const Ed25519StatementProof = Struct({
14
+ signature: Bytes(64),
15
+ signer: Bytes(32),
16
+ });
17
+ const EcdsaStatementProof = Struct({
18
+ signature: Bytes(65),
19
+ signer: Bytes(33),
20
+ });
21
+ const OnChainStatementProof = Struct({
22
+ who: Bytes(32),
23
+ blockHash: Bytes(32),
24
+ event: u64,
25
+ });
26
+ const StatementProof = Enum({
27
+ Sr25519: Sr25519StatementProof,
28
+ Ed25519: Ed25519StatementProof,
29
+ Ecdsa: EcdsaStatementProof,
30
+ OnChain: OnChainStatementProof,
31
+ });
32
+ export const Statement = Struct({
33
+ proof: Option(StatementProof),
34
+ decryptionKey: Option(DecryptionKey),
35
+ priority: Option(u32),
36
+ channel: Option(Channel),
37
+ topics: Vector(Topic),
38
+ data: Option(Bytes()),
39
+ });
40
+ // creating proof
41
+ export const StatementProofErr = Enum({
42
+ UnableToSign: _void,
43
+ UnknownAccount: _void,
44
+ Unknown: GenericErr,
45
+ });
46
+ export const StatementStoreCreateProofV1_request = Tuple(ProductAccountId, Statement);
47
+ export const StatementStoreCreateProofV1_response = Result(StatementProof, StatementProofErr);