@novasamatech/host-api 0.8.10 → 0.8.11
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.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/protocol/impl.d.ts +31 -11
- package/dist/protocol/messageCodec.d.ts +62 -22
- package/dist/protocol/v1/accounts.d.ts +86 -24
- package/dist/protocol/v1/accounts.js +28 -12
- package/package.json +2 -2
package/dist/hostApi.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { errAsync, fromPromise, okAsync } from 'neverthrow';
|
|
2
2
|
import { extractErrorMessage } from './helpers.js';
|
|
3
3
|
import { GenericError } from './protocol/commonCodecs.js';
|
|
4
|
-
import { CreateProofErr, GetUserIdErr, LoginErr, RequestCredentialsErr } from './protocol/v1/accounts.js';
|
|
4
|
+
import { CreateProofErr, GetAliasErr, GetUserIdErr, LoginErr, RequestCredentialsErr } from './protocol/v1/accounts.js';
|
|
5
5
|
import { ChatBotRegistrationErr, ChatMessagePostingErr, ChatRoomRegistrationErr } from './protocol/v1/chat.js';
|
|
6
6
|
import { CreateTransactionErr } from './protocol/v1/createTransaction.js';
|
|
7
7
|
import { DeriveEntropyErr } from './protocol/v1/deriveEntropy.js';
|
|
@@ -109,7 +109,7 @@ export function createHostApi(transport) {
|
|
|
109
109
|
accountGetAlias(payload) {
|
|
110
110
|
return makeRequest(transport.request('host_account_get_alias', payload), reason => ({
|
|
111
111
|
tag: payload.tag,
|
|
112
|
-
value: new
|
|
112
|
+
value: new GetAliasErr.Unknown({ reason }),
|
|
113
113
|
}));
|
|
114
114
|
},
|
|
115
115
|
accountCreateProof(payload) {
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type { HexString } from '@novasamatech/scale';
|
|
|
13
13
|
export { assertEnumVariant, enumValue, fromHex, isEnumVariant, resultErr, resultOk, toHex, unwrapResultOrThrow, } from '@novasamatech/scale';
|
|
14
14
|
export { GenericError } from './protocol/commonCodecs.js';
|
|
15
15
|
export { CreateTransactionErr, LegacyTransaction, ProductAccountTransaction } from './protocol/v1/createTransaction.js';
|
|
16
|
-
export { AccountConnectionStatus, AccountId, ContextualAlias, CreateProofErr, DerivationIndex, DotNsIdentifier, GetUserIdErr, LegacyAccount, LoginErr, LoginResult, ProductAccount, ProductAccountId, RequestCredentialsErr, RingLocation, UserIdentity, } from './protocol/v1/accounts.js';
|
|
16
|
+
export { AccountConnectionStatus, AccountId, ContextualAlias, CreateProofErr, DerivationIndex, DotNsIdentifier, GetAliasErr, GetUserIdErr, LegacyAccount, LoginErr, LoginResult, ProductAccount, ProductAccountId, ProductId, ProductProofContext, ProductProofContextSuffix, RequestCredentialsErr, RingLocation, RingLocationJunction, RingVrfProof, UserIdentity, } from './protocol/v1/accounts.js';
|
|
17
17
|
export { ChatActionPayload, ChatBotRegistrationErr, ChatBotRegistrationStatus, ChatMessageContent, ChatMessagePostingErr, ChatRoom, ChatRoomRegistrationErr, ChatRoomRegistrationResult, ChatRoomRegistrationStatus, ReceivedChatAction, } from './protocol/v1/chat.js';
|
|
18
18
|
export { DeriveEntropyErr } from './protocol/v1/deriveEntropy.js';
|
|
19
19
|
export { HandshakeErr } from './protocol/v1/handshake.js';
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { assertEnumVariant, enumValue, fromHex, isEnumVariant, resultErr, result
|
|
|
7
7
|
// Codecs
|
|
8
8
|
export { GenericError } from './protocol/commonCodecs.js';
|
|
9
9
|
export { CreateTransactionErr, LegacyTransaction, ProductAccountTransaction } from './protocol/v1/createTransaction.js';
|
|
10
|
-
export { AccountConnectionStatus, AccountId, ContextualAlias, CreateProofErr, DerivationIndex, DotNsIdentifier, GetUserIdErr, LegacyAccount, LoginErr, LoginResult, ProductAccount, ProductAccountId, RequestCredentialsErr, RingLocation, UserIdentity, } from './protocol/v1/accounts.js';
|
|
10
|
+
export { AccountConnectionStatus, AccountId, ContextualAlias, CreateProofErr, DerivationIndex, DotNsIdentifier, GetAliasErr, GetUserIdErr, LegacyAccount, LoginErr, LoginResult, ProductAccount, ProductAccountId, ProductId, ProductProofContext, ProductProofContextSuffix, RequestCredentialsErr, RingLocation, RingLocationJunction, RingVrfProof, UserIdentity, } from './protocol/v1/accounts.js';
|
|
11
11
|
export { ChatActionPayload, ChatBotRegistrationErr, ChatBotRegistrationStatus, ChatMessageContent, ChatMessagePostingErr, ChatRoom, ChatRoomRegistrationErr, ChatRoomRegistrationResult, ChatRoomRegistrationStatus, ReceivedChatAction, } from './protocol/v1/chat.js';
|
|
12
12
|
export { DeriveEntropyErr } from './protocol/v1/deriveEntropy.js';
|
|
13
13
|
export { HandshakeErr } from './protocol/v1/handshake.js';
|
package/dist/protocol/impl.d.ts
CHANGED
|
@@ -101,23 +101,43 @@ export declare const hostApiProtocol: {
|
|
|
101
101
|
}, "RequestCredentialsErr::Unknown">>>];
|
|
102
102
|
}>;
|
|
103
103
|
readonly host_account_get_alias: VersionedProtocolRequest<{
|
|
104
|
-
readonly v1: [Codec<[string,
|
|
104
|
+
readonly v1: [Codec<[[string, `0x${string}`], {
|
|
105
|
+
chainId: `0x${string}`;
|
|
106
|
+
junctions: ({
|
|
107
|
+
tag: "PalletInstance";
|
|
108
|
+
value: number;
|
|
109
|
+
} | {
|
|
110
|
+
tag: "CollectionId";
|
|
111
|
+
value: Uint8Array<ArrayBufferLike>;
|
|
112
|
+
})[];
|
|
113
|
+
}]>, Codec<import("scale-ts").ResultPayload<{
|
|
105
114
|
context: Uint8Array<ArrayBufferLike>;
|
|
106
115
|
alias: Uint8Array<ArrayBufferLike>;
|
|
107
|
-
}, import("@novasamatech/scale").CodecError<undefined, "
|
|
116
|
+
}, import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
108
117
|
reason: string;
|
|
109
|
-
}, "
|
|
118
|
+
}, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">>>];
|
|
110
119
|
}>;
|
|
111
120
|
readonly host_account_create_proof: VersionedProtocolRequest<{
|
|
112
|
-
readonly v1: [Codec<[[string,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
} |
|
|
118
|
-
|
|
121
|
+
readonly v1: [Codec<[[string, `0x${string}`], {
|
|
122
|
+
chainId: `0x${string}`;
|
|
123
|
+
junctions: ({
|
|
124
|
+
tag: "PalletInstance";
|
|
125
|
+
value: number;
|
|
126
|
+
} | {
|
|
127
|
+
tag: "CollectionId";
|
|
128
|
+
value: Uint8Array<ArrayBufferLike>;
|
|
129
|
+
})[];
|
|
130
|
+
}, Uint8Array<ArrayBufferLike>]>, Codec<import("scale-ts").ResultPayload<{
|
|
131
|
+
proof: Uint8Array<ArrayBufferLike>;
|
|
132
|
+
contextualAlias: {
|
|
133
|
+
context: Uint8Array<ArrayBufferLike>;
|
|
134
|
+
alias: Uint8Array<ArrayBufferLike>;
|
|
135
|
+
};
|
|
136
|
+
ringIndex: number;
|
|
137
|
+
ringRevision: number;
|
|
138
|
+
}, import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
119
139
|
reason: string;
|
|
120
|
-
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>>];
|
|
140
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">>>];
|
|
121
141
|
}>;
|
|
122
142
|
readonly host_get_legacy_accounts: VersionedProtocolRequest<{
|
|
123
143
|
readonly v1: [Codec<undefined>, Codec<import("scale-ts").ResultPayload<{
|
|
@@ -100,26 +100,46 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
100
100
|
reason: string;
|
|
101
101
|
}, "RequestCredentialsErr::Unknown">>>;
|
|
102
102
|
}>> & Record<"host_account_get_alias_request", EnumCodec<{
|
|
103
|
-
readonly v1: Codec<[string,
|
|
103
|
+
readonly v1: Codec<[[string, `0x${string}`], {
|
|
104
|
+
chainId: `0x${string}`;
|
|
105
|
+
junctions: ({
|
|
106
|
+
tag: "PalletInstance";
|
|
107
|
+
value: number;
|
|
108
|
+
} | {
|
|
109
|
+
tag: "CollectionId";
|
|
110
|
+
value: Uint8Array<ArrayBufferLike>;
|
|
111
|
+
})[];
|
|
112
|
+
}]>;
|
|
104
113
|
}>> & Record<"host_account_get_alias_response", EnumCodec<{
|
|
105
114
|
readonly v1: Codec<import("scale-ts").ResultPayload<{
|
|
106
115
|
context: Uint8Array<ArrayBufferLike>;
|
|
107
116
|
alias: Uint8Array<ArrayBufferLike>;
|
|
108
|
-
}, import("@novasamatech/scale").CodecError<undefined, "
|
|
117
|
+
}, import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
109
118
|
reason: string;
|
|
110
|
-
}, "
|
|
119
|
+
}, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">>>;
|
|
111
120
|
}>> & Record<"host_account_create_proof_request", EnumCodec<{
|
|
112
|
-
readonly v1: Codec<[[string,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
} |
|
|
121
|
+
readonly v1: Codec<[[string, `0x${string}`], {
|
|
122
|
+
chainId: `0x${string}`;
|
|
123
|
+
junctions: ({
|
|
124
|
+
tag: "PalletInstance";
|
|
125
|
+
value: number;
|
|
126
|
+
} | {
|
|
127
|
+
tag: "CollectionId";
|
|
128
|
+
value: Uint8Array<ArrayBufferLike>;
|
|
129
|
+
})[];
|
|
118
130
|
}, Uint8Array<ArrayBufferLike>]>;
|
|
119
131
|
}>> & Record<"host_account_create_proof_response", EnumCodec<{
|
|
120
|
-
readonly v1: Codec<import("scale-ts").ResultPayload<
|
|
132
|
+
readonly v1: Codec<import("scale-ts").ResultPayload<{
|
|
133
|
+
proof: Uint8Array<ArrayBufferLike>;
|
|
134
|
+
contextualAlias: {
|
|
135
|
+
context: Uint8Array<ArrayBufferLike>;
|
|
136
|
+
alias: Uint8Array<ArrayBufferLike>;
|
|
137
|
+
};
|
|
138
|
+
ringIndex: number;
|
|
139
|
+
ringRevision: number;
|
|
140
|
+
}, import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
121
141
|
reason: string;
|
|
122
|
-
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>>;
|
|
142
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">>>;
|
|
123
143
|
}>> & Record<"host_get_legacy_accounts_request", EnumCodec<{
|
|
124
144
|
readonly v1: Codec<undefined>;
|
|
125
145
|
}>> & Record<"host_get_legacy_accounts_response", EnumCodec<{
|
|
@@ -1257,7 +1277,16 @@ export declare const Message: Codec<{
|
|
|
1257
1277
|
tag: "host_account_get_alias_request";
|
|
1258
1278
|
value: {
|
|
1259
1279
|
tag: "v1";
|
|
1260
|
-
value: [string,
|
|
1280
|
+
value: [[string, `0x${string}`], {
|
|
1281
|
+
chainId: `0x${string}`;
|
|
1282
|
+
junctions: ({
|
|
1283
|
+
tag: "PalletInstance";
|
|
1284
|
+
value: number;
|
|
1285
|
+
} | {
|
|
1286
|
+
tag: "CollectionId";
|
|
1287
|
+
value: Uint8Array<ArrayBufferLike>;
|
|
1288
|
+
})[];
|
|
1289
|
+
}];
|
|
1261
1290
|
};
|
|
1262
1291
|
} | {
|
|
1263
1292
|
tag: "host_account_get_alias_response";
|
|
@@ -1266,29 +1295,40 @@ export declare const Message: Codec<{
|
|
|
1266
1295
|
value: import("scale-ts").ResultPayload<{
|
|
1267
1296
|
context: Uint8Array<ArrayBufferLike>;
|
|
1268
1297
|
alias: Uint8Array<ArrayBufferLike>;
|
|
1269
|
-
}, import("@novasamatech/scale").CodecError<undefined, "
|
|
1298
|
+
}, import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
1270
1299
|
reason: string;
|
|
1271
|
-
}, "
|
|
1300
|
+
}, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">>;
|
|
1272
1301
|
};
|
|
1273
1302
|
} | {
|
|
1274
1303
|
tag: "host_account_create_proof_request";
|
|
1275
1304
|
value: {
|
|
1276
1305
|
tag: "v1";
|
|
1277
|
-
value: [[string,
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
} |
|
|
1306
|
+
value: [[string, `0x${string}`], {
|
|
1307
|
+
chainId: `0x${string}`;
|
|
1308
|
+
junctions: ({
|
|
1309
|
+
tag: "PalletInstance";
|
|
1310
|
+
value: number;
|
|
1311
|
+
} | {
|
|
1312
|
+
tag: "CollectionId";
|
|
1313
|
+
value: Uint8Array<ArrayBufferLike>;
|
|
1314
|
+
})[];
|
|
1283
1315
|
}, Uint8Array<ArrayBufferLike>];
|
|
1284
1316
|
};
|
|
1285
1317
|
} | {
|
|
1286
1318
|
tag: "host_account_create_proof_response";
|
|
1287
1319
|
value: {
|
|
1288
1320
|
tag: "v1";
|
|
1289
|
-
value: import("scale-ts").ResultPayload<
|
|
1321
|
+
value: import("scale-ts").ResultPayload<{
|
|
1322
|
+
proof: Uint8Array<ArrayBufferLike>;
|
|
1323
|
+
contextualAlias: {
|
|
1324
|
+
context: Uint8Array<ArrayBufferLike>;
|
|
1325
|
+
alias: Uint8Array<ArrayBufferLike>;
|
|
1326
|
+
};
|
|
1327
|
+
ringIndex: number;
|
|
1328
|
+
ringRevision: number;
|
|
1329
|
+
}, import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
1290
1330
|
reason: string;
|
|
1291
|
-
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>;
|
|
1331
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">>;
|
|
1292
1332
|
};
|
|
1293
1333
|
} | {
|
|
1294
1334
|
tag: "host_get_legacy_accounts_request";
|
|
@@ -3,8 +3,10 @@ export declare const PublicKey: import("scale-ts").Codec<Uint8Array<ArrayBufferL
|
|
|
3
3
|
export declare const DotNsIdentifier: import("scale-ts").Codec<string>;
|
|
4
4
|
export declare const DerivationIndex: import("scale-ts").Codec<number>;
|
|
5
5
|
export declare const ProductAccountId: import("scale-ts").Codec<[string, number]>;
|
|
6
|
-
export declare const RingVrfProof: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
|
|
7
6
|
export declare const RingVrgAlias: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
|
|
7
|
+
export declare const ProductId: import("scale-ts").Codec<string>;
|
|
8
|
+
export declare const ProductProofContextSuffix: import("scale-ts").Codec<`0x${string}`>;
|
|
9
|
+
export declare const ProductProofContext: import("scale-ts").Codec<[string, `0x${string}`]>;
|
|
8
10
|
export declare const ProductAccount: import("scale-ts").Codec<{
|
|
9
11
|
publicKey: Uint8Array<ArrayBufferLike>;
|
|
10
12
|
}>;
|
|
@@ -19,15 +21,31 @@ export declare const ContextualAlias: import("scale-ts").Codec<{
|
|
|
19
21
|
context: Uint8Array<ArrayBufferLike>;
|
|
20
22
|
alias: Uint8Array<ArrayBufferLike>;
|
|
21
23
|
}>;
|
|
22
|
-
export declare const
|
|
23
|
-
|
|
24
|
+
export declare const RingVrfProof: import("scale-ts").Codec<{
|
|
25
|
+
proof: Uint8Array<ArrayBufferLike>;
|
|
26
|
+
contextualAlias: {
|
|
27
|
+
context: Uint8Array<ArrayBufferLike>;
|
|
28
|
+
alias: Uint8Array<ArrayBufferLike>;
|
|
29
|
+
};
|
|
30
|
+
ringIndex: number;
|
|
31
|
+
ringRevision: number;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const RingLocationJunction: import("scale-ts").Codec<{
|
|
34
|
+
tag: "PalletInstance";
|
|
35
|
+
value: number;
|
|
36
|
+
} | {
|
|
37
|
+
tag: "CollectionId";
|
|
38
|
+
value: Uint8Array<ArrayBufferLike>;
|
|
24
39
|
}>;
|
|
25
40
|
export declare const RingLocation: import("scale-ts").Codec<{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} |
|
|
41
|
+
chainId: `0x${string}`;
|
|
42
|
+
junctions: ({
|
|
43
|
+
tag: "PalletInstance";
|
|
44
|
+
value: number;
|
|
45
|
+
} | {
|
|
46
|
+
tag: "CollectionId";
|
|
47
|
+
value: Uint8Array<ArrayBufferLike>;
|
|
48
|
+
})[];
|
|
31
49
|
}>;
|
|
32
50
|
export declare const RequestCredentialsErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::NotConnected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::Rejected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::DomainNotValid"> | import("@novasamatech/scale").CodecError<{
|
|
33
51
|
reason: string;
|
|
@@ -54,17 +72,18 @@ export declare const RequestCredentialsErr: [import("scale-ts").Encoder<import("
|
|
|
54
72
|
};
|
|
55
73
|
export declare const CreateProofErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
56
74
|
reason: string;
|
|
57
|
-
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
75
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
58
76
|
reason: string;
|
|
59
|
-
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>] & {
|
|
77
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">>] & {
|
|
60
78
|
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
61
79
|
reason: string;
|
|
62
|
-
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>;
|
|
80
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">>;
|
|
63
81
|
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
64
82
|
reason: string;
|
|
65
|
-
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>;
|
|
83
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">>;
|
|
66
84
|
} & {
|
|
67
85
|
readonly RingNotFound: import("@novasamatech/scale").ErrCodec<undefined, "CreateProofErr::RingNotFound">;
|
|
86
|
+
readonly NotMember: import("@novasamatech/scale").ErrCodec<undefined, "CreateProofErr::NotMember">;
|
|
68
87
|
readonly Rejected: import("@novasamatech/scale").ErrCodec<undefined, "CreateProofErr::Rejected">;
|
|
69
88
|
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
70
89
|
reason: string;
|
|
@@ -72,7 +91,30 @@ export declare const CreateProofErr: [import("scale-ts").Encoder<import("@novasa
|
|
|
72
91
|
} & {
|
|
73
92
|
[Symbol.hasInstance](v: unknown): v is import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
74
93
|
reason: string;
|
|
75
|
-
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">;
|
|
94
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">;
|
|
95
|
+
};
|
|
96
|
+
export declare const GetAliasErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
97
|
+
reason: string;
|
|
98
|
+
}, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
99
|
+
reason: string;
|
|
100
|
+
}, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">>] & {
|
|
101
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
102
|
+
reason: string;
|
|
103
|
+
}, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">>;
|
|
104
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
105
|
+
reason: string;
|
|
106
|
+
}, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">>;
|
|
107
|
+
} & {
|
|
108
|
+
readonly RingNotFound: import("@novasamatech/scale").ErrCodec<undefined, "GetAliasErr::RingNotFound">;
|
|
109
|
+
readonly NotMember: import("@novasamatech/scale").ErrCodec<undefined, "GetAliasErr::NotMember">;
|
|
110
|
+
readonly Rejected: import("@novasamatech/scale").ErrCodec<undefined, "GetAliasErr::Rejected">;
|
|
111
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
112
|
+
reason: string;
|
|
113
|
+
}, "GetAliasErr::Unknown">;
|
|
114
|
+
} & {
|
|
115
|
+
[Symbol.hasInstance](v: unknown): v is import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
116
|
+
reason: string;
|
|
117
|
+
}, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">;
|
|
76
118
|
};
|
|
77
119
|
export declare const GetUserIdErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "GetUserIdErr::NotConnected"> | import("@novasamatech/scale").CodecError<{
|
|
78
120
|
reason: string;
|
|
@@ -112,23 +154,43 @@ export declare const AccountGetV1_response: import("scale-ts").Codec<import("sca
|
|
|
112
154
|
}, import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::NotConnected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::Rejected"> | import("@novasamatech/scale").CodecError<undefined, "RequestCredentialsErr::DomainNotValid"> | import("@novasamatech/scale").CodecError<{
|
|
113
155
|
reason: string;
|
|
114
156
|
}, "RequestCredentialsErr::Unknown">>>;
|
|
115
|
-
export declare const AccountGetAliasV1_request: import("scale-ts").Codec<[string,
|
|
157
|
+
export declare const AccountGetAliasV1_request: import("scale-ts").Codec<[[string, `0x${string}`], {
|
|
158
|
+
chainId: `0x${string}`;
|
|
159
|
+
junctions: ({
|
|
160
|
+
tag: "PalletInstance";
|
|
161
|
+
value: number;
|
|
162
|
+
} | {
|
|
163
|
+
tag: "CollectionId";
|
|
164
|
+
value: Uint8Array<ArrayBufferLike>;
|
|
165
|
+
})[];
|
|
166
|
+
}]>;
|
|
116
167
|
export declare const AccountGetAliasV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
117
168
|
context: Uint8Array<ArrayBufferLike>;
|
|
118
169
|
alias: Uint8Array<ArrayBufferLike>;
|
|
119
|
-
}, import("@novasamatech/scale").CodecError<undefined, "
|
|
170
|
+
}, import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
120
171
|
reason: string;
|
|
121
|
-
}, "
|
|
122
|
-
export declare const AccountCreateProofV1_request: import("scale-ts").Codec<[[string,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
} |
|
|
172
|
+
}, "GetAliasErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "GetAliasErr::NotMember">>>;
|
|
173
|
+
export declare const AccountCreateProofV1_request: import("scale-ts").Codec<[[string, `0x${string}`], {
|
|
174
|
+
chainId: `0x${string}`;
|
|
175
|
+
junctions: ({
|
|
176
|
+
tag: "PalletInstance";
|
|
177
|
+
value: number;
|
|
178
|
+
} | {
|
|
179
|
+
tag: "CollectionId";
|
|
180
|
+
value: Uint8Array<ArrayBufferLike>;
|
|
181
|
+
})[];
|
|
128
182
|
}, Uint8Array<ArrayBufferLike>]>;
|
|
129
|
-
export declare const AccountCreateProofV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<
|
|
183
|
+
export declare const AccountCreateProofV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
184
|
+
proof: Uint8Array<ArrayBufferLike>;
|
|
185
|
+
contextualAlias: {
|
|
186
|
+
context: Uint8Array<ArrayBufferLike>;
|
|
187
|
+
alias: Uint8Array<ArrayBufferLike>;
|
|
188
|
+
};
|
|
189
|
+
ringIndex: number;
|
|
190
|
+
ringRevision: number;
|
|
191
|
+
}, import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
130
192
|
reason: string;
|
|
131
|
-
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound">>>;
|
|
193
|
+
}, "CreateProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::RingNotFound"> | import("@novasamatech/scale").CodecError<undefined, "CreateProofErr::NotMember">>>;
|
|
132
194
|
export declare const GetLegacyAccountsV1_request: import("scale-ts").Codec<undefined>;
|
|
133
195
|
export declare const GetLegacyAccountsV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
134
196
|
publicKey: Uint8Array<ArrayBufferLike>;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { ErrEnum, Hex, Status } from '@novasamatech/scale';
|
|
2
|
-
import { Bytes, Option, Result, Struct, Tuple, Vector, _void, str, u32 } from 'scale-ts';
|
|
3
|
-
import { GenericErr
|
|
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';
|
|
4
4
|
// common types
|
|
5
5
|
export const AccountId = Bytes(32);
|
|
6
6
|
export const PublicKey = Bytes();
|
|
7
7
|
export const DotNsIdentifier = str;
|
|
8
8
|
export const DerivationIndex = u32;
|
|
9
9
|
export const ProductAccountId = Tuple(DotNsIdentifier, DerivationIndex);
|
|
10
|
-
export const RingVrfProof = Bytes();
|
|
11
10
|
export const RingVrgAlias = Bytes();
|
|
11
|
+
export const ProductId = DotNsIdentifier;
|
|
12
|
+
export const ProductProofContextSuffix = Hex();
|
|
13
|
+
export const ProductProofContext = Tuple(ProductId, ProductProofContextSuffix);
|
|
12
14
|
// structs
|
|
13
15
|
export const ProductAccount = Struct({
|
|
14
16
|
publicKey: PublicKey,
|
|
@@ -24,13 +26,20 @@ export const ContextualAlias = Struct({
|
|
|
24
26
|
context: Bytes(32),
|
|
25
27
|
alias: RingVrgAlias,
|
|
26
28
|
});
|
|
27
|
-
export const
|
|
28
|
-
|
|
29
|
+
export const RingVrfProof = Struct({
|
|
30
|
+
proof: Bytes(),
|
|
31
|
+
contextualAlias: ContextualAlias,
|
|
32
|
+
ringIndex: u32,
|
|
33
|
+
ringRevision: u32,
|
|
34
|
+
});
|
|
35
|
+
export const RingLocationJunction = Enum({
|
|
36
|
+
PalletInstance: u8,
|
|
37
|
+
CollectionId: Bytes(),
|
|
29
38
|
});
|
|
30
39
|
export const RingLocation = Struct({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
// TODO make GenesisHash fixed size and replace hardcoded codec with it
|
|
41
|
+
chainId: Hex(32),
|
|
42
|
+
junctions: Vector(RingLocationJunction),
|
|
34
43
|
});
|
|
35
44
|
// errors
|
|
36
45
|
export const RequestCredentialsErr = ErrEnum('RequestCredentialsErr', {
|
|
@@ -41,9 +50,16 @@ export const RequestCredentialsErr = ErrEnum('RequestCredentialsErr', {
|
|
|
41
50
|
});
|
|
42
51
|
export const CreateProofErr = ErrEnum('CreateProofErr', {
|
|
43
52
|
RingNotFound: [_void, 'CreateProof: ring not found'],
|
|
53
|
+
NotMember: [_void, 'CreateProof: selected member key is not a member of the ring'],
|
|
44
54
|
Rejected: [_void, 'CreateProof: rejected'],
|
|
45
55
|
Unknown: [GenericErr, 'CreateProof: unknown error'],
|
|
46
56
|
});
|
|
57
|
+
export const GetAliasErr = ErrEnum('GetAliasErr', {
|
|
58
|
+
RingNotFound: [_void, 'GetAlias: ring not found'],
|
|
59
|
+
NotMember: [_void, 'GetAlias: selected member key is not a member of the ring'],
|
|
60
|
+
Rejected: [_void, 'GetAlias: rejected'],
|
|
61
|
+
Unknown: [GenericErr, 'GetAlias: unknown error'],
|
|
62
|
+
});
|
|
47
63
|
export const GetUserIdErr = ErrEnum('GetUserIdErr', {
|
|
48
64
|
PermissionDenied: [_void, 'GetUserId: permission denied'],
|
|
49
65
|
NotConnected: [_void, 'GetUserId: not connected'],
|
|
@@ -61,10 +77,10 @@ export const GetUserIdV1_response = Result(UserIdentity, GetUserIdErr);
|
|
|
61
77
|
export const AccountGetV1_request = ProductAccountId;
|
|
62
78
|
export const AccountGetV1_response = Result(ProductAccount, RequestCredentialsErr);
|
|
63
79
|
// account_get_alias
|
|
64
|
-
export const AccountGetAliasV1_request =
|
|
65
|
-
export const AccountGetAliasV1_response = Result(ContextualAlias,
|
|
80
|
+
export const AccountGetAliasV1_request = Tuple(ProductProofContext, RingLocation);
|
|
81
|
+
export const AccountGetAliasV1_response = Result(ContextualAlias, GetAliasErr);
|
|
66
82
|
// account_create_proof
|
|
67
|
-
export const AccountCreateProofV1_request = Tuple(
|
|
83
|
+
export const AccountCreateProofV1_request = Tuple(ProductProofContext, RingLocation, Bytes());
|
|
68
84
|
export const AccountCreateProofV1_response = Result(RingVrfProof, CreateProofErr);
|
|
69
85
|
// get_legacy_accounts
|
|
70
86
|
export const GetLegacyAccountsV1_request = _void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novasamatech/host-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.11",
|
|
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.8.
|
|
25
|
+
"@novasamatech/scale": "0.8.11",
|
|
26
26
|
"nanoevents": "9.1.0",
|
|
27
27
|
"nanoid": "5.1.11",
|
|
28
28
|
"neverthrow": "^8.2.0",
|