postchain-client 1.0.1 → 1.0.2
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/built/index.d.ts +1 -1
- package/built/index.js +2 -2
- package/built/src/chromia/chromiaClientProvider.d.ts +8 -3
- package/built/src/chromia/interfaces.d.ts +1 -1
- package/built/src/encryption/types.d.ts +1 -1
- package/built/src/formatter.d.ts +4 -0
- package/built/src/gtv/types.d.ts +2 -2
- package/built/src/gtx/types.d.ts +7 -7
- package/built/src/merkle/types.d.ts +4 -4
- package/built/src/restclient/types.d.ts +11 -11
- package/package.json +1 -1
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { RestClient } from "../restclient/interfaces";
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import type { RestClient } from "../restclient/interfaces";
|
|
2
|
+
import type { ChromiaClient } from "./interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Provides postchain clients that can be used to communicate with dapps within the chromia network
|
|
5
|
+
* @param chain0BRID brid of chain0
|
|
6
|
+
* @param rest rest client configured to node running chain0
|
|
7
|
+
*/
|
|
8
|
+
export declare function chromiaClientProvider(chain0BRID: string, rest: RestClient): ChromiaClient;
|
package/built/src/formatter.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { GTX, RawGtx } from "./gtx/types";
|
|
2
3
|
export declare function pgBytes(buffer: Buffer): string;
|
|
3
4
|
/**
|
|
4
5
|
* Converts hex string to Buffer
|
|
@@ -16,4 +17,7 @@ export declare class PgBytesInputException extends Error {
|
|
|
16
17
|
constructor(buffer: Buffer);
|
|
17
18
|
}
|
|
18
19
|
export declare function ensureBuffer(value: string | Buffer): Buffer;
|
|
20
|
+
export declare function checkGtvType(value: any): boolean;
|
|
21
|
+
export declare function rawGtxToGtx(rawGtx: RawGtx): GTX;
|
|
22
|
+
export declare function checkGtxType(value: any): boolean;
|
|
19
23
|
export declare function removeDuplicateSigners(signers: Buffer[]): Buffer[];
|
package/built/src/gtv/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type RawGtv = null | Buffer | string | number | DictPair | Array<RawGtv> | bigint;
|
|
3
|
+
export type DictPair = {
|
|
4
4
|
name: string;
|
|
5
5
|
value: RawGtv;
|
|
6
6
|
};
|
package/built/src/gtx/types.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { RawGtv } from "../gtv/types";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type RawGtxOp = [opName: string, args: RawGtv[]];
|
|
4
|
+
export type RawGtxBody = [
|
|
5
5
|
blockchainRID: Buffer,
|
|
6
6
|
operations: RawGtxOp[],
|
|
7
7
|
signers: Buffer[]
|
|
8
8
|
];
|
|
9
|
-
export
|
|
10
|
-
export
|
|
9
|
+
export type RawGtx = [transaction: RawGtxBody, signatures: Buffer[]];
|
|
10
|
+
export type GTX = {
|
|
11
11
|
[x: string]: any;
|
|
12
12
|
blockchainRID: Buffer;
|
|
13
13
|
operations: RellOperation[];
|
|
14
14
|
signers: Buffer[];
|
|
15
15
|
signatures?: Buffer[];
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type RellOperation = {
|
|
18
18
|
opName: string;
|
|
19
19
|
args: RawGtv[];
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type SignerPair = {
|
|
22
22
|
pubKey: string;
|
|
23
23
|
signature: string;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type BufferSignerPair = {
|
|
26
26
|
pubKey: Buffer;
|
|
27
27
|
signature: Buffer;
|
|
28
28
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export
|
|
2
|
+
export type Step = {
|
|
3
3
|
side: number;
|
|
4
4
|
hash: Buffer;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type StringStep = {
|
|
7
7
|
side: number;
|
|
8
8
|
hash: string;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
11
|
-
export
|
|
10
|
+
export type Path = Step[];
|
|
11
|
+
export type StringPath = StringStep[];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { RawGtv } from "../gtv/types";
|
|
3
3
|
import { BufferSignerPair, SignerPair } from "../gtx/types";
|
|
4
4
|
import { Path, StringPath } from "../merkle/types";
|
|
5
|
-
export
|
|
5
|
+
export type RestClientConfig = {
|
|
6
6
|
endpointPool: readonly string[];
|
|
7
7
|
pool: {
|
|
8
8
|
maxSockets: number;
|
|
@@ -11,7 +11,7 @@ export declare type RestClientConfig = {
|
|
|
11
11
|
attemptsPerEndpoint: number;
|
|
12
12
|
attemptInterval: number;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type RequestOptions = {
|
|
15
15
|
method: string;
|
|
16
16
|
url: string;
|
|
17
17
|
json: boolean;
|
|
@@ -20,17 +20,17 @@ export declare type RequestOptions = {
|
|
|
20
20
|
maxSockets: number;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type QueryObject = {
|
|
24
24
|
type: string;
|
|
25
25
|
[arg: string]: RawGtv;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export type ServerReturnProof = {
|
|
28
28
|
hash: string;
|
|
29
29
|
blockHeader: string;
|
|
30
30
|
signatures: SignerPair[];
|
|
31
31
|
merklePath: StringPath;
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type ResponseObjectProof = {
|
|
34
34
|
hash: Buffer;
|
|
35
35
|
blockHeader: Buffer;
|
|
36
36
|
signatures: BufferSignerPair[];
|
|
@@ -42,20 +42,20 @@ export declare enum ResponseStatus {
|
|
|
42
42
|
Unknown = "unknown",
|
|
43
43
|
Waiting = "waiting"
|
|
44
44
|
}
|
|
45
|
-
export
|
|
45
|
+
export type TransactionObject = {
|
|
46
46
|
tx: string;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type StatusObject = {
|
|
49
49
|
status: ResponseStatus;
|
|
50
50
|
rejectReason?: string;
|
|
51
51
|
};
|
|
52
|
-
export
|
|
53
|
-
export
|
|
54
|
-
export
|
|
52
|
+
export type PostRequestObjects = TransactionObject | QueryObject;
|
|
53
|
+
export type GetResponseObjects = StatusObject | TransactionObject | ServerReturnProof;
|
|
54
|
+
export type FailOverConfig = {
|
|
55
55
|
attemptsPerEndpoint?: number;
|
|
56
56
|
attemptInterval?: number;
|
|
57
57
|
};
|
|
58
|
-
export
|
|
58
|
+
export type ResponseObject = {
|
|
59
59
|
error: Error;
|
|
60
60
|
statusCode: number;
|
|
61
61
|
rspBody: any;
|