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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +103 -1
  2. package/dist/constants.d.ts +2 -0
  3. package/dist/constants.js +2 -0
  4. package/dist/helpers.d.ts +33 -0
  5. package/dist/helpers.js +46 -0
  6. package/dist/hostApi.d.ts +31 -0
  7. package/dist/hostApi.js +345 -0
  8. package/dist/index.d.ts +18 -7
  9. package/dist/index.js +14 -6
  10. package/dist/protocol/commonCodecs.d.ts +42 -0
  11. package/dist/protocol/commonCodecs.js +64 -0
  12. package/dist/protocol/commonCodecs.spec.js +72 -0
  13. package/dist/protocol/impl.d.ts +93 -0
  14. package/dist/protocol/impl.js +97 -0
  15. package/dist/protocol/messageCodec.d.ts +1245 -0
  16. package/dist/protocol/messageCodec.js +24 -0
  17. package/dist/protocol/types.js +1 -0
  18. package/dist/protocol/v1/accounts.d.ts +265 -0
  19. package/dist/{interactions → protocol}/v1/accounts.js +11 -11
  20. package/dist/{interactions → protocol}/v1/chat.d.ts +129 -83
  21. package/dist/{interactions → protocol}/v1/chat.js +12 -14
  22. package/dist/{interactions → protocol}/v1/createTransaction.d.ts +119 -78
  23. package/dist/protocol/v1/createTransaction.js +58 -0
  24. package/dist/{interactions → protocol}/v1/feature.d.ts +8 -4
  25. package/dist/protocol/v1/feature.js +7 -0
  26. package/dist/protocol/v1/handshake.d.ts +85 -0
  27. package/dist/protocol/v1/handshake.js +12 -0
  28. package/dist/{interactions → protocol}/v1/jsonRpc.d.ts +6 -2
  29. package/dist/{interactions → protocol}/v1/jsonRpc.js +2 -2
  30. package/dist/protocol/v1/permission.d.ts +90 -0
  31. package/dist/protocol/v1/permission.js +18 -0
  32. package/dist/protocol/v1/sign.d.ts +152 -0
  33. package/dist/{interactions → protocol}/v1/sign.js +6 -6
  34. package/dist/{interactions → protocol}/v1/statementStore.d.ts +77 -20
  35. package/dist/{interactions → protocol}/v1/statementStore.js +6 -6
  36. package/dist/protocol/v1/storage.d.ts +87 -0
  37. package/dist/{interactions → protocol}/v1/storage.js +5 -5
  38. package/dist/provider.d.ts +8 -0
  39. package/dist/provider.js +1 -0
  40. package/dist/transport.d.ts +3 -0
  41. package/dist/transport.js +248 -0
  42. package/dist/types.d.ts +15 -15
  43. package/package.json +2 -4
  44. package/dist/commonEncoders.d.ts +0 -2
  45. package/dist/commonEncoders.js +0 -8
  46. package/dist/createTransport.d.ts +0 -6
  47. package/dist/createTransport.js +0 -183
  48. package/dist/createTransportEncoder.d.ts +0 -7
  49. package/dist/createTransportEncoder.js +0 -5
  50. package/dist/interactions/accounts.d.ts +0 -12
  51. package/dist/interactions/accounts.js +0 -40
  52. package/dist/interactions/commonCodecs.d.ts +0 -7
  53. package/dist/interactions/commonCodecs.js +0 -8
  54. package/dist/interactions/features.d.ts +0 -13
  55. package/dist/interactions/features.js +0 -13
  56. package/dist/interactions/handshake.d.ts +0 -2
  57. package/dist/interactions/handshake.js +0 -3
  58. package/dist/interactions/message.d.ts +0 -1704
  59. package/dist/interactions/message.js +0 -60
  60. package/dist/interactions/papiProvider.d.ts +0 -8
  61. package/dist/interactions/papiProvider.js +0 -10
  62. package/dist/interactions/sign.d.ts +0 -118
  63. package/dist/interactions/sign.js +0 -127
  64. package/dist/interactions/v1/accounts.d.ts +0 -128
  65. package/dist/interactions/v1/createTransaction.js +0 -41
  66. package/dist/interactions/v1/feature.js +0 -7
  67. package/dist/interactions/v1/handshake.d.ts +0 -28
  68. package/dist/interactions/v1/handshake.js +0 -12
  69. package/dist/interactions/v1/permission.d.ts +0 -48
  70. package/dist/interactions/v1/permission.js +0 -18
  71. package/dist/interactions/v1/sign.d.ts +0 -92
  72. package/dist/interactions/v1/storage.d.ts +0 -41
  73. package/dist/messageEncoder.d.ts +0 -178
  74. package/dist/messageEncoder.js +0 -34
  75. /package/dist/{interactions/types.js → protocol/commonCodecs.spec.d.ts} +0 -0
  76. /package/dist/{interactions → protocol}/types.d.ts +0 -0
