@novasamatech/host-api 0.7.5 → 0.7.7
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 +13 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/protocol/impl.d.ts +88 -0
- package/dist/protocol/impl.js +8 -1
- package/dist/protocol/messageCodec.d.ts +197 -1
- package/dist/protocol/v1/resourceAllocation.d.ts +68 -0
- package/dist/protocol/v1/resourceAllocation.js +24 -0
- package/dist/protocol/v1/statementStore.d.ts +61 -0
- package/dist/protocol/v1/statementStore.js +3 -0
- package/dist/transport.js +2 -0
- package/package.json +2 -2
package/dist/hostApi.js
CHANGED
|
@@ -10,6 +10,7 @@ import { StorageErr } from './protocol/v1/localStorage.js';
|
|
|
10
10
|
import { NavigateToErr } from './protocol/v1/navigation.js';
|
|
11
11
|
import { PaymentRequestErr, PaymentTopUpErr } from './protocol/v1/payments.js';
|
|
12
12
|
import { PreimageSubmitErr } from './protocol/v1/preimage.js';
|
|
13
|
+
import { ResourceAllocationErr } from './protocol/v1/resourceAllocation.js';
|
|
13
14
|
import { SigningErr } from './protocol/v1/sign.js';
|
|
14
15
|
import { StatementProofErr } from './protocol/v1/statementStore.js';
|
|
15
16
|
export function createHostApi(transport) {
|
|
@@ -188,6 +189,12 @@ export function createHostApi(transport) {
|
|
|
188
189
|
value: new StatementProofErr.Unknown({ reason }),
|
|
189
190
|
}));
|
|
190
191
|
},
|
|
192
|
+
statementStoreCreateProofAuthorized(payload) {
|
|
193
|
+
return makeRequest(transport.request('remote_statement_store_create_proof_authorized', payload), reason => ({
|
|
194
|
+
tag: payload.tag,
|
|
195
|
+
value: new StatementProofErr.Unknown({ reason }),
|
|
196
|
+
}));
|
|
197
|
+
},
|
|
191
198
|
statementStoreSubmit(payload) {
|
|
192
199
|
return makeRequest(transport.request('remote_statement_store_submit', payload), reason => ({
|
|
193
200
|
tag: payload.tag,
|
|
@@ -221,6 +228,12 @@ export function createHostApi(transport) {
|
|
|
221
228
|
paymentStatusSubscribe(args, callback) {
|
|
222
229
|
return transport.subscribe('host_payment_status_subscribe', args, callback);
|
|
223
230
|
},
|
|
231
|
+
requestResourceAllocation(payload) {
|
|
232
|
+
return makeRequest(transport.request('host_request_resource_allocation', payload), reason => ({
|
|
233
|
+
tag: payload.tag,
|
|
234
|
+
value: new ResourceAllocationErr.Unknown({ reason }),
|
|
235
|
+
}));
|
|
236
|
+
},
|
|
224
237
|
// chain interaction
|
|
225
238
|
chainHeadFollowSubscribe(args, callback) {
|
|
226
239
|
return transport.subscribe('remote_chain_head_follow_subscribe', args, callback);
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type { HexString } from '@novasamatech/scale';
|
|
|
12
12
|
export { assertEnumVariant, enumValue, fromHex, isEnumVariant, resultErr, resultOk, toHex, unwrapResultOrThrow, } from '@novasamatech/scale';
|
|
13
13
|
export { GenericError } from './protocol/commonCodecs.js';
|
|
14
14
|
export { CreateTransactionErr, VersionedPublicTxPayload } from './protocol/v1/createTransaction.js';
|
|
15
|
-
export { AccountConnectionStatus, AccountId, ContextualAlias, CreateProofErr, GetUserIdErr, LegacyAccount, LoginErr, LoginResult, ProductAccount, ProductAccountId, RequestCredentialsErr, RingLocation, UserIdentity, } from './protocol/v1/accounts.js';
|
|
15
|
+
export { AccountConnectionStatus, AccountId, ContextualAlias, CreateProofErr, DerivationIndex, DotNsIdentifier, GetUserIdErr, LegacyAccount, LoginErr, LoginResult, ProductAccount, ProductAccountId, RequestCredentialsErr, RingLocation, UserIdentity, } from './protocol/v1/accounts.js';
|
|
16
16
|
export { ChatActionPayload, ChatBotRegistrationErr, ChatBotRegistrationStatus, ChatMessageContent, ChatMessagePostingErr, ChatRoom, ChatRoomRegistrationErr, ChatRoomRegistrationResult, ChatRoomRegistrationStatus, ReceivedChatAction, } from './protocol/v1/chat.js';
|
|
17
17
|
export { DeriveEntropyErr } from './protocol/v1/deriveEntropy.js';
|
|
18
18
|
export { HandshakeErr } from './protocol/v1/handshake.js';
|
|
@@ -24,6 +24,7 @@ export { RemotePermission } from './protocol/v1/remotePermission.js';
|
|
|
24
24
|
export { PushNotification } from './protocol/v1/notification.js';
|
|
25
25
|
export { NavigateToErr } from './protocol/v1/navigation.js';
|
|
26
26
|
export { PreimageKey, PreimageSubmitErr, PreimageValue } from './protocol/v1/preimage.js';
|
|
27
|
+
export { AllocatableResource, AllocationOutcome, ResourceAllocationErr } from './protocol/v1/resourceAllocation.js';
|
|
27
28
|
export { PaymentBalance, PaymentBalanceErr, PaymentId, PaymentReceipt, PaymentRequestErr, PaymentStatus, PaymentStatusErr, PaymentTopUpErr, PaymentTopUpSource, } from './protocol/v1/payments.js';
|
|
28
29
|
export { Arrangement, BorderStyle, ButtonVariant, ColorToken, ContentAlignment, CustomRendererNode, Dimensions, HorizontalAlignment, Modifier, Shape, Size, TypographyStyle, VerticalAlignment, } from './protocol/v1/customRenderer.js';
|
|
29
30
|
export { ChainHeadEvent, ChainHeadFollowV1_start, OperationStartedResult, RuntimeType, StorageQueryItem, StorageQueryType, StorageResultItem, TransactionBroadcastV1_request, TransactionBroadcastV1_response, TransactionStopV1_request, TransactionStopV1_response, } from './protocol/v1/chainInteraction.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, VersionedPublicTxPayload } from './protocol/v1/createTransaction.js';
|
|
10
|
-
export { AccountConnectionStatus, AccountId, ContextualAlias, CreateProofErr, GetUserIdErr, LegacyAccount, LoginErr, LoginResult, ProductAccount, ProductAccountId, RequestCredentialsErr, RingLocation, UserIdentity, } from './protocol/v1/accounts.js';
|
|
10
|
+
export { AccountConnectionStatus, AccountId, ContextualAlias, CreateProofErr, DerivationIndex, DotNsIdentifier, GetUserIdErr, LegacyAccount, LoginErr, LoginResult, ProductAccount, ProductAccountId, RequestCredentialsErr, RingLocation, 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';
|
|
@@ -19,6 +19,7 @@ export { RemotePermission } from './protocol/v1/remotePermission.js';
|
|
|
19
19
|
export { PushNotification } from './protocol/v1/notification.js';
|
|
20
20
|
export { NavigateToErr } from './protocol/v1/navigation.js';
|
|
21
21
|
export { PreimageKey, PreimageSubmitErr, PreimageValue } from './protocol/v1/preimage.js';
|
|
22
|
+
export { AllocatableResource, AllocationOutcome, ResourceAllocationErr } from './protocol/v1/resourceAllocation.js';
|
|
22
23
|
export { PaymentBalance, PaymentBalanceErr, PaymentId, PaymentReceipt, PaymentRequestErr, PaymentStatus, PaymentStatusErr, PaymentTopUpErr, PaymentTopUpSource, } from './protocol/v1/payments.js';
|
|
23
24
|
export { Arrangement, BorderStyle, ButtonVariant, ColorToken, ContentAlignment, CustomRendererNode, Dimensions, HorizontalAlignment, Modifier, Shape, Size, TypographyStyle, VerticalAlignment, } from './protocol/v1/customRenderer.js';
|
|
24
25
|
export { ChainHeadEvent, ChainHeadFollowV1_start, OperationStartedResult, RuntimeType, StorageQueryItem, StorageQueryType, StorageResultItem, TransactionBroadcastV1_request, TransactionBroadcastV1_response, TransactionStopV1_request, TransactionStopV1_response, } from './protocol/v1/chainInteraction.js';
|
package/dist/protocol/impl.d.ts
CHANGED
|
@@ -874,5 +874,93 @@ export declare const hostApiProtocol: {
|
|
|
874
874
|
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">;
|
|
875
875
|
}];
|
|
876
876
|
}>;
|
|
877
|
+
readonly host_request_resource_allocation: VersionedProtocolRequest<{
|
|
878
|
+
readonly v1: [Codec<({
|
|
879
|
+
tag: "StatementStoreAllowance";
|
|
880
|
+
value: undefined;
|
|
881
|
+
} | {
|
|
882
|
+
tag: "BulletInAllowance";
|
|
883
|
+
value: undefined;
|
|
884
|
+
} | {
|
|
885
|
+
tag: "SmartContractAllowance";
|
|
886
|
+
value: number;
|
|
887
|
+
} | {
|
|
888
|
+
tag: "AutoSigning";
|
|
889
|
+
value: undefined;
|
|
890
|
+
})[]>, Codec<import("scale-ts").ResultPayload<({
|
|
891
|
+
tag: "Rejected";
|
|
892
|
+
value: undefined;
|
|
893
|
+
} | {
|
|
894
|
+
tag: "Allocated";
|
|
895
|
+
value: undefined;
|
|
896
|
+
} | {
|
|
897
|
+
tag: "NotAvailable";
|
|
898
|
+
value: undefined;
|
|
899
|
+
})[], import("@novasamatech/scale").CodecError<{
|
|
900
|
+
reason: string;
|
|
901
|
+
}, "ResourceAllocationErr::Unknown">>>];
|
|
902
|
+
}>;
|
|
903
|
+
readonly remote_statement_store_create_proof_authorized: VersionedProtocolRequest<{
|
|
904
|
+
readonly v1: [Codec<{
|
|
905
|
+
proof: {
|
|
906
|
+
tag: "Sr25519";
|
|
907
|
+
value: {
|
|
908
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
909
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
910
|
+
};
|
|
911
|
+
} | {
|
|
912
|
+
tag: "Ed25519";
|
|
913
|
+
value: {
|
|
914
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
915
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
916
|
+
};
|
|
917
|
+
} | {
|
|
918
|
+
tag: "Ecdsa";
|
|
919
|
+
value: {
|
|
920
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
921
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
922
|
+
};
|
|
923
|
+
} | {
|
|
924
|
+
tag: "OnChain";
|
|
925
|
+
value: {
|
|
926
|
+
who: Uint8Array<ArrayBufferLike>;
|
|
927
|
+
blockHash: Uint8Array<ArrayBufferLike>;
|
|
928
|
+
event: bigint;
|
|
929
|
+
};
|
|
930
|
+
} | undefined;
|
|
931
|
+
decryptionKey: Uint8Array<ArrayBufferLike> | undefined;
|
|
932
|
+
expiry: bigint | undefined;
|
|
933
|
+
channel: Uint8Array<ArrayBufferLike> | undefined;
|
|
934
|
+
topics: Uint8Array<ArrayBufferLike>[];
|
|
935
|
+
data: Uint8Array<ArrayBufferLike> | undefined;
|
|
936
|
+
}>, Codec<import("scale-ts").ResultPayload<{
|
|
937
|
+
tag: "Sr25519";
|
|
938
|
+
value: {
|
|
939
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
940
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
941
|
+
};
|
|
942
|
+
} | {
|
|
943
|
+
tag: "Ed25519";
|
|
944
|
+
value: {
|
|
945
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
946
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
947
|
+
};
|
|
948
|
+
} | {
|
|
949
|
+
tag: "Ecdsa";
|
|
950
|
+
value: {
|
|
951
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
952
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
953
|
+
};
|
|
954
|
+
} | {
|
|
955
|
+
tag: "OnChain";
|
|
956
|
+
value: {
|
|
957
|
+
who: Uint8Array<ArrayBufferLike>;
|
|
958
|
+
blockHash: Uint8Array<ArrayBufferLike>;
|
|
959
|
+
event: bigint;
|
|
960
|
+
};
|
|
961
|
+
}, import("@novasamatech/scale").CodecError<{
|
|
962
|
+
reason: string;
|
|
963
|
+
}, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">>>];
|
|
964
|
+
}>;
|
|
877
965
|
};
|
|
878
966
|
export {};
|
package/dist/protocol/impl.js
CHANGED
|
@@ -14,8 +14,9 @@ import { PushNotificationV1_request, PushNotificationV1_response } from './v1/no
|
|
|
14
14
|
import { PaymentBalanceSubscribeV1_interrupt, PaymentBalanceSubscribeV1_receive, PaymentBalanceSubscribeV1_start, PaymentRequestV1_request, PaymentRequestV1_response, PaymentStatusSubscribeV1_interrupt, PaymentStatusSubscribeV1_receive, PaymentStatusSubscribeV1_start, PaymentTopUpV1_request, PaymentTopUpV1_response, } from './v1/payments.js';
|
|
15
15
|
import { PreimageLookupSubscribeV1_interrupt, PreimageLookupSubscribeV1_receive, PreimageLookupSubscribeV1_start, PreimageSubmitV1_request, PreimageSubmitV1_response, } from './v1/preimage.js';
|
|
16
16
|
import { RemotePermissionV1_request, RemotePermissionV1_response } from './v1/remotePermission.js';
|
|
17
|
+
import { RequestResourceAllocationV1_request, RequestResourceAllocationV1_response } from './v1/resourceAllocation.js';
|
|
17
18
|
import { SignPayloadV1_request, SignPayloadV1_response, SignPayloadWithLegacyAccountV1_request, SignPayloadWithLegacyAccountV1_response, SignRawV1_request, SignRawV1_response, SignRawWithLegacyAccountV1_request, SignRawWithLegacyAccountV1_response, } from './v1/sign.js';
|
|
18
|
-
import { StatementStoreCreateProofV1_request, StatementStoreCreateProofV1_response, StatementStoreSubmitV1_request, StatementStoreSubmitV1_response, StatementStoreSubscribeV1_interrupt, StatementStoreSubscribeV1_receive, StatementStoreSubscribeV1_start, } from './v1/statementStore.js';
|
|
19
|
+
import { StatementStoreCreateProofAuthorizedV1_request, StatementStoreCreateProofAuthorizedV1_response, StatementStoreCreateProofV1_request, StatementStoreCreateProofV1_response, StatementStoreSubmitV1_request, StatementStoreSubmitV1_response, StatementStoreSubscribeV1_interrupt, StatementStoreSubscribeV1_receive, StatementStoreSubscribeV1_start, } from './v1/statementStore.js';
|
|
19
20
|
import { ThemeSubscribeV1_interrupt, ThemeSubscribeV1_receive, ThemeSubscribeV1_start } from './v1/theme.js';
|
|
20
21
|
const enumFromArg = (enumValues, n) => {
|
|
21
22
|
return Enum(Object.fromEntries(Object.entries(enumValues).map(([key, value]) => [key, value[n]])));
|
|
@@ -204,4 +205,10 @@ export const hostApiProtocol = {
|
|
|
204
205
|
host_payment_status_subscribe: versionedSubscription({
|
|
205
206
|
v1: [PaymentStatusSubscribeV1_start, PaymentStatusSubscribeV1_receive, PaymentStatusSubscribeV1_interrupt],
|
|
206
207
|
}),
|
|
208
|
+
host_request_resource_allocation: versionedRequest({
|
|
209
|
+
v1: [RequestResourceAllocationV1_request, RequestResourceAllocationV1_response],
|
|
210
|
+
}),
|
|
211
|
+
remote_statement_store_create_proof_authorized: versionedRequest({
|
|
212
|
+
v1: [StatementStoreCreateProofAuthorizedV1_request, StatementStoreCreateProofAuthorizedV1_response],
|
|
213
|
+
}),
|
|
207
214
|
};
|
|
@@ -940,7 +940,97 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
|
|
|
940
940
|
reason: string;
|
|
941
941
|
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">;
|
|
942
942
|
};
|
|
943
|
-
}>> & Record<"host_payment_status_subscribe_stop", Codec<undefined
|
|
943
|
+
}>> & Record<"host_payment_status_subscribe_stop", Codec<undefined>> & Record<"host_request_resource_allocation_request", EnumCodec<{
|
|
944
|
+
readonly v1: Codec<({
|
|
945
|
+
tag: "StatementStoreAllowance";
|
|
946
|
+
value: undefined;
|
|
947
|
+
} | {
|
|
948
|
+
tag: "BulletInAllowance";
|
|
949
|
+
value: undefined;
|
|
950
|
+
} | {
|
|
951
|
+
tag: "SmartContractAllowance";
|
|
952
|
+
value: number;
|
|
953
|
+
} | {
|
|
954
|
+
tag: "AutoSigning";
|
|
955
|
+
value: undefined;
|
|
956
|
+
})[]>;
|
|
957
|
+
}>> & Record<"host_request_resource_allocation_response", EnumCodec<{
|
|
958
|
+
readonly v1: Codec<import("scale-ts").ResultPayload<({
|
|
959
|
+
tag: "Rejected";
|
|
960
|
+
value: undefined;
|
|
961
|
+
} | {
|
|
962
|
+
tag: "Allocated";
|
|
963
|
+
value: undefined;
|
|
964
|
+
} | {
|
|
965
|
+
tag: "NotAvailable";
|
|
966
|
+
value: undefined;
|
|
967
|
+
})[], import("@novasamatech/scale").CodecError<{
|
|
968
|
+
reason: string;
|
|
969
|
+
}, "ResourceAllocationErr::Unknown">>>;
|
|
970
|
+
}>> & Record<"remote_statement_store_create_proof_authorized_request", EnumCodec<{
|
|
971
|
+
readonly v1: Codec<{
|
|
972
|
+
proof: {
|
|
973
|
+
tag: "Sr25519";
|
|
974
|
+
value: {
|
|
975
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
976
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
977
|
+
};
|
|
978
|
+
} | {
|
|
979
|
+
tag: "Ed25519";
|
|
980
|
+
value: {
|
|
981
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
982
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
983
|
+
};
|
|
984
|
+
} | {
|
|
985
|
+
tag: "Ecdsa";
|
|
986
|
+
value: {
|
|
987
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
988
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
989
|
+
};
|
|
990
|
+
} | {
|
|
991
|
+
tag: "OnChain";
|
|
992
|
+
value: {
|
|
993
|
+
who: Uint8Array<ArrayBufferLike>;
|
|
994
|
+
blockHash: Uint8Array<ArrayBufferLike>;
|
|
995
|
+
event: bigint;
|
|
996
|
+
};
|
|
997
|
+
} | undefined;
|
|
998
|
+
decryptionKey: Uint8Array<ArrayBufferLike> | undefined;
|
|
999
|
+
expiry: bigint | undefined;
|
|
1000
|
+
channel: Uint8Array<ArrayBufferLike> | undefined;
|
|
1001
|
+
topics: Uint8Array<ArrayBufferLike>[];
|
|
1002
|
+
data: Uint8Array<ArrayBufferLike> | undefined;
|
|
1003
|
+
}>;
|
|
1004
|
+
}>> & Record<"remote_statement_store_create_proof_authorized_response", EnumCodec<{
|
|
1005
|
+
readonly v1: Codec<import("scale-ts").ResultPayload<{
|
|
1006
|
+
tag: "Sr25519";
|
|
1007
|
+
value: {
|
|
1008
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
1009
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
1010
|
+
};
|
|
1011
|
+
} | {
|
|
1012
|
+
tag: "Ed25519";
|
|
1013
|
+
value: {
|
|
1014
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
1015
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
1016
|
+
};
|
|
1017
|
+
} | {
|
|
1018
|
+
tag: "Ecdsa";
|
|
1019
|
+
value: {
|
|
1020
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
1021
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
1022
|
+
};
|
|
1023
|
+
} | {
|
|
1024
|
+
tag: "OnChain";
|
|
1025
|
+
value: {
|
|
1026
|
+
who: Uint8Array<ArrayBufferLike>;
|
|
1027
|
+
blockHash: Uint8Array<ArrayBufferLike>;
|
|
1028
|
+
event: bigint;
|
|
1029
|
+
};
|
|
1030
|
+
}, import("@novasamatech/scale").CodecError<{
|
|
1031
|
+
reason: string;
|
|
1032
|
+
}, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">>>;
|
|
1033
|
+
}>>>;
|
|
944
1034
|
export declare const Message: Codec<{
|
|
945
1035
|
requestId: string;
|
|
946
1036
|
payload: {
|
|
@@ -2347,6 +2437,112 @@ export declare const Message: Codec<{
|
|
|
2347
2437
|
} | {
|
|
2348
2438
|
tag: "host_payment_status_subscribe_stop";
|
|
2349
2439
|
value: undefined;
|
|
2440
|
+
} | {
|
|
2441
|
+
tag: "host_request_resource_allocation_request";
|
|
2442
|
+
value: {
|
|
2443
|
+
tag: "v1";
|
|
2444
|
+
value: ({
|
|
2445
|
+
tag: "StatementStoreAllowance";
|
|
2446
|
+
value: undefined;
|
|
2447
|
+
} | {
|
|
2448
|
+
tag: "BulletInAllowance";
|
|
2449
|
+
value: undefined;
|
|
2450
|
+
} | {
|
|
2451
|
+
tag: "SmartContractAllowance";
|
|
2452
|
+
value: number;
|
|
2453
|
+
} | {
|
|
2454
|
+
tag: "AutoSigning";
|
|
2455
|
+
value: undefined;
|
|
2456
|
+
})[];
|
|
2457
|
+
};
|
|
2458
|
+
} | {
|
|
2459
|
+
tag: "host_request_resource_allocation_response";
|
|
2460
|
+
value: {
|
|
2461
|
+
tag: "v1";
|
|
2462
|
+
value: import("scale-ts").ResultPayload<({
|
|
2463
|
+
tag: "Rejected";
|
|
2464
|
+
value: undefined;
|
|
2465
|
+
} | {
|
|
2466
|
+
tag: "Allocated";
|
|
2467
|
+
value: undefined;
|
|
2468
|
+
} | {
|
|
2469
|
+
tag: "NotAvailable";
|
|
2470
|
+
value: undefined;
|
|
2471
|
+
})[], import("@novasamatech/scale").CodecError<{
|
|
2472
|
+
reason: string;
|
|
2473
|
+
}, "ResourceAllocationErr::Unknown">>;
|
|
2474
|
+
};
|
|
2475
|
+
} | {
|
|
2476
|
+
tag: "remote_statement_store_create_proof_authorized_request";
|
|
2477
|
+
value: {
|
|
2478
|
+
tag: "v1";
|
|
2479
|
+
value: {
|
|
2480
|
+
proof: {
|
|
2481
|
+
tag: "Sr25519";
|
|
2482
|
+
value: {
|
|
2483
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
2484
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
2485
|
+
};
|
|
2486
|
+
} | {
|
|
2487
|
+
tag: "Ed25519";
|
|
2488
|
+
value: {
|
|
2489
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
2490
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
2491
|
+
};
|
|
2492
|
+
} | {
|
|
2493
|
+
tag: "Ecdsa";
|
|
2494
|
+
value: {
|
|
2495
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
2496
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
2497
|
+
};
|
|
2498
|
+
} | {
|
|
2499
|
+
tag: "OnChain";
|
|
2500
|
+
value: {
|
|
2501
|
+
who: Uint8Array<ArrayBufferLike>;
|
|
2502
|
+
blockHash: Uint8Array<ArrayBufferLike>;
|
|
2503
|
+
event: bigint;
|
|
2504
|
+
};
|
|
2505
|
+
} | undefined;
|
|
2506
|
+
decryptionKey: Uint8Array<ArrayBufferLike> | undefined;
|
|
2507
|
+
expiry: bigint | undefined;
|
|
2508
|
+
channel: Uint8Array<ArrayBufferLike> | undefined;
|
|
2509
|
+
topics: Uint8Array<ArrayBufferLike>[];
|
|
2510
|
+
data: Uint8Array<ArrayBufferLike> | undefined;
|
|
2511
|
+
};
|
|
2512
|
+
};
|
|
2513
|
+
} | {
|
|
2514
|
+
tag: "remote_statement_store_create_proof_authorized_response";
|
|
2515
|
+
value: {
|
|
2516
|
+
tag: "v1";
|
|
2517
|
+
value: import("scale-ts").ResultPayload<{
|
|
2518
|
+
tag: "Sr25519";
|
|
2519
|
+
value: {
|
|
2520
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
2521
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
2522
|
+
};
|
|
2523
|
+
} | {
|
|
2524
|
+
tag: "Ed25519";
|
|
2525
|
+
value: {
|
|
2526
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
2527
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
2528
|
+
};
|
|
2529
|
+
} | {
|
|
2530
|
+
tag: "Ecdsa";
|
|
2531
|
+
value: {
|
|
2532
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
2533
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
2534
|
+
};
|
|
2535
|
+
} | {
|
|
2536
|
+
tag: "OnChain";
|
|
2537
|
+
value: {
|
|
2538
|
+
who: Uint8Array<ArrayBufferLike>;
|
|
2539
|
+
blockHash: Uint8Array<ArrayBufferLike>;
|
|
2540
|
+
event: bigint;
|
|
2541
|
+
};
|
|
2542
|
+
}, import("@novasamatech/scale").CodecError<{
|
|
2543
|
+
reason: string;
|
|
2544
|
+
}, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">>;
|
|
2545
|
+
};
|
|
2350
2546
|
};
|
|
2351
2547
|
}>;
|
|
2352
2548
|
export type MessageAction = MessagePayloadSchema['tag'];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export declare const AllocatableResource: import("scale-ts").Codec<{
|
|
2
|
+
tag: "StatementStoreAllowance";
|
|
3
|
+
value: undefined;
|
|
4
|
+
} | {
|
|
5
|
+
tag: "BulletInAllowance";
|
|
6
|
+
value: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
tag: "SmartContractAllowance";
|
|
9
|
+
value: number;
|
|
10
|
+
} | {
|
|
11
|
+
tag: "AutoSigning";
|
|
12
|
+
value: undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const AllocationOutcome: import("scale-ts").Codec<{
|
|
15
|
+
tag: "Rejected";
|
|
16
|
+
value: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
tag: "Allocated";
|
|
19
|
+
value: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
tag: "NotAvailable";
|
|
22
|
+
value: undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const ResourceAllocationErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
25
|
+
reason: string;
|
|
26
|
+
}, "ResourceAllocationErr::Unknown">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
27
|
+
reason: string;
|
|
28
|
+
}, "ResourceAllocationErr::Unknown">>] & {
|
|
29
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
30
|
+
reason: string;
|
|
31
|
+
}, "ResourceAllocationErr::Unknown">>;
|
|
32
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
33
|
+
reason: string;
|
|
34
|
+
}, "ResourceAllocationErr::Unknown">>;
|
|
35
|
+
} & {
|
|
36
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
37
|
+
reason: string;
|
|
38
|
+
}, "ResourceAllocationErr::Unknown">;
|
|
39
|
+
} & {
|
|
40
|
+
[Symbol.hasInstance](v: unknown): v is import("@novasamatech/scale").CodecError<{
|
|
41
|
+
reason: string;
|
|
42
|
+
}, "ResourceAllocationErr::Unknown">;
|
|
43
|
+
};
|
|
44
|
+
export declare const RequestResourceAllocationV1_request: import("scale-ts").Codec<({
|
|
45
|
+
tag: "StatementStoreAllowance";
|
|
46
|
+
value: undefined;
|
|
47
|
+
} | {
|
|
48
|
+
tag: "BulletInAllowance";
|
|
49
|
+
value: undefined;
|
|
50
|
+
} | {
|
|
51
|
+
tag: "SmartContractAllowance";
|
|
52
|
+
value: number;
|
|
53
|
+
} | {
|
|
54
|
+
tag: "AutoSigning";
|
|
55
|
+
value: undefined;
|
|
56
|
+
})[]>;
|
|
57
|
+
export declare const RequestResourceAllocationV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<({
|
|
58
|
+
tag: "Rejected";
|
|
59
|
+
value: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
tag: "Allocated";
|
|
62
|
+
value: undefined;
|
|
63
|
+
} | {
|
|
64
|
+
tag: "NotAvailable";
|
|
65
|
+
value: undefined;
|
|
66
|
+
})[], import("@novasamatech/scale").CodecError<{
|
|
67
|
+
reason: string;
|
|
68
|
+
}, "ResourceAllocationErr::Unknown">>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Enum, ErrEnum } from '@novasamatech/scale';
|
|
2
|
+
import { Result, Vector, _void } from 'scale-ts';
|
|
3
|
+
import { GenericErr } from '../commonCodecs.js';
|
|
4
|
+
import { DerivationIndex } from './accounts.js';
|
|
5
|
+
// resources requested by a product
|
|
6
|
+
export const AllocatableResource = Enum({
|
|
7
|
+
StatementStoreAllowance: _void,
|
|
8
|
+
BulletInAllowance: _void,
|
|
9
|
+
SmartContractAllowance: DerivationIndex,
|
|
10
|
+
AutoSigning: _void,
|
|
11
|
+
});
|
|
12
|
+
// outcome of a single resource allocation, surfaced to the product
|
|
13
|
+
export const AllocationOutcome = Enum({
|
|
14
|
+
Allocated: _void,
|
|
15
|
+
Rejected: _void,
|
|
16
|
+
NotAvailable: _void,
|
|
17
|
+
});
|
|
18
|
+
// errors
|
|
19
|
+
export const ResourceAllocationErr = ErrEnum('ResourceAllocationErr', {
|
|
20
|
+
Unknown: [GenericErr, 'ResourceAllocation: unknown error'],
|
|
21
|
+
});
|
|
22
|
+
// host_request_resource_allocation
|
|
23
|
+
export const RequestResourceAllocationV1_request = Vector(AllocatableResource);
|
|
24
|
+
export const RequestResourceAllocationV1_response = Result(Vector(AllocationOutcome), ResourceAllocationErr);
|
|
@@ -237,6 +237,67 @@ export declare const StatementStoreCreateProofV1_response: import("scale-ts").Co
|
|
|
237
237
|
}, import("@novasamatech/scale").CodecError<{
|
|
238
238
|
reason: string;
|
|
239
239
|
}, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">>>;
|
|
240
|
+
export declare const StatementStoreCreateProofAuthorizedV1_request: import("scale-ts").Codec<{
|
|
241
|
+
proof: {
|
|
242
|
+
tag: "Sr25519";
|
|
243
|
+
value: {
|
|
244
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
245
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
246
|
+
};
|
|
247
|
+
} | {
|
|
248
|
+
tag: "Ed25519";
|
|
249
|
+
value: {
|
|
250
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
251
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
252
|
+
};
|
|
253
|
+
} | {
|
|
254
|
+
tag: "Ecdsa";
|
|
255
|
+
value: {
|
|
256
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
257
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
258
|
+
};
|
|
259
|
+
} | {
|
|
260
|
+
tag: "OnChain";
|
|
261
|
+
value: {
|
|
262
|
+
who: Uint8Array<ArrayBufferLike>;
|
|
263
|
+
blockHash: Uint8Array<ArrayBufferLike>;
|
|
264
|
+
event: bigint;
|
|
265
|
+
};
|
|
266
|
+
} | undefined;
|
|
267
|
+
decryptionKey: Uint8Array<ArrayBufferLike> | undefined;
|
|
268
|
+
expiry: bigint | undefined;
|
|
269
|
+
channel: Uint8Array<ArrayBufferLike> | undefined;
|
|
270
|
+
topics: Uint8Array<ArrayBufferLike>[];
|
|
271
|
+
data: Uint8Array<ArrayBufferLike> | undefined;
|
|
272
|
+
}>;
|
|
273
|
+
export declare const StatementStoreCreateProofAuthorizedV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
274
|
+
tag: "Sr25519";
|
|
275
|
+
value: {
|
|
276
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
277
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
278
|
+
};
|
|
279
|
+
} | {
|
|
280
|
+
tag: "Ed25519";
|
|
281
|
+
value: {
|
|
282
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
283
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
284
|
+
};
|
|
285
|
+
} | {
|
|
286
|
+
tag: "Ecdsa";
|
|
287
|
+
value: {
|
|
288
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
289
|
+
signer: Uint8Array<ArrayBufferLike>;
|
|
290
|
+
};
|
|
291
|
+
} | {
|
|
292
|
+
tag: "OnChain";
|
|
293
|
+
value: {
|
|
294
|
+
who: Uint8Array<ArrayBufferLike>;
|
|
295
|
+
blockHash: Uint8Array<ArrayBufferLike>;
|
|
296
|
+
event: bigint;
|
|
297
|
+
};
|
|
298
|
+
}, import("@novasamatech/scale").CodecError<{
|
|
299
|
+
reason: string;
|
|
300
|
+
}, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">>>;
|
|
240
301
|
export declare const StatementStoreSubmitV1_request: import("scale-ts").Codec<{
|
|
241
302
|
proof: {
|
|
242
303
|
tag: "Sr25519";
|
|
@@ -66,6 +66,9 @@ export const StatementProofErr = ErrEnum('StatementProofErr', {
|
|
|
66
66
|
});
|
|
67
67
|
export const StatementStoreCreateProofV1_request = Tuple(ProductAccountId, Statement);
|
|
68
68
|
export const StatementStoreCreateProofV1_response = Result(StatementProof, StatementProofErr);
|
|
69
|
+
// creating proof using a host-internal allowance account (no product account required)
|
|
70
|
+
export const StatementStoreCreateProofAuthorizedV1_request = Statement;
|
|
71
|
+
export const StatementStoreCreateProofAuthorizedV1_response = Result(StatementProof, StatementProofErr);
|
|
69
72
|
// submit
|
|
70
73
|
export const StatementStoreSubmitV1_request = SignedStatement;
|
|
71
74
|
export const StatementStoreSubmitV1_response = Result(_void, GenericError);
|
package/dist/transport.js
CHANGED
|
@@ -171,6 +171,8 @@ export function createTransport(provider) {
|
|
|
171
171
|
handler(payload.value).then(result => {
|
|
172
172
|
const responseMessage = enumValue(responseAction, result);
|
|
173
173
|
transport.postMessage(requestId, responseMessage);
|
|
174
|
+
}, (error) => {
|
|
175
|
+
provider.logger.error(`handleRequest: handler for "${method}" rejected`, error);
|
|
174
176
|
});
|
|
175
177
|
});
|
|
176
178
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novasamatech/host-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.7",
|
|
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.7.
|
|
25
|
+
"@novasamatech/scale": "0.7.7",
|
|
26
26
|
"nanoevents": "9.1.0",
|
|
27
27
|
"nanoid": "5.1.9",
|
|
28
28
|
"neverthrow": "^8.2.0",
|