@novasamatech/host-api 0.4.0 → 0.4.1
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/commonEncoders.d.ts
CHANGED
|
@@ -7,10 +7,3 @@ export declare function responseEncoder<T>(codec: Codec<T>): Codec<{
|
|
|
7
7
|
tag: "error";
|
|
8
8
|
value: string;
|
|
9
9
|
}>;
|
|
10
|
-
export declare function createNullableEncoder<T>(codec: Codec<T>): Codec<{
|
|
11
|
-
tag: "value";
|
|
12
|
-
value: T;
|
|
13
|
-
} | {
|
|
14
|
-
tag: "null";
|
|
15
|
-
value: undefined;
|
|
16
|
-
}>;
|
package/dist/commonEncoders.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fromHex, toHex } from '@polkadot-api/utils';
|
|
2
|
-
import { Bytes, Enum,
|
|
2
|
+
import { Bytes, Enum, str } from 'scale-ts';
|
|
3
3
|
import { createTransportEncoder } from './createTransportEncoder';
|
|
4
4
|
export const hexEncoder = createTransportEncoder({
|
|
5
5
|
codec: Bytes(),
|
|
@@ -12,9 +12,3 @@ export function responseEncoder(codec) {
|
|
|
12
12
|
error: str,
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
export function createNullableEncoder(codec) {
|
|
16
|
-
return Enum({
|
|
17
|
-
value: codec,
|
|
18
|
-
null: _void,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bytes, Enum, Option, Struct, Vector, _void, bool, str, u16, u32 } from 'scale-ts';
|
|
2
|
-
import {
|
|
2
|
+
import { hexEncoder } from '../commonEncoders';
|
|
3
3
|
import { createTransportEncoder } from '../createTransportEncoder';
|
|
4
4
|
const signRawRequestCodec = Struct({
|
|
5
5
|
address: str,
|
|
@@ -132,7 +132,7 @@ export const signResponseV1Encoder = createTransportEncoder({
|
|
|
132
132
|
});
|
|
133
133
|
const createTransactionRequestCodec = Struct({
|
|
134
134
|
version: u16,
|
|
135
|
-
signer:
|
|
135
|
+
signer: Option(str),
|
|
136
136
|
callData: hexEncoder,
|
|
137
137
|
extensions: Vector(Struct({
|
|
138
138
|
id: str,
|
|
@@ -155,21 +155,13 @@ export const createTransactionRequestV1Encoder = createTransportEncoder({
|
|
|
155
155
|
}
|
|
156
156
|
return {
|
|
157
157
|
version,
|
|
158
|
-
signer: signer
|
|
158
|
+
signer: signer ?? null,
|
|
159
159
|
...rest,
|
|
160
160
|
};
|
|
161
161
|
},
|
|
162
162
|
to({ signer, ...rest }) {
|
|
163
163
|
return {
|
|
164
|
-
signer:
|
|
165
|
-
? {
|
|
166
|
-
tag: 'value',
|
|
167
|
-
value: signer,
|
|
168
|
-
}
|
|
169
|
-
: {
|
|
170
|
-
tag: 'null',
|
|
171
|
-
value: undefined,
|
|
172
|
-
},
|
|
164
|
+
signer: signer ?? undefined,
|
|
173
165
|
...rest,
|
|
174
166
|
};
|
|
175
167
|
},
|