@@ -1,60 +0,0 @@
1
- import { Enum, Struct, _void, str } from 'scale-ts';
2
- import { AccountCreateProofV1_request, AccountCreateProofV1_response, AccountGetAliasV1_request, AccountGetAliasV1_response, AccountGetV1_request, AccountGetV1_response, GetNonProductAccountsV1_request, GetNonProductAccountsV1_response, } from './v1/accounts.js';
3
- import { ChatActionSubscribeV1_receive, ChatActionSubscribeV1_start, ChatCreateContactV1_request, ChatCreateContactV1_response, ChatPostMessageV1_request, ChatPostMessageV1_response, } from './v1/chat.js';
4
- import { CreateTransactionV1_request, CreateTransactionV1_response, CreateTransactionWithNonProductAccountV1_request, CreateTransactionWithNonProductAccountV1_response, } from './v1/createTransaction.js';
5
- import { FeatureV1_request, FeatureV1_response } from './v1/feature.js';
6
- import { HandshakeV1_request, HandshakeV1_response } from './v1/handshake.js';
7
- import { JsonRpcMessageSendV1_request, JsonRpcMessageSendV1_response, JsonRpcMessageSubscribeV1_receive, JsonRpcMessageSubscribeV1_start, } from './v1/jsonRpc.js';
8
- import { PermissionRequestV1_request, PermissionRequestV1_response } from './v1/permission.js';
9
- import { SignPayloadV1_request, SignPayloadV1_response, SignRawV1_request, SignRawV1_response } from './v1/sign.js';
10
- import { StatementStoreCreateProofV1_request, StatementStoreCreateProofV1_response } from './v1/statementStore.js';
11
- import { StorageClearV1_request, StorageClearV1_response, StorageReadV1_request, StorageReadV1_response, StorageWriteV1_request, StorageWriteV1_response, } from './v1/storage.js';
12
- const createRequest = (key, request, response) => {
13
- return {
14
- [`${key}_request`]: request,
15
- [`${key}_response`]: response,
16
- };
17
- };
18
- const createSubscription = (key, start, receive) => {
19
- return {
20
- [`${key}_start`]: start,
21
- [`${key}_stop`]: _void,
22
- [`${key}_receive`]: receive,
23
- };
24
- };
25
- export const MessagePayloadV1 = Enum({
26
- // host requests
27
- ...createRequest('handshake', HandshakeV1_request, HandshakeV1_response),
28
- ...createRequest('feature', FeatureV1_request, FeatureV1_response),
29
- ...createRequest('permission_request', PermissionRequestV1_request, PermissionRequestV1_response),
30
- // storage
31
- ...createRequest('storage_read', StorageReadV1_request, StorageReadV1_response),
32
- ...createRequest('storage_write', StorageWriteV1_request, StorageWriteV1_response),
33
- ...createRequest('storage_clear', StorageClearV1_request, StorageClearV1_response),
34
- // accounts
35
- ...createRequest('account_get', AccountGetV1_request, AccountGetV1_response),
36
- ...createRequest('account_get_alias', AccountGetAliasV1_request, AccountGetAliasV1_response),
37
- ...createRequest('account_create_proof', AccountCreateProofV1_request, AccountCreateProofV1_response),
38
- ...createRequest('get_non_product_accounts', GetNonProductAccountsV1_request, GetNonProductAccountsV1_response),
39
- // signing
40
- ...createRequest('create_transaction', CreateTransactionV1_request, CreateTransactionV1_response),
41
- ...createRequest('create_transaction_with_non_product_account', CreateTransactionWithNonProductAccountV1_request, CreateTransactionWithNonProductAccountV1_response),
42
- ...createRequest('sign_raw', SignRawV1_request, SignRawV1_response),
43
- ...createRequest('sign_payload', SignPayloadV1_request, SignPayloadV1_response),
44
- // chat
45
- ...createRequest('chat_create_contact', ChatCreateContactV1_request, ChatCreateContactV1_response),
46
- ...createRequest('chat_post_message', ChatPostMessageV1_request, ChatPostMessageV1_response),
47
- ...createSubscription('chat_action_subscribe', ChatActionSubscribeV1_start, ChatActionSubscribeV1_receive),
48
- // statement store
49
- ...createRequest('statement_store_create_proof', StatementStoreCreateProofV1_request, StatementStoreCreateProofV1_response),
50
- // json rpc
51
- ...createRequest('jsonrpc_message_send', JsonRpcMessageSendV1_request, JsonRpcMessageSendV1_response),
52
- ...createSubscription('jsonrpc_message_subscribe', JsonRpcMessageSubscribeV1_start, JsonRpcMessageSubscribeV1_receive),
53
- });
54
- export const MessagePayload = Enum({
55
- v1: MessagePayloadV1,
56
- });
57
- export const Message = Struct({
58
- requestId: str,
59
- payload: MessagePayload,
60
- });
@@ -1,8 +0,0 @@
1
- export declare const papiProviderSendMessageV1Encoder: import("scale-ts").Codec<{
2
- genesisHash: `0x${string}`;
3
- message: string;
4
- }>;
5
- export declare const papiProviderReceiveMessageV1Encoder: import("scale-ts").Codec<{
6
- genesisHash: `0x${string}`;
7
- message: string;
8
- }>;
@@ -1,10 +0,0 @@
1
- import { Struct, str } from 'scale-ts';
2
- import { hexCodec } from '../commonEncoders.js';
3
- export const papiProviderSendMessageV1Encoder = Struct({
4
- genesisHash: hexCodec,
5
- message: str,
6
- });
7
- export const papiProviderReceiveMessageV1Encoder = Struct({
8
- genesisHash: hexCodec,
9
- message: str,
10
- });
@@ -1,118 +0,0 @@
1
- import type { SignerPayloadRaw, SignerResult } from '@polkadot/types/types';
2
- import type { CodecType } from 'scale-ts';
3
- import type { HexString } from '../types.js';
4
- /**
5
- * @see {import('@polkadot/types/types').SignerPayloadRaw}
6
- */
7
- export type SignRawRequestSchema = CodecType<typeof signRawRequestV1Encoder>;
8
- export declare const signRawRequestV1Encoder: import("scale-ts").Codec<SignerPayloadRaw>;
9
- /**
10
- * @see {import('@polkadot/types/types').SignerPayloadJSON}
11
- */
12
- export type SignPayloadRequest = CodecType<typeof signPayloadRequestV1Encoder>;
13
- export declare const signPayloadCodec: import("scale-ts").Codec<{
14
- address: string;
15
- blockHash: `0x${string}`;
16
- blockNumber: `0x${string}`;
17
- era: `0x${string}`;
18
- genesisHash: `0x${string}`;
19
- method: string;
20
- nonce: `0x${string}`;
21
- specVersion: `0x${string}`;
22
- tip: `0x${string}`;
23
- transactionVersion: `0x${string}`;
24
- signedExtensions: string[];
25
- version: number;
26
- assetId: `0x${string}` | undefined;
27
- metadataHash: `0x${string}` | undefined;
28
- mode: number | undefined;
29
- withSignedTransaction: boolean | undefined;
30
- }>;
31
- export declare const signPayloadRequestV1Encoder: import("scale-ts").Codec<{
32
- address: string;
33
- blockHash: `0x${string}`;
34
- blockNumber: `0x${string}`;
35
- era: `0x${string}`;
36
- genesisHash: `0x${string}`;
37
- method: string;
38
- nonce: `0x${string}`;
39
- specVersion: `0x${string}`;
40
- tip: `0x${string}`;
41
- transactionVersion: `0x${string}`;
42
- signedExtensions: string[];
43
- version: number;
44
- assetId: `0x${string}` | undefined;
45
- metadataHash: `0x${string}` | undefined;
46
- mode: number | undefined;
47
- withSignedTransaction: boolean | undefined;
48
- }>;
49
- export declare const signResponseV1Encoder: import("scale-ts").Codec<SignerResult>;
50
- /**
51
- * createTransaction implementation
52
- * @see https://github.com/polkadot-js/api/issues/6213
53
- */
54
- export interface TxPayloadV1 {
55
- /** Payload version. MUST be 1. */
56
- version: 1;
57
- /**
58
- * Signer selection hint. Allows the implementer to identify which private-key / scheme to use.
59
- * - Use a wallet-defined handle (e.g., address/SS58, account-name, etc). This identifier
60
- * was previously made available to the consumer.
61
- * - Set `null` to let the implementer pick the signer (or if the signer is implied).
62
- */
63
- signer: string | null;
64
- /**
65
- * SCALE-encoded Call (module indicator + function indicator + params).
66
- */
67
- callData: HexString;
68
- /**
69
- * Transaction extensions supplied by the caller (order irrelevant).
70
- * The consumer SHOULD provide every extension that is relevant to them.
71
- * The implementer MAY infer missing ones.
72
- */
73
- extensions: Array<{
74
- /** Identifier as defined in metadata (e.g., "CheckSpecVersion", "ChargeAssetTxPayment"). */
75
- id: string;
76
- /**
77
- * Explicit "extra" to sign (goes into the extrinsic body).
78
- * SCALE-encoded per the extension's "extra" type as defined in the metadata.
79
- */
80
- extra: HexString;
81
- /**
82
- * "Implicit" data to sign (known by the chain, not included into the extrinsic body).
83
- * SCALE-encoded per the extension's "additionalSigned" type as defined in the metadata.
84
- */
85
- additionalSigned: HexString;
86
- }>;
87
- /**
88
- * Transaction Extension Version.
89
- * - For Extrinsic V4 MUST be 0.
90
- * - For Extrinsic V5, set to any version supported by the runtime.
91
- * The implementer:
92
- * - MUST use this field to determine the required extensions for creating the extrinsic.
93
- * - MAY use this field to infer missing extensions that the implementer could know how to handle.
94
- */
95
- txExtVersion: number;
96
- /**
97
- * Context needed for decoding, display, and (optionally) inferring certain extensions.
98
- */
99
- context: {
100
- /**
101
- * RuntimeMetadataPrefixed blob (SCALE), starting with ASCII "meta" magic (`0x6d657461`),
102
- * then a metadata version (V14+). For V5+ versioned extensions, MUST provide V16+.
103
- */
104
- metadata: HexString;
105
- /**
106
- * Native token display info (used by some implementers), also needed to compute
107
- * the `CheckMetadataHash` value.
108
- */
109
- tokenSymbol: string;
110
- tokenDecimals: number;
111
- /**
112
- * Highest known block number to aid mortality UX.
113
- */
114
- bestBlockHeight: number;
115
- };
116
- }
117
- export declare const createTransactionRequestV1Encoder: import("scale-ts").Codec<TxPayloadV1>;
118
- export declare const createTransactionResponseV1Encoder: import("scale-ts").Codec<`0x${string}`>;
@@ -1,127 +0,0 @@
1
- import { Bytes, Enum, Option, Struct, Vector, _void, bool, str, u16, u32 } from 'scale-ts';
2
- import { hexCodec } from '../commonEncoders.js';
3
- import { createTransportEncoder } from '../createTransportEncoder.js';
4
- const signRawRequestCodec = Struct({
5
- address: str,
6
- data: str,
7
- type: Enum({
8
- bytes: _void,
9
- payload: _void,
10
- }),
11
- });
12
- export const signRawRequestV1Encoder = createTransportEncoder({
13
- codec: signRawRequestCodec,
14
- from(decoded) {
15
- return {
16
- address: decoded.address,
17
- data: decoded.data,
18
- type: decoded.type.tag,
19
- };
20
- },
21
- to(value) {
22
- return {
23
- address: value.address,
24
- data: value.data,
25
- type: {
26
- tag: value.type,
27
- value: undefined,
28
- },
29
- };
30
- },
31
- });
32
- export const signPayloadCodec = Struct({
33
- address: str,
34
- blockHash: hexCodec,
35
- blockNumber: hexCodec,
36
- era: hexCodec,
37
- genesisHash: hexCodec,
38
- method: str,
39
- nonce: hexCodec,
40
- specVersion: hexCodec,
41
- tip: hexCodec,
42
- transactionVersion: hexCodec,
43
- signedExtensions: Vector(str),
44
- version: u32,
45
- assetId: Option(hexCodec),
46
- metadataHash: Option(hexCodec),
47
- mode: Option(u32),
48
- withSignedTransaction: Option(bool),
49
- });
50
- export const signPayloadRequestV1Encoder = signPayloadCodec;
51
- const signResult = Struct({
52
- id: u32,
53
- signature: hexCodec,
54
- signedTransaction: Option(Enum({
55
- hex: hexCodec,
56
- buffer: Bytes(),
57
- })),
58
- });
59
- export const signResponseV1Encoder = createTransportEncoder({
60
- codec: signResult,
61
- from(decoded) {
62
- return {
63
- id: decoded.id,
64
- signature: decoded.signature,
65
- signedTransaction: decoded.signedTransaction ? decoded.signedTransaction.value : undefined,
66
- };
67
- },
68
- to(value) {
69
- let signedTransaction = undefined;
70
- if (value.signedTransaction) {
71
- if (typeof value.signedTransaction === 'string') {
72
- signedTransaction = {
73
- tag: 'hex',
74
- value: value.signedTransaction,
75
- };
76
- }
77
- else {
78
- signedTransaction = {
79
- tag: 'buffer',
80
- value: value.signedTransaction,
81
- };
82
- }
83
- }
84
- return {
85
- id: value.id,
86
- signature: value.signature,
87
- signedTransaction: signedTransaction,
88
- };
89
- },
90
- });
91
- const createTransactionRequestCodec = Struct({
92
- version: u16,
93
- signer: Option(str),
94
- callData: hexCodec,
95
- extensions: Vector(Struct({
96
- id: str,
97
- extra: hexCodec,
98
- additionalSigned: hexCodec,
99
- })),
100
- txExtVersion: u16,
101
- context: Struct({
102
- metadata: hexCodec,
103
- tokenSymbol: str,
104
- tokenDecimals: u32,
105
- bestBlockHeight: u32,
106
- }),
107
- });
108
- export const createTransactionRequestV1Encoder = createTransportEncoder({
109
- codec: createTransactionRequestCodec,
110
- from({ version, signer, ...rest }) {
111
- if (version !== 1) {
112
- throw new Error(`TxPayload supported version are: 1. Got ${version}`);
113
- }
114
- return {
115
- version,
116
- signer: signer ?? null,
117
- ...rest,
118
- };
119
- },
120
- to({ signer, ...rest }) {
121
- return {
122
- signer: signer ?? undefined,
123
- ...rest,
124
- };
125
- },
126
- });
127
- export const createTransactionResponseV1Encoder = hexCodec;
@@ -1,128 +0,0 @@
1
- export declare const AccountId: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
2
- export declare const PublicKey: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
3
- export declare const DotNsIdentifier: import("scale-ts").Codec<string>;
4
- export declare const DerivationIndex: import("scale-ts").Codec<number>;
5
- export declare const ProductAccountId: import("scale-ts").Codec<[string, number]>;
6
- export declare const RingVrfProof: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
7
- export declare const RingVrgAlias: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
8
- export declare const Account: import("scale-ts").Codec<{
9
- publicKey: Uint8Array<ArrayBufferLike>;
10
- name: string | undefined;
11
- }>;
12
- export declare const ContextualAlias: import("scale-ts").Codec<{
13
- context: Uint8Array<ArrayBufferLike>;
14
- alias: Uint8Array<ArrayBufferLike>;
15
- }>;
16
- export declare const RingLocationHint: import("scale-ts").Codec<{
17
- palletInstance: number | undefined;
18
- }>;
19
- export declare const RingLocation: import("scale-ts").Codec<{
20
- genesisHash: `0x${string}`;
21
- ringRootHash: `0x${string}`;
22
- hints: {
23
- palletInstance: number | undefined;
24
- } | undefined;
25
- }>;
26
- export declare const RequestCredentialsErr: import("scale-ts").Codec<{
27
- tag: "NotConnected";
28
- value: undefined;
29
- } | {
30
- tag: "Rejected";
31
- value: undefined;
32
- } | {
33
- tag: "DomainNotValid";
34
- value: undefined;
35
- } | {
36
- tag: "Unknown";
37
- value: {
38
- reason: string;
39
- };
40
- }>;
41
- export declare const CreateProofErr: import("scale-ts").Codec<{
42
- tag: "Rejected";
43
- value: undefined;
44
- } | {
45
- tag: "Unknown";
46
- value: {
47
- reason: string;
48
- };
49
- } | {
50
- tag: "RingNotFound";
51
- value: undefined;
52
- }>;
53
- export declare const AccountGetV1_request: import("scale-ts").Codec<[string, number]>;
54
- export declare const AccountGetV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
55
- publicKey: Uint8Array<ArrayBufferLike>;
56
- name: string | undefined;
57
- }, {
58
- tag: "NotConnected";
59
- value: undefined;
60
- } | {
61
- tag: "Rejected";
62
- value: undefined;
63
- } | {
64
- tag: "DomainNotValid";
65
- value: undefined;
66
- } | {
67
- tag: "Unknown";
68
- value: {
69
- reason: string;
70
- };
71
- }>>;
72
- export declare const AccountGetAliasV1_request: import("scale-ts").Codec<[string, number]>;
73
- export declare const AccountGetAliasV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
74
- context: Uint8Array<ArrayBufferLike>;
75
- alias: Uint8Array<ArrayBufferLike>;
76
- }, {
77
- tag: "NotConnected";
78
- value: undefined;
79
- } | {
80
- tag: "Rejected";
81
- value: undefined;
82
- } | {
83
- tag: "DomainNotValid";
84
- value: undefined;
85
- } | {
86
- tag: "Unknown";
87
- value: {
88
- reason: string;
89
- };
90
- }>>;
91
- export declare const AccountCreateProofV1_request: import("scale-ts").Codec<[[string, number], {
92
- genesisHash: `0x${string}`;
93
- ringRootHash: `0x${string}`;
94
- hints: {
95
- palletInstance: number | undefined;
96
- } | undefined;
97
- }, Uint8Array<ArrayBufferLike>]>;
98
- export declare const AccountCreateProofV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike>, {
99
- tag: "Rejected";
100
- value: undefined;
101
- } | {
102
- tag: "Unknown";
103
- value: {
104
- reason: string;
105
- };
106
- } | {
107
- tag: "RingNotFound";
108
- value: undefined;
109
- }>>;
110
- export declare const GetNonProductAccountsV1_request: import("scale-ts").Codec<undefined>;
111
- export declare const GetNonProductAccountsV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
112
- publicKey: Uint8Array<ArrayBufferLike>;
113
- name: string | undefined;
114
- }[], {
115
- tag: "NotConnected";
116
- value: undefined;
117
- } | {
118
- tag: "Rejected";
119
- value: undefined;
120
- } | {
121
- tag: "DomainNotValid";
122
- value: undefined;
123
- } | {
124
- tag: "Unknown";
125
- value: {
126
- reason: string;
127
- };
128
- }>>;
@@ -1,41 +0,0 @@
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);
@@ -1,7 +0,0 @@
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);
@@ -1,28 +0,0 @@
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
- }>>;
@@ -1,12 +0,0 @@
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);
@@ -1,48 +0,0 @@
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
- }>>;
@@ -1,18 +0,0 @@
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);