@novasamatech/host-api 0.5.0-16 → 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.
Files changed (40) hide show
  1. package/dist/commonEncoders.d.ts +0 -7
  2. package/dist/commonEncoders.js +1 -7
  3. package/dist/createTransport.js +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/interactions/accounts.js +2 -1
  6. package/dist/interactions/commonCodecs.d.ts +7 -0
  7. package/dist/interactions/commonCodecs.js +8 -0
  8. package/dist/interactions/features.d.ts +2 -2
  9. package/dist/interactions/features.js +2 -2
  10. package/dist/interactions/message.d.ts +1704 -0
  11. package/dist/interactions/message.js +60 -0
  12. package/dist/interactions/papiProvider.d.ts +2 -2
  13. package/dist/interactions/papiProvider.js +3 -2
  14. package/dist/interactions/sign.d.ts +20 -3
  15. package/dist/interactions/sign.js +1 -42
  16. package/dist/interactions/types.d.ts +1 -0
  17. package/dist/interactions/types.js +1 -0
  18. package/dist/interactions/v1/accounts.d.ts +128 -0
  19. package/dist/interactions/v1/accounts.js +51 -0
  20. package/dist/interactions/v1/chat.d.ts +295 -0
  21. package/dist/interactions/v1/chat.js +73 -0
  22. package/dist/interactions/v1/createTransaction.d.ts +197 -0
  23. package/dist/interactions/v1/createTransaction.js +41 -0
  24. package/dist/interactions/v1/feature.d.ts +11 -0
  25. package/dist/interactions/v1/feature.js +7 -0
  26. package/dist/interactions/v1/handshake.d.ts +28 -0
  27. package/dist/interactions/v1/handshake.js +12 -0
  28. package/dist/interactions/v1/jsonRpc.d.ts +6 -0
  29. package/dist/interactions/v1/jsonRpc.js +6 -0
  30. package/dist/interactions/v1/permission.d.ts +48 -0
  31. package/dist/interactions/v1/permission.js +18 -0
  32. package/dist/interactions/v1/sign.d.ts +92 -0
  33. package/dist/interactions/v1/sign.js +43 -0
  34. package/dist/interactions/v1/statementStore.d.ts +118 -0
  35. package/dist/interactions/v1/statementStore.js +47 -0
  36. package/dist/interactions/v1/storage.d.ts +41 -0
  37. package/dist/interactions/v1/storage.js +16 -0
  38. package/dist/messageEncoder.d.ts +68 -107
  39. package/dist/messageEncoder.js +11 -14
  40. package/package.json +1 -1
@@ -1,9 +1,2 @@
1
1
  import type { Codec } from 'scale-ts';
2
2
  export declare const hexCodec: Codec<`0x${string}`>;
3
- export declare function Result<T>(codec: Codec<T>): Codec<{
4
- tag: "Ok";
5
- value: T;
6
- } | {
7
- tag: "Err";
8
- value: string;
9
- }>;
@@ -1,14 +1,8 @@
1
1
  import { fromHex, toHex } from '@polkadot-api/utils';
2
- import { Bytes, Enum, str } from 'scale-ts';
2
+ import { Bytes } from 'scale-ts';
3
3
  import { createTransportEncoder } from './createTransportEncoder.js';
4
4
  export const hexCodec = createTransportEncoder({
5
5
  codec: Bytes(),
6
6
  from: v => toHex(v),
7
7
  to: fromHex,
8
8
  });
9
- export function Result(codec) {
10
- return Enum({
11
- Ok: codec,
12
- Err: str,
13
- });
14
- }
@@ -174,7 +174,7 @@ export function createTransport(provider, params) {
174
174
  transportInstance.handleMessage('handshakeRequestV1', async () => ({
175
175
  tag: 'handshakeResponseV1',
176
176
  value: {
177
- tag: 'Ok',
177
+ success: true,
178
178
  value: undefined,
179
179
  },
180
180
  }));
package/dist/index.d.ts CHANGED
@@ -4,5 +4,5 @@ export { createTransport } from './createTransport.js';
4
4
  export type { ConnectionStatus, HexString, Logger, Transport, TransportProvider } from './types.js';
5
5
  export { createDefaultLogger } from './logger.js';
6
6
  export { type InjectedAccountSchema } from './interactions/accounts.js';
7
- export { type TxPayloadV1 } from './interactions/sign.js';
7
+ export { type SignPayloadRequest, type TxPayloadV1 } from './interactions/sign.js';
8
8
  export { signPayloadCodec } from './interactions/sign.js';
@@ -1,4 +1,5 @@
1
1
  import { Enum, Option, Struct, Vector, _void, str } from 'scale-ts';
2
+ import { hexCodec } from '../commonEncoders.js';
2
3
  import { createTransportEncoder } from '../createTransportEncoder.js';
3
4
  const keypairCodec = Enum({
4
5
  ed25519: _void,
@@ -15,7 +16,7 @@ const keypairEncoder = createTransportEncoder({
15
16
  });
16
17
  const injectedAccountCodec = Struct({
17
18
  address: str,
18
- genesisHash: Option(str),
19
+ genesisHash: Option(hexCodec),
19
20
  name: Option(str),
20
21
  type: Option(keypairEncoder),
21
22
  });
@@ -0,0 +1,7 @@
1
+ import type { Codec } from 'scale-ts';
2
+ export declare const Nullable: <T>(inner: Codec<T>) => Codec<T | null>;
3
+ export declare const Hex: (length?: number) => Codec<`0x${string}`>;
4
+ export declare const GenericErr: Codec<{
5
+ reason: string;
6
+ }>;
7
+ export declare const GenesisHash: Codec<`0x${string}`>;
@@ -0,0 +1,8 @@
1
+ import { fromHex, toHex } from '@polkadot-api/utils';
2
+ import { Bytes, Option, Struct, enhanceCodec, str } from 'scale-ts';
3
+ export const Nullable = (inner) => enhanceCodec(Option(inner), v => v ?? undefined, v => v ?? null);
4
+ export const Hex = (length) => enhanceCodec(Bytes(length), fromHex, v => toHex(v));
5
+ export const GenericErr = Struct({
6
+ reason: str,
7
+ });
8
+ export const GenesisHash = Hex();
@@ -1,13 +1,13 @@
1
1
  export declare const supportFeatureRequestV1Encoder: import("scale-ts").Codec<{
2
2
  tag: "chain";
3
3
  value: {
4
- chainId: `0x${string}`;
4
+ genesisHash: `0x${string}`;
5
5
  };
6
6
  }>;
7
7
  export declare const supportFeatureResponseV1: import("scale-ts").Codec<{
8
8
  tag: "chain";
9
9
  value: {
10
- chainId: `0x${string}`;
10
+ genesisHash: `0x${string}`;
11
11
  result: boolean;
12
12
  };
13
13
  }>;
@@ -2,12 +2,12 @@ import { Enum, Struct, bool } from 'scale-ts';
2
2
  import { hexCodec } from '../commonEncoders.js';
3
3
  export const supportFeatureRequestV1Encoder = Enum({
4
4
  chain: Struct({
5
- chainId: hexCodec,
5
+ genesisHash: hexCodec,
6
6
  }),
7
7
  });
8
8
  export const supportFeatureResponseV1 = Enum({
9
9
  chain: Struct({
10
- chainId: hexCodec,
10
+ genesisHash: hexCodec,
11
11
  result: bool,
12
12
  }),
13
13
  });