@novasamatech/host-api 0.8.11 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,50 @@
1
- import { Enum, ErrEnum, Hex, Status } from '@novasamatech/scale';
2
- import { Bytes, Option, Result, Struct, Tuple, Vector, _void, str, u32, u8 } from 'scale-ts';
3
- import { GenericErr } from '../commonCodecs.js';
1
+ import { Bytes, Enum, ErrEnum, Status } from '@novasamatech/scale';
2
+ import { Option, Result, Struct, Tuple, Vector, _void, str, u32, u8 } from 'scale-ts';
3
+ import { GenericErr, GenesisHash } from '../commonCodecs.js';
4
4
  // common types
5
5
  export const AccountId = Bytes(32);
6
6
  export const PublicKey = Bytes();
7
7
  export const DotNsIdentifier = str;
8
- export const DerivationIndex = u32;
8
+ /**
9
+ * Raw 32-byte derivation index — the escape hatch for byte-valued selectors.
10
+ * Used directly as the soft-junction chain code of `//product//{productId}/{index}`.
11
+ */
12
+ export const RawDerivationIndex = Bytes(32);
13
+ /**
14
+ * Account selector within a product subtree: `Index(u32) | Raw([u8; 32])` (RFC 0022).
15
+ *
16
+ * `Index` is the primary form — plain indices keep a product's accounts
17
+ * enumerable. `Raw` carries a raw 32-byte index. Hosts expand `Index(n)` to
18
+ * the internal 32-byte index (`u32` little-endian ++ index magic) and pass
19
+ * `Raw(bytes)` through unchanged.
20
+ */
21
+ export const DerivationIndex = Enum({
22
+ Index: u32,
23
+ Raw: RawDerivationIndex,
24
+ });
9
25
  export const ProductAccountId = Tuple(DotNsIdentifier, DerivationIndex);
10
26
  export const RingVrgAlias = Bytes();
27
+ /**
28
+ * Normalizes an {@link AccountSelector} into the wire {@link DerivationIndex}:
29
+ * numbers become `Index`, 32-byte arrays become `Raw`.
30
+ */
31
+ export function derivationIndexOf(selector) {
32
+ if (typeof selector === 'number') {
33
+ return { tag: 'Index', value: selector };
34
+ }
35
+ if (selector.length !== RawDerivationIndex.size) {
36
+ throw new Error(`Raw derivation index must be ${RawDerivationIndex.size} bytes, got ${selector.length}`);
37
+ }
38
+ return { tag: 'Raw', value: selector };
39
+ }
11
40
  export const ProductId = DotNsIdentifier;
12
- export const ProductProofContextSuffix = Hex();
41
+ /**
42
+ * Selector distinguishing proof contexts within a product (RFC 0004 amended by
43
+ * RFC 0022). Expands to the same 32-byte derivation index as
44
+ * {@link ProductAccountId}'s index, so the alias ↔ account mapping is the
45
+ * identity on it.
46
+ */
47
+ export const ProductProofContextSuffix = DerivationIndex;
13
48
  export const ProductProofContext = Tuple(ProductId, ProductProofContextSuffix);
14
49
  // structs
15
50
  export const ProductAccount = Struct({
@@ -37,10 +72,19 @@ export const RingLocationJunction = Enum({
37
72
  CollectionId: Bytes(),
38
73
  });
39
74
  export const RingLocation = Struct({
40
- // TODO make GenesisHash fixed size and replace hardcoded codec with it
41
- chainId: Hex(32),
75
+ chainId: GenesisHash,
42
76
  junctions: Vector(RingLocationJunction),
43
77
  });
78
+ /** One `transcript.append_message(label, value)` call replayed by the host. */
79
+ export const VrfTranscriptItem = Struct({
80
+ label: Bytes(),
81
+ value: Bytes(),
82
+ });
83
+ /** schnorrkel VRF output: a 32-byte `VRFPreOut` and a 64-byte `VRFProof`. */
84
+ export const VrfSignature = Struct({
85
+ preOutput: Bytes(32),
86
+ proof: Bytes(64),
87
+ });
44
88
  // errors
45
89
  export const RequestCredentialsErr = ErrEnum('RequestCredentialsErr', {
46
90
  NotConnected: [_void, 'RequestCredentials: not connected'],
@@ -65,6 +109,11 @@ export const GetUserIdErr = ErrEnum('GetUserIdErr', {
65
109
  NotConnected: [_void, 'GetUserId: not connected'],
66
110
  Unknown: [GenericErr, 'GetUserId: unknown error'],
67
111
  });
112
+ export const SignVrfErr = ErrEnum('SignVrfErr', {
113
+ NotConnected: [_void, 'SignVrf: not connected'],
114
+ Rejected: [_void, 'SignVrf: rejected'],
115
+ Unknown: [GenericErr, 'SignVrf: unknown error'],
116
+ });
68
117
  // account connection status
69
118
  export const AccountConnectionStatus = Status('disconnected', 'connected');
70
119
  export const AccountConnectionStatusV1_start = _void;
@@ -82,6 +131,18 @@ export const AccountGetAliasV1_response = Result(ContextualAlias, GetAliasErr);
82
131
  // account_create_proof
83
132
  export const AccountCreateProofV1_request = Tuple(ProductProofContext, RingLocation, Bytes());
84
133
  export const AccountCreateProofV1_response = Result(RingVrfProof, CreateProofErr);
134
+ // account_sign_vrf
135
+ /**
136
+ * The host replays the transcript verbatim — `Transcript::new(transcriptLabel)`
137
+ * followed by `append_message(item.label, item.value)` per item, in order — and
138
+ * performs no interpretation of labels or values (RFC-0023).
139
+ */
140
+ export const AccountSignVrfV1_request = Struct({
141
+ account: ProductAccountId,
142
+ transcriptLabel: Bytes(),
143
+ items: Vector(VrfTranscriptItem),
144
+ });
145
+ export const AccountSignVrfV1_response = Result(VrfSignature, SignVrfErr);
85
146
  // get_legacy_accounts
86
147
  export const GetLegacyAccountsV1_request = _void;
87
148
  export const GetLegacyAccountsV1_response = Result(Vector(LegacyAccount), RequestCredentialsErr);
@@ -330,15 +330,15 @@ export declare const ChainHeadStopOperationV1_request: import("scale-ts").Codec<
330
330
  export declare const ChainHeadStopOperationV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
331
331
  reason: string;
332
332
  }, "GenericError">>>;
333
- export declare const ChainSpecGenesisHashV1_request: import("scale-ts").Codec<`0x${string}`>;
333
+ export declare const ChainSpecGenesisHashV1_request: import("@novasamatech/scale").HexCodec<undefined>;
334
334
  export declare const ChainSpecGenesisHashV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<`0x${string}`, import("@novasamatech/scale").CodecError<{
335
335
  reason: string;
336
336
  }, "GenericError">>>;
337
- export declare const ChainSpecChainNameV1_request: import("scale-ts").Codec<`0x${string}`>;
337
+ export declare const ChainSpecChainNameV1_request: import("@novasamatech/scale").HexCodec<undefined>;
338
338
  export declare const ChainSpecChainNameV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<string, import("@novasamatech/scale").CodecError<{
339
339
  reason: string;
340
340
  }, "GenericError">>>;
341
- export declare const ChainSpecPropertiesV1_request: import("scale-ts").Codec<`0x${string}`>;
341
+ export declare const ChainSpecPropertiesV1_request: import("@novasamatech/scale").HexCodec<undefined>;
342
342
  export declare const ChainSpecPropertiesV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<string, import("@novasamatech/scale").CodecError<{
343
343
  reason: string;
344
344
  }, "GenericError">>>;
@@ -1,6 +1,6 @@
1
1
  import { Enum, Hex, Nullable, Status } from '@novasamatech/scale';
2
2
  import { Option, Result, Struct, Tuple, Vector, _void, bool, str, u32 } from 'scale-ts';
3
- import { GenericError, GenesisHash } from '../commonCodecs.js';
3
+ import { GenericError } from '../commonCodecs.js';
4
4
  // === Shared types ===
5
5
  const BlockHash = Hex();
6
6
  const OperationId = str;
@@ -37,7 +37,7 @@ export const OperationStartedResult = Enum({
37
37
  });
38
38
  // === ChainHead Follow ===
39
39
  export const ChainHeadFollowV1_start = Struct({
40
- genesisHash: GenesisHash,
40
+ genesisHash: Hex(),
41
41
  withRuntime: bool,
42
42
  });
43
43
  export const ChainHeadEvent = Enum({
@@ -88,21 +88,21 @@ export const ChainHeadFollowV1_receive = ChainHeadEvent;
88
88
  export const ChainHeadFollowV1_interrupt = _void;
89
89
  // === ChainHead Header ===
90
90
  export const ChainHeadHeaderV1_request = Struct({
91
- genesisHash: GenesisHash,
91
+ genesisHash: Hex(),
92
92
  followSubscriptionId: str,
93
93
  hash: BlockHash,
94
94
  });
95
95
  export const ChainHeadHeaderV1_response = Result(Nullable(Hex()), GenericError);
96
96
  // === ChainHead Body ===
97
97
  export const ChainHeadBodyV1_request = Struct({
98
- genesisHash: GenesisHash,
98
+ genesisHash: Hex(),
99
99
  followSubscriptionId: str,
100
100
  hash: BlockHash,
101
101
  });
102
102
  export const ChainHeadBodyV1_response = Result(OperationStartedResult, GenericError);
103
103
  // === ChainHead Storage ===
104
104
  export const ChainHeadStorageV1_request = Struct({
105
- genesisHash: GenesisHash,
105
+ genesisHash: Hex(),
106
106
  followSubscriptionId: str,
107
107
  hash: BlockHash,
108
108
  items: Vector(StorageQueryItem),
@@ -111,7 +111,7 @@ export const ChainHeadStorageV1_request = Struct({
111
111
  export const ChainHeadStorageV1_response = Result(OperationStartedResult, GenericError);
112
112
  // === ChainHead Call ===
113
113
  export const ChainHeadCallV1_request = Struct({
114
- genesisHash: GenesisHash,
114
+ genesisHash: Hex(),
115
115
  followSubscriptionId: str,
116
116
  hash: BlockHash,
117
117
  function: str,
@@ -120,41 +120,41 @@ export const ChainHeadCallV1_request = Struct({
120
120
  export const ChainHeadCallV1_response = Result(OperationStartedResult, GenericError);
121
121
  // === ChainHead Unpin ===
122
122
  export const ChainHeadUnpinV1_request = Struct({
123
- genesisHash: GenesisHash,
123
+ genesisHash: Hex(),
124
124
  followSubscriptionId: str,
125
125
  hashes: Vector(BlockHash),
126
126
  });
127
127
  export const ChainHeadUnpinV1_response = Result(_void, GenericError);
128
128
  // === ChainHead Continue ===
129
129
  export const ChainHeadContinueV1_request = Struct({
130
- genesisHash: GenesisHash,
130
+ genesisHash: Hex(),
131
131
  followSubscriptionId: str,
132
132
  operationId: OperationId,
133
133
  });
134
134
  export const ChainHeadContinueV1_response = Result(_void, GenericError);
135
135
  // === ChainHead StopOperation ===
136
136
  export const ChainHeadStopOperationV1_request = Struct({
137
- genesisHash: GenesisHash,
137
+ genesisHash: Hex(),
138
138
  followSubscriptionId: str,
139
139
  operationId: OperationId,
140
140
  });
141
141
  export const ChainHeadStopOperationV1_response = Result(_void, GenericError);
142
142
  // === ChainSpec ===
143
- export const ChainSpecGenesisHashV1_request = GenesisHash;
143
+ export const ChainSpecGenesisHashV1_request = Hex();
144
144
  export const ChainSpecGenesisHashV1_response = Result(Hex(), GenericError);
145
- export const ChainSpecChainNameV1_request = GenesisHash;
145
+ export const ChainSpecChainNameV1_request = Hex();
146
146
  export const ChainSpecChainNameV1_response = Result(str, GenericError);
147
- export const ChainSpecPropertiesV1_request = GenesisHash;
147
+ export const ChainSpecPropertiesV1_request = Hex();
148
148
  export const ChainSpecPropertiesV1_response = Result(str, GenericError);
149
149
  // === Transaction Broadcast ===
150
150
  export const TransactionBroadcastV1_request = Struct({
151
- genesisHash: GenesisHash,
151
+ genesisHash: Hex(),
152
152
  transaction: Hex(),
153
153
  });
154
154
  export const TransactionBroadcastV1_response = Result(Nullable(str), GenericError);
155
155
  // === Transaction Stop ===
156
156
  export const TransactionStopV1_request = Struct({
157
- genesisHash: GenesisHash,
157
+ genesisHash: Hex(),
158
158
  operationId: str,
159
159
  });
160
160
  export const TransactionStopV1_response = Result(_void, GenericError);
@@ -1,5 +1,5 @@
1
- import { Enum, ErrEnum, Status } from '@novasamatech/scale';
2
- import { Bytes, Option, Result, Struct, Vector, _void, str, u64 } from 'scale-ts';
1
+ import { Bytes, Enum, ErrEnum, Status } from '@novasamatech/scale';
2
+ import { Option, Result, Struct, Vector, _void, str, u64 } from 'scale-ts';
3
3
  import { GenericErr } from '../commonCodecs.js';
4
4
  import { CustomRendererNode } from './customRenderer.js';
5
5
  // room registration
@@ -34,8 +34,14 @@ export declare const TxPayloadExtensionV1: Codec<{
34
34
  additionalSigned: Uint8Array<ArrayBufferLike>;
35
35
  }>;
36
36
  export declare const ProductAccountTransaction: Codec<{
37
- signer: [string, number];
38
- genesisHash: Uint8Array<ArrayBufferLike>;
37
+ signer: [string, {
38
+ tag: "Index";
39
+ value: number;
40
+ } | {
41
+ tag: "Raw";
42
+ value: Uint8Array<ArrayBufferLike>;
43
+ }];
44
+ genesisHash: `0x${string}`;
39
45
  callData: Uint8Array<ArrayBufferLike>;
40
46
  extensions: {
41
47
  id: string;
@@ -46,7 +52,7 @@ export declare const ProductAccountTransaction: Codec<{
46
52
  }>;
47
53
  export declare const LegacyTransaction: Codec<{
48
54
  signer: Uint8Array<ArrayBufferLike>;
49
- genesisHash: Uint8Array<ArrayBufferLike>;
55
+ genesisHash: `0x${string}`;
50
56
  callData: Uint8Array<ArrayBufferLike>;
51
57
  extensions: {
52
58
  id: string;
@@ -56,8 +62,14 @@ export declare const LegacyTransaction: Codec<{
56
62
  txExtVersion: number;
57
63
  }>;
58
64
  export declare const CreateTransactionV1_request: Codec<{
59
- signer: [string, number];
60
- genesisHash: Uint8Array<ArrayBufferLike>;
65
+ signer: [string, {
66
+ tag: "Index";
67
+ value: number;
68
+ } | {
69
+ tag: "Raw";
70
+ value: Uint8Array<ArrayBufferLike>;
71
+ }];
72
+ genesisHash: `0x${string}`;
61
73
  callData: Uint8Array<ArrayBufferLike>;
62
74
  extensions: {
63
75
  id: string;
@@ -71,7 +83,7 @@ export declare const CreateTransactionV1_response: Codec<import("scale-ts").Resu
71
83
  }, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>>;
72
84
  export declare const CreateTransactionWithLegacyAccountV1_request: Codec<{
73
85
  signer: Uint8Array<ArrayBufferLike>;
74
- genesisHash: Uint8Array<ArrayBufferLike>;
86
+ genesisHash: `0x${string}`;
75
87
  callData: Uint8Array<ArrayBufferLike>;
76
88
  extensions: {
77
89
  id: string;
@@ -1,6 +1,6 @@
1
- import { ErrEnum } from '@novasamatech/scale';
2
- import { Bytes, Result, Struct, Vector, _void, str, u8 } from 'scale-ts';
3
- import { GenericErr } from '../commonCodecs.js';
1
+ import { Bytes, ErrEnum } from '@novasamatech/scale';
2
+ import { Result, Struct, Vector, _void, str, u8 } from 'scale-ts';
3
+ import { GenericErr, GenesisHash } from '../commonCodecs.js';
4
4
  import { AccountId, ProductAccountId } from './accounts.js';
5
5
  /**
6
6
  * createTransaction implementation
@@ -36,7 +36,7 @@ function GenericTxPayloadV1(signer) {
36
36
  /**
37
37
  * Chain identifier where transaction will be executed
38
38
  */
39
- genesisHash: Bytes(32),
39
+ genesisHash: GenesisHash,
40
40
  /**
41
41
  * SCALE-encoded Call (module indicator + function indicator + params).
42
42
  */
@@ -18,8 +18,8 @@ export declare const DeriveEntropyErr: [import("scale-ts").Encoder<import("@nova
18
18
  reason: string;
19
19
  }, "DeriveEntropyErr::Unknown">;
20
20
  };
21
- export declare const Entropy: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
22
- export declare const DeriveEntropyV1_request: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
21
+ export declare const Entropy: import("@novasamatech/scale").BytesCodec<number>;
22
+ export declare const DeriveEntropyV1_request: import("@novasamatech/scale").BytesCodec<undefined>;
23
23
  export declare const DeriveEntropyV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike>, import("@novasamatech/scale").CodecError<{
24
24
  reason: string;
25
25
  }, "DeriveEntropyErr::Unknown">>>;
@@ -1,5 +1,5 @@
1
- import { ErrEnum } from '@novasamatech/scale';
2
- import { Bytes, Result } from 'scale-ts';
1
+ import { Bytes, ErrEnum } from '@novasamatech/scale';
2
+ import { Result } from 'scale-ts';
3
3
  import { GenericErr } from '../commonCodecs.js';
4
4
  // common structures
5
5
  export const DeriveEntropyErr = ErrEnum('DeriveEntropyErr', {
@@ -1,8 +1,8 @@
1
- import { Enum } from '@novasamatech/scale';
1
+ import { Enum, Hex } from '@novasamatech/scale';
2
2
  import { Result, bool } from 'scale-ts';
3
- import { GenericError, GenesisHash } from '../commonCodecs.js';
3
+ import { GenericError } from '../commonCodecs.js';
4
4
  export const Feature = Enum({
5
- Chain: GenesisHash,
5
+ Chain: Hex(),
6
6
  });
7
7
  export const FeatureV1_request = Feature;
8
8
  export const FeatureV1_response = Result(bool, GenericError);
@@ -20,7 +20,7 @@ export declare const StorageErr: [import("scale-ts").Encoder<import("@novasamate
20
20
  }, "StorageErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StorageErr::Full">;
21
21
  };
22
22
  export declare const StorageKey: import("scale-ts").Codec<string>;
23
- export declare const StorageValue: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
23
+ export declare const StorageValue: import("@novasamatech/scale").BytesCodec<undefined>;
24
24
  export declare const StorageReadV1_request: import("scale-ts").Codec<string>;
25
25
  export declare const StorageReadV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike> | undefined, import("@novasamatech/scale").CodecError<{
26
26
  reason: string;
@@ -1,5 +1,5 @@
1
- import { ErrEnum } from '@novasamatech/scale';
2
- import { Bytes, Option, Result, Tuple, _void, str } from 'scale-ts';
1
+ import { Bytes, ErrEnum } from '@novasamatech/scale';
2
+ import { Option, Result, Tuple, _void, str } from 'scale-ts';
3
3
  import { GenericErr } from '../commonCodecs.js';
4
4
  // common structures
5
5
  export const StorageErr = ErrEnum('StorageErr', {
@@ -1,9 +1,15 @@
1
- export declare const Sr25519SecretKey: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
1
+ export declare const Sr25519SecretKey: import("@novasamatech/scale").BytesCodec<number>;
2
2
  export declare const PaymentId: import("scale-ts").Codec<string>;
3
3
  export declare const CoinPaymentPurseId: import("scale-ts").Codec<number>;
4
4
  export declare const PaymentTopUpSource: import("scale-ts").Codec<{
5
5
  tag: "ProductAccount";
6
- value: number;
6
+ value: {
7
+ tag: "Index";
8
+ value: number;
9
+ } | {
10
+ tag: "Raw";
11
+ value: Uint8Array<ArrayBufferLike>;
12
+ };
7
13
  } | {
8
14
  tag: "PrivateKey";
9
15
  value: Uint8Array<ArrayBufferLike>;
@@ -161,7 +167,13 @@ export declare const PaymentTopUpV1_request: import("scale-ts").Codec<{
161
167
  amount: bigint;
162
168
  source: {
163
169
  tag: "ProductAccount";
164
- value: number;
170
+ value: {
171
+ tag: "Index";
172
+ value: number;
173
+ } | {
174
+ tag: "Raw";
175
+ value: Uint8Array<ArrayBufferLike>;
176
+ };
165
177
  } | {
166
178
  tag: "PrivateKey";
167
179
  value: Uint8Array<ArrayBufferLike>;
@@ -1,5 +1,5 @@
1
- import { Enum, ErrEnum } from '@novasamatech/scale';
2
- import { Bytes, Option, Result, Struct, Vector, _void, str, u128, u32 } from 'scale-ts';
1
+ import { Bytes, Enum, ErrEnum } from '@novasamatech/scale';
2
+ import { Option, Result, Struct, Vector, _void, str, u128, u32 } from 'scale-ts';
3
3
  import { GenericErr } from '../commonCodecs.js';
4
4
  import { DerivationIndex } from './accounts.js';
5
5
  // common types
@@ -8,6 +8,7 @@ export const PaymentId = str;
8
8
  // Optional purse selector (RFC 0017). `undefined` (None) targets MAIN_PURSE.
9
9
  export const CoinPaymentPurseId = u32;
10
10
  export const PaymentTopUpSource = Enum({
11
+ // Account of the calling product, addressed by the RFC-0022 selector.
11
12
  ProductAccount: DerivationIndex,
12
13
  PrivateKey: Sr25519SecretKey,
13
14
  Coins: Vector(Sr25519SecretKey),
@@ -1,6 +1,6 @@
1
- export declare const PreimageKey: import("scale-ts").Codec<`0x${string}`>;
2
- export declare const PreimageValue: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
3
- export declare const PreimageLookupSubscribeV1_start: import("scale-ts").Codec<`0x${string}`>;
1
+ export declare const PreimageKey: import("@novasamatech/scale").HexCodec<undefined>;
2
+ export declare const PreimageValue: import("@novasamatech/scale").BytesCodec<undefined>;
3
+ export declare const PreimageLookupSubscribeV1_start: import("@novasamatech/scale").HexCodec<undefined>;
4
4
  export declare const PreimageLookupSubscribeV1_receive: import("scale-ts").Codec<Uint8Array<ArrayBufferLike> | null>;
5
5
  export declare const PreimageLookupSubscribeV1_interrupt: import("scale-ts").Codec<undefined>;
6
6
  export declare const PreimageSubmitErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
@@ -23,7 +23,7 @@ export declare const PreimageSubmitErr: [import("scale-ts").Encoder<import("@nov
23
23
  reason: string;
24
24
  }, "PreimageSubmitErr::Unknown">;
25
25
  };
26
- export declare const PreimageSubmitV1_request: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
26
+ export declare const PreimageSubmitV1_request: import("@novasamatech/scale").BytesCodec<undefined>;
27
27
  export declare const PreimageSubmitV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<`0x${string}`, import("@novasamatech/scale").CodecError<{
28
28
  reason: string;
29
29
  }, "PreimageSubmitErr::Unknown">>>;
@@ -1,5 +1,5 @@
1
- import { ErrEnum, Hex, Nullable } from '@novasamatech/scale';
2
- import { Bytes, Result, _void } from 'scale-ts';
1
+ import { Bytes, ErrEnum, Hex, Nullable } from '@novasamatech/scale';
2
+ import { 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,7 +6,13 @@ export declare const AllocatableResource: import("scale-ts").Codec<{
6
6
  value: undefined;
7
7
  } | {
8
8
  tag: "SmartContractAllowance";
9
- value: number;
9
+ value: {
10
+ tag: "Index";
11
+ value: number;
12
+ } | {
13
+ tag: "Raw";
14
+ value: Uint8Array<ArrayBufferLike>;
15
+ };
10
16
  } | {
11
17
  tag: "AutoSigning";
12
18
  value: undefined;
@@ -49,7 +55,13 @@ export declare const RequestResourceAllocationV1_request: import("scale-ts").Cod
49
55
  value: undefined;
50
56
  } | {
51
57
  tag: "SmartContractAllowance";
52
- value: number;
58
+ value: {
59
+ tag: "Index";
60
+ value: number;
61
+ } | {
62
+ tag: "Raw";
63
+ value: Uint8Array<ArrayBufferLike>;
64
+ };
53
65
  } | {
54
66
  tag: "AutoSigning";
55
67
  value: undefined;
@@ -6,6 +6,7 @@ import { DerivationIndex } from './accounts.js';
6
6
  export const AllocatableResource = Enum({
7
7
  StatementStoreAllowance: _void,
8
8
  BulletinAllowance: _void,
9
+ // Account the allowance is granted for, addressed by the RFC-0022 selector.
9
10
  SmartContractAllowance: DerivationIndex,
10
11
  AutoSigning: _void,
11
12
  });
@@ -33,7 +33,13 @@ export declare const RawPayload: import("scale-ts").Codec<{
33
33
  value: string;
34
34
  }>;
35
35
  export declare const SigningRawPayload: import("scale-ts").Codec<{
36
- account: [string, number];
36
+ account: [string, {
37
+ tag: "Index";
38
+ value: number;
39
+ } | {
40
+ tag: "Raw";
41
+ value: Uint8Array<ArrayBufferLike>;
42
+ }];
37
43
  payload: {
38
44
  tag: "Bytes";
39
45
  value: Uint8Array<ArrayBufferLike>;
@@ -53,7 +59,13 @@ export declare const SigningRawPayloadWithoutAccount: import("scale-ts").Codec<{
53
59
  };
54
60
  }>;
55
61
  export declare const SignRawV1_request: import("scale-ts").Codec<{
56
- account: [string, number];
62
+ account: [string, {
63
+ tag: "Index";
64
+ value: number;
65
+ } | {
66
+ tag: "Raw";
67
+ value: Uint8Array<ArrayBufferLike>;
68
+ }];
57
69
  payload: {
58
70
  tag: "Bytes";
59
71
  value: Uint8Array<ArrayBufferLike>;
@@ -85,7 +97,13 @@ export declare const SignRawWithLegacyAccountV1_response: import("scale-ts").Cod
85
97
  reason: string;
86
98
  }, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>>;
87
99
  export declare const SigningPayload: import("scale-ts").Codec<{
88
- account: [string, number];
100
+ account: [string, {
101
+ tag: "Index";
102
+ value: number;
103
+ } | {
104
+ tag: "Raw";
105
+ value: Uint8Array<ArrayBufferLike>;
106
+ }];
89
107
  payload: {
90
108
  blockHash: `0x${string}`;
91
109
  blockNumber: `0x${string}`;
@@ -125,7 +143,13 @@ export declare const SigningPayloadWithoutAccount: import("scale-ts").Codec<{
125
143
  };
126
144
  }>;
127
145
  export declare const SignPayloadV1_request: import("scale-ts").Codec<{
128
- account: [string, number];
146
+ account: [string, {
147
+ tag: "Index";
148
+ value: number;
149
+ } | {
150
+ tag: "Raw";
151
+ value: Uint8Array<ArrayBufferLike>;
152
+ }];
129
153
  payload: {
130
154
  blockHash: `0x${string}`;
131
155
  blockNumber: `0x${string}`;
@@ -1,6 +1,6 @@
1
- import { Enum, ErrEnum, Hex } from '@novasamatech/scale';
2
- import { Bytes, Option, Result, Struct, Vector, _void, bool, str, u32 } from 'scale-ts';
3
- import { GenericErr, GenesisHash } from '../commonCodecs.js';
1
+ import { Bytes, Enum, ErrEnum, Hex } from '@novasamatech/scale';
2
+ import { Option, Result, Struct, Vector, _void, bool, str, u32 } from 'scale-ts';
3
+ import { GenericErr } from '../commonCodecs.js';
4
4
  import { ProductAccountId } from './accounts.js';
5
5
  // common structures
6
6
  export const SigningErr = ErrEnum('SigningErr', {
@@ -35,7 +35,7 @@ const SigningPayloadPayload = Struct({
35
35
  blockHash: Hex(),
36
36
  blockNumber: Hex(),
37
37
  era: Hex(),
38
- genesisHash: GenesisHash,
38
+ genesisHash: Hex(),
39
39
  method: Hex(),
40
40
  nonce: Hex(),
41
41
  specVersion: Hex(),
@@ -1,6 +1,6 @@
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>>;
1
+ export declare const Topic: import("@novasamatech/scale").BytesCodec<number>;
2
+ export declare const Channel: import("@novasamatech/scale").BytesCodec<number>;
3
+ export declare const DecryptionKey: import("@novasamatech/scale").BytesCodec<number>;
4
4
  export declare const Statement: import("scale-ts").Codec<{
5
5
  proof: {
6
6
  tag: "Sr25519";
@@ -176,7 +176,13 @@ export declare const StatementProofErr: [import("scale-ts").Encoder<import("@nov
176
176
  reason: string;
177
177
  }, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">;
178
178
  };
179
- export declare const StatementStoreCreateProofV1_request: import("scale-ts").Codec<[[string, number], {
179
+ export declare const StatementStoreCreateProofV1_request: import("scale-ts").Codec<[[string, {
180
+ tag: "Index";
181
+ value: number;
182
+ } | {
183
+ tag: "Raw";
184
+ value: Uint8Array<ArrayBufferLike>;
185
+ }], {
180
186
  proof: {
181
187
  tag: "Sr25519";
182
188
  value: {
@@ -1,5 +1,5 @@
1
- import { Enum, ErrEnum } from '@novasamatech/scale';
2
- import { Bytes, Option, Result, Struct, Tuple, Vector, _void, bool, u64 } from 'scale-ts';
1
+ import { Bytes, Enum, ErrEnum } from '@novasamatech/scale';
2
+ import { Option, Result, Struct, Tuple, Vector, _void, bool, u64 } from 'scale-ts';
3
3
  import { GenericErr, GenericError } from '../commonCodecs.js';
4
4
  import { ProductAccountId } from './accounts.js';
5
5
  // structs definition
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@novasamatech/host-api",
3
3
  "type": "module",
4
- "version": "0.8.11",
4
+ "version": "0.9.0",
5
5
  "description": "Host API: transport implementation for host - product integration.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -22,9 +22,9 @@
22
22
  "README.md"
23
23
  ],
24
24
  "dependencies": {
25
- "@novasamatech/scale": "0.8.11",
26
- "nanoevents": "9.1.0",
27
- "nanoid": "5.1.11",
25
+ "@novasamatech/scale": "0.9.0",
26
+ "nanoevents": "10.0.0",
27
+ "nanoid": "6.0.0",
28
28
  "neverthrow": "^8.2.0",
29
29
  "scale-ts": "1.6.1"
30
30
  },