@keetanetwork/keetanet-client 0.10.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.
Files changed (71) hide show
  1. package/._version.d.ts +0 -0
  2. package/LICENSE +35 -0
  3. package/api/index.d.ts +181 -0
  4. package/api/node.d.ts +216 -0
  5. package/api/vote.d.ts +25 -0
  6. package/client/builder.d.ts +129 -0
  7. package/client/client_common_tests.d.ts +72 -0
  8. package/client/index-browser.d.ts +243 -0
  9. package/client/index-browser.js +141899 -0
  10. package/client/index.d.ts +243 -0
  11. package/client/index.js +89118 -0
  12. package/config/index.d.ts +62 -0
  13. package/lib/account.d.ts +544 -0
  14. package/lib/block/index.d.ts +181 -0
  15. package/lib/block/operations.d.ts +407 -0
  16. package/lib/bootstrap.d.ts +27 -0
  17. package/lib/error/account.d.ts +9 -0
  18. package/lib/error/block.d.ts +9 -0
  19. package/lib/error/client.d.ts +9 -0
  20. package/lib/error/index.d.ts +20 -0
  21. package/lib/error/kv.d.ts +9 -0
  22. package/lib/error/ledger.d.ts +12 -0
  23. package/lib/error/permissions.d.ts +9 -0
  24. package/lib/error/vote.d.ts +9 -0
  25. package/lib/index.d.ts +39 -0
  26. package/lib/kv/index.d.ts +22 -0
  27. package/lib/kv/index.test.data.d.ts +9 -0
  28. package/lib/kv/kv_dynamodb.d.ts +20 -0
  29. package/lib/kv/kv_memory.d.ts +17 -0
  30. package/lib/kv/kv_redis.d.ts +22 -0
  31. package/lib/kv/providers.d.ts +9 -0
  32. package/lib/ledger/cache.d.ts +14 -0
  33. package/lib/ledger/common.d.ts +115 -0
  34. package/lib/ledger/db_dynamodb.d.ts +129 -0
  35. package/lib/ledger/db_memory.d.ts +6 -0
  36. package/lib/ledger/db_postgres.d.ts +70 -0
  37. package/lib/ledger/db_spanner.d.ts +116 -0
  38. package/lib/ledger/db_spanner_helper.d.ts +487 -0
  39. package/lib/ledger/db_sqlite.d.ts +64 -0
  40. package/lib/ledger/drivers.d.ts +7 -0
  41. package/lib/ledger/effects.d.ts +78 -0
  42. package/lib/ledger/index.d.ts +312 -0
  43. package/lib/ledger/types.d.ts +49 -0
  44. package/lib/node/index.d.ts +114 -0
  45. package/lib/node/local.d.ts +30 -0
  46. package/lib/node/timing.d.ts +12 -0
  47. package/lib/node/utils.d.ts +4 -0
  48. package/lib/p2p.d.ts +300 -0
  49. package/lib/permissions.d.ts +121 -0
  50. package/lib/pubsub/index.d.ts +7 -0
  51. package/lib/pubsub/providers.d.ts +7 -0
  52. package/lib/pubsub/ps_memory.d.ts +9 -0
  53. package/lib/pubsub/ps_redis.d.ts +10 -0
  54. package/lib/stats.d.ts +51 -0
  55. package/lib/utils/asn1.d.ts +205 -0
  56. package/lib/utils/bitfield.d.ts +13 -0
  57. package/lib/utils/bloom.d.ts +6 -0
  58. package/lib/utils/buffer.d.ts +27 -0
  59. package/lib/utils/certificate.d.ts +340 -0
  60. package/lib/utils/conversion.d.ts +46 -0
  61. package/lib/utils/dynamodb.d.ts +17 -0
  62. package/lib/utils/ed2curve.d.ts +7 -0
  63. package/lib/utils/hash.d.ts +17 -0
  64. package/lib/utils/helper.d.ts +67 -0
  65. package/lib/utils/helper_testing.d.ts +37 -0
  66. package/lib/utils/initial.d.ts +32 -0
  67. package/lib/utils/never.d.ts +7 -0
  68. package/lib/utils/redis.d.ts +11 -0
  69. package/lib/vote.d.ts +273 -0
  70. package/package.json +35 -0
  71. package/version.d.ts +2 -0
package/._version.d.ts ADDED
Binary file
package/LICENSE ADDED
@@ -0,0 +1,35 @@
1
+ Keeta Token Network Community License (v1.0)
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
 
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
package/api/index.d.ts ADDED
@@ -0,0 +1,181 @@
1
+ import type Node from '../lib/node';
2
+ import type { JSONSerializable } from '../lib/utils/conversion';
3
+ declare const rootTree: {
4
+ vote: {
5
+ _root: {
6
+ POST: (request: APIRequest, payload: {
7
+ blocks: string[];
8
+ votes?: string[];
9
+ }) => Promise<{
10
+ vote: import("../lib/vote").VoteJSONOutput & {
11
+ $binary: string;
12
+ };
13
+ }>;
14
+ };
15
+ ':blockhash': {
16
+ GET: (request: APIRequest, blockhash: string) => Promise<{
17
+ blockhash: string;
18
+ votes: (import("../lib/vote").VoteJSONOutput & {
19
+ $binary: string;
20
+ })[] | null;
21
+ }>;
22
+ };
23
+ };
24
+ node: {
25
+ peers: {
26
+ GET: (request: APIRequest) => Promise<{
27
+ peers: import("./node").NodeAPIGetPeersResponse[];
28
+ }>;
29
+ };
30
+ publish: {
31
+ POST: (request: APIRequest, payload: {
32
+ votesAndBlocks: string;
33
+ }) => Promise<{
34
+ publish: boolean;
35
+ }>;
36
+ };
37
+ stats: {
38
+ GET: (request: APIRequest) => Promise<{
39
+ ledger: import("../lib/ledger/types").LedgerStatistics;
40
+ switch: import("../lib/p2p").P2PSwitchStatistics;
41
+ }>;
42
+ };
43
+ ledger: {
44
+ clearstats: {
45
+ GET: (_ignored_request: APIRequest) => Promise<{
46
+ clearStats: boolean;
47
+ }>;
48
+ };
49
+ block: {
50
+ ':blockhash': {
51
+ GET: (request: APIRequest, blockhash: string) => Promise<{
52
+ blockhash: string;
53
+ block: null | import("../lib/block").Block;
54
+ }>;
55
+ successor: {
56
+ GET: (request: APIRequest, blockhash: string) => Promise<{
57
+ blockhash: string;
58
+ successorBlock: null | import("../lib/block").Block;
59
+ }>;
60
+ };
61
+ };
62
+ };
63
+ representative: {
64
+ GET: (request: APIRequest, providedRep?: string) => Promise<import("./node").NodeAPIGetRepresentativeResponse>;
65
+ ':rep': {
66
+ GET: (request: APIRequest, providedRep?: string) => Promise<import("./node").NodeAPIGetRepresentativeResponse>;
67
+ };
68
+ };
69
+ representatives: {
70
+ GET: (request: APIRequest) => Promise<{
71
+ representatives: import("./node").NodeAPIGetAllRepresentativesResponse[];
72
+ }>;
73
+ };
74
+ account: {
75
+ ':account': {
76
+ GET: (request: APIRequest, pubKey: string) => Promise<import("./node").NodeAPIAccountState | import("./node").NodeAPIAccountStateError>;
77
+ head: {
78
+ GET: (request: APIRequest, account: string | import("../lib/account").GenericAccount) => Promise<{
79
+ account: import("../lib/account").GenericAccount;
80
+ block: null | import("../lib/block").Block;
81
+ }>;
82
+ };
83
+ chain: {
84
+ GET: (request: APIRequest, account: string) => Promise<import("./node").NodeAPIGetAccountChainResponse>;
85
+ };
86
+ history: {
87
+ GET: (request: APIRequest, account: string, start?: unknown) => Promise<import("./node").NodeAPIGetAccountHistoryResponse>;
88
+ start: {
89
+ ':block': {
90
+ GET: (request: APIRequest, account: string, start?: unknown) => Promise<import("./node").NodeAPIGetAccountHistoryResponse>;
91
+ };
92
+ };
93
+ };
94
+ balance: {
95
+ GET: (request: APIRequest, account: string | import("../lib/account").GenericAccount) => Promise<{
96
+ account: import("../lib/account").GenericAccount;
97
+ balances: import("../lib/ledger/types").GetAllBalancesResponse;
98
+ }>;
99
+ ':token': {
100
+ GET: (request: APIRequest, account: string | import("../lib/account").GenericAccount, token: string | import("../lib/account").TokenAddress) => Promise<{
101
+ account: import("../lib/account").GenericAccount;
102
+ token: import("../lib/account").TokenAddress;
103
+ balance: bigint;
104
+ }>;
105
+ };
106
+ };
107
+ acl: {
108
+ granted: {
109
+ GET: (request: APIRequest, entity: string | import("../lib/account").GenericAccount) => Promise<{
110
+ permissions: import("../lib/ledger/types").ACLRow[];
111
+ }>;
112
+ };
113
+ additional: {
114
+ GET: (request: APIRequest, principalPubKey: string, entityList?: string) => Promise<import("./node").NodeAPIPrincipalACLWithInfoResponse>;
115
+ ':entityList': {
116
+ GET: (request: APIRequest, principalPubKey: string, entityList?: string) => Promise<import("./node").NodeAPIPrincipalACLWithInfoResponse>;
117
+ };
118
+ };
119
+ GET: (request: APIRequest, principal: string | import("../lib/account").GenericAccount, entityPubKeys: string) => Promise<{
120
+ permissions: import("../lib/ledger/types").ACLRow[];
121
+ }>;
122
+ ':entityList': {
123
+ GET: (request: APIRequest, principal: string | import("../lib/account").GenericAccount, entityPubKeys: string) => Promise<{
124
+ permissions: import("../lib/ledger/types").ACLRow[];
125
+ }>;
126
+ };
127
+ };
128
+ pending: {
129
+ GET: (request: APIRequest, account: string) => Promise<{
130
+ account: string;
131
+ block: null | import("../lib/block").Block;
132
+ }>;
133
+ };
134
+ };
135
+ };
136
+ accounts: {
137
+ ':accounts': {
138
+ GET: (request: APIRequest, accounts: string) => Promise<(import("./node").NodeAPIAccountState | import("./node").NodeAPIAccountStateError)[]>;
139
+ };
140
+ };
141
+ checksum: {
142
+ GET: (request: APIRequest) => Promise<import("./node").NodeAPIGetLedgerChecksumResponse>;
143
+ };
144
+ };
145
+ bootstrap: {
146
+ votes: {
147
+ GET: (request: APIRequest) => Promise<{
148
+ voteStaples: import("../lib/vote").VoteStaple[];
149
+ }>;
150
+ };
151
+ };
152
+ version: {
153
+ GET: () => Promise<{
154
+ node: string;
155
+ }>;
156
+ };
157
+ };
158
+ };
159
+ export interface APIRequest {
160
+ node: Node;
161
+ params: {
162
+ [name: string]: string;
163
+ };
164
+ query: {
165
+ [name: string]: string;
166
+ };
167
+ payload: any;
168
+ header: {
169
+ get: (name: string) => string | undefined;
170
+ };
171
+ }
172
+ interface HandlerMapping {
173
+ method: 'GET' | 'PUT' | 'POST' | 'DELETE';
174
+ path: string;
175
+ timeout?: boolean;
176
+ handler: (request: APIRequest, ...args: any[]) => Promise<JSONSerializable>;
177
+ }
178
+ type HandlerMappings = HandlerMapping[];
179
+ declare const to_export: HandlerMappings;
180
+ export default to_export;
181
+ export type APITree = typeof rootTree;
package/api/node.d.ts ADDED
@@ -0,0 +1,216 @@
1
+ import type { AccountInfo, GetAllBalancesResponse, LedgerStatistics, ACLRow } from '../lib/ledger/types';
2
+ import type { P2PSwitchStatistics } from '../lib/p2p';
3
+ import { NodeKind } from '../lib/node';
4
+ import Block, { BlockHash } from '../lib/block';
5
+ import type { APIRequest } from '.';
6
+ import type { Endpoints } from '../config';
7
+ import type { GenericAccount, TokenAddress } from '../lib/account';
8
+ import Account from '../lib/account';
9
+ import type { VoteStaple } from '../lib/vote';
10
+ interface GetPeersAPIResponse {
11
+ kind: NodeKind;
12
+ key?: string;
13
+ endpoint?: string;
14
+ }
15
+ interface GetAccountChainAPIResponse {
16
+ account: string;
17
+ blocks: {
18
+ block: Block;
19
+ }[];
20
+ nextKey: BlockHash | null;
21
+ }
22
+ interface AccountState {
23
+ account: GenericAccount;
24
+ currentHeadBlock: BlockHash | null;
25
+ representative: Account | null;
26
+ balances: GetAllBalancesResponse;
27
+ info: AccountInfo;
28
+ }
29
+ interface AccountStateError {
30
+ account: string;
31
+ error: string;
32
+ }
33
+ interface GetAllRepresentativesAPIResponse {
34
+ representative: string;
35
+ endpoints: Endpoints;
36
+ }
37
+ interface GetRepresentativeAPIResponse {
38
+ representative: string;
39
+ weight: bigint;
40
+ }
41
+ interface GetLedgerChecksumAPIResponse {
42
+ moment: Date;
43
+ momentRange: number;
44
+ checksum: bigint;
45
+ }
46
+ interface PrincipalACLWithInfoResponse {
47
+ account: GenericAccount;
48
+ access: {
49
+ entity: GenericAccount;
50
+ info: AccountInfo;
51
+ balances: GetAllBalancesResponse;
52
+ principals: ACLRow[];
53
+ }[];
54
+ }
55
+ interface GetAccountHistoryResponse {
56
+ history: {
57
+ voteStaple: ReturnType<typeof VoteStaple['toJSONSerializable']>;
58
+ '$id': string;
59
+ '$timestamp': string;
60
+ }[];
61
+ }
62
+ declare function getPeers(request: APIRequest): Promise<{
63
+ peers: GetPeersAPIResponse[];
64
+ }>;
65
+ declare function publishVoteStaple(request: APIRequest, payload: {
66
+ votesAndBlocks: string;
67
+ }): Promise<{
68
+ publish: boolean;
69
+ }>;
70
+ declare function getNodeStats(request: APIRequest): Promise<{
71
+ ledger: LedgerStatistics;
72
+ switch: P2PSwitchStatistics;
73
+ }>;
74
+ declare function debugClearStats(_ignored_request: APIRequest): Promise<{
75
+ clearStats: boolean;
76
+ }>;
77
+ declare function getBlockSuccessor(request: APIRequest, blockhash: string): Promise<{
78
+ blockhash: string;
79
+ successorBlock: null | Block;
80
+ }>;
81
+ declare function getAccountPendingBlock(request: APIRequest, account: string): Promise<{
82
+ account: string;
83
+ block: null | Block;
84
+ }>;
85
+ declare function getAccountsHead(request: APIRequest, account: string | GenericAccount): Promise<{
86
+ account: GenericAccount;
87
+ block: null | Block;
88
+ }>;
89
+ declare function getAccountBalance(request: APIRequest, account: string | GenericAccount, token: string | TokenAddress): Promise<{
90
+ account: GenericAccount;
91
+ token: TokenAddress;
92
+ balance: bigint;
93
+ }>;
94
+ declare function getAllBalances(request: APIRequest, account: string | GenericAccount): Promise<{
95
+ account: GenericAccount;
96
+ balances: GetAllBalancesResponse;
97
+ }>;
98
+ declare function getAccountState(request: APIRequest, pubKey: string): Promise<AccountState | AccountStateError>;
99
+ declare function getBlockByHash(request: APIRequest, blockhash: string): Promise<{
100
+ blockhash: string;
101
+ block: null | Block;
102
+ }>;
103
+ declare function getAccountStates(request: APIRequest, accounts: string): Promise<(AccountState | AccountStateError)[]>;
104
+ declare function listACLsByEntity(request: APIRequest, entity: string | GenericAccount): Promise<{
105
+ permissions: ACLRow[];
106
+ }>;
107
+ declare function listACLsByPrincipal(request: APIRequest, principal: string | GenericAccount, entityPubKeys: string): Promise<{
108
+ permissions: ACLRow[];
109
+ }>;
110
+ declare function listACLsByPrincipalWithInfo(request: APIRequest, principalPubKey: string, entityList?: string): Promise<PrincipalACLWithInfoResponse>;
111
+ declare function getAccountChain(request: APIRequest, account: string): Promise<GetAccountChainAPIResponse>;
112
+ declare function getAccountHistory(request: APIRequest, account: string, start?: unknown): Promise<GetAccountHistoryResponse>;
113
+ declare function getAllRepresentatives(request: APIRequest): Promise<{
114
+ representatives: GetAllRepresentativesAPIResponse[];
115
+ }>;
116
+ declare function getRepresentative(request: APIRequest, providedRep?: string): Promise<GetRepresentativeAPIResponse>;
117
+ declare function getLedgerChecksum(request: APIRequest): Promise<GetLedgerChecksumAPIResponse>;
118
+ declare function getVoteStaplesAfter(request: APIRequest): Promise<{
119
+ voteStaples: VoteStaple[];
120
+ }>;
121
+ declare function getVersion(): Promise<{
122
+ node: string;
123
+ }>;
124
+ declare const _default: {
125
+ peers: {
126
+ GET: typeof getPeers;
127
+ };
128
+ publish: {
129
+ POST: typeof publishVoteStaple;
130
+ };
131
+ stats: {
132
+ GET: typeof getNodeStats;
133
+ };
134
+ ledger: {
135
+ clearstats: {
136
+ GET: typeof debugClearStats;
137
+ };
138
+ block: {
139
+ ':blockhash': {
140
+ GET: typeof getBlockByHash;
141
+ successor: {
142
+ GET: typeof getBlockSuccessor;
143
+ };
144
+ };
145
+ };
146
+ representative: {
147
+ GET: typeof getRepresentative;
148
+ ':rep': {
149
+ GET: typeof getRepresentative;
150
+ };
151
+ };
152
+ representatives: {
153
+ GET: typeof getAllRepresentatives;
154
+ };
155
+ account: {
156
+ ':account': {
157
+ GET: typeof getAccountState;
158
+ head: {
159
+ GET: typeof getAccountsHead;
160
+ };
161
+ chain: {
162
+ GET: typeof getAccountChain;
163
+ };
164
+ history: {
165
+ GET: typeof getAccountHistory;
166
+ start: {
167
+ ':block': {
168
+ GET: typeof getAccountHistory;
169
+ };
170
+ };
171
+ };
172
+ balance: {
173
+ GET: typeof getAllBalances;
174
+ ':token': {
175
+ GET: typeof getAccountBalance;
176
+ };
177
+ };
178
+ acl: {
179
+ granted: {
180
+ GET: typeof listACLsByEntity;
181
+ };
182
+ additional: {
183
+ GET: typeof listACLsByPrincipalWithInfo;
184
+ ':entityList': {
185
+ GET: typeof listACLsByPrincipalWithInfo;
186
+ };
187
+ };
188
+ GET: typeof listACLsByPrincipal;
189
+ ':entityList': {
190
+ GET: typeof listACLsByPrincipal;
191
+ };
192
+ };
193
+ pending: {
194
+ GET: typeof getAccountPendingBlock;
195
+ };
196
+ };
197
+ };
198
+ accounts: {
199
+ ':accounts': {
200
+ GET: typeof getAccountStates;
201
+ };
202
+ };
203
+ checksum: {
204
+ GET: typeof getLedgerChecksum;
205
+ };
206
+ };
207
+ bootstrap: {
208
+ votes: {
209
+ GET: typeof getVoteStaplesAfter;
210
+ };
211
+ };
212
+ version: {
213
+ GET: typeof getVersion;
214
+ };
215
+ };
216
+ export default _default;
package/api/vote.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ import type { APIRequest } from '.';
2
+ import KeetaNet from '../lib';
3
+ type Vote = InstanceType<typeof KeetaNet['Vote']>;
4
+ type VoteJSONOutput = ReturnType<Vote['toJSON']> & {
5
+ '$binary': string;
6
+ };
7
+ declare function createNewVote(request: APIRequest, payload: {
8
+ blocks: string[];
9
+ votes?: string[];
10
+ }): Promise<{
11
+ vote: VoteJSONOutput;
12
+ }>;
13
+ declare function getVotes(request: APIRequest, blockhash: string): Promise<{
14
+ blockhash: string;
15
+ votes: VoteJSONOutput[] | null;
16
+ }>;
17
+ declare const _default: {
18
+ _root: {
19
+ POST: typeof createNewVote;
20
+ };
21
+ ':blockhash': {
22
+ GET: typeof getVotes;
23
+ };
24
+ };
25
+ export default _default;
@@ -0,0 +1,129 @@
1
+ import type { GenericAccount, IdentifierKeyAlgorithm } from '../lib/account';
2
+ import { Account, AccountKeyAlgorithm } from '../lib/account';
3
+ import type { AdjustMethod, BlockHash } from '../lib/block';
4
+ import { Block } from '../lib/block';
5
+ import type { AccountInfo } from '../lib/ledger/types';
6
+ import type { AcceptedPermissionTypes } from '../lib/permissions';
7
+ import Permissions from '../lib/permissions';
8
+ type GetPrevFunction = (acct: GenericAccount | string) => Promise<BlockHash | string | null | undefined>;
9
+ interface AccountSignerOptions {
10
+ account: GenericAccount;
11
+ signer: Account;
12
+ }
13
+ interface RenderOptions {
14
+ network: bigint;
15
+ getPrevious: GetPrevFunction;
16
+ }
17
+ type BuilderBlockOptions = Partial<AccountSignerOptions>;
18
+ export type BuilderOptions = Partial<AccountSignerOptions> & Pick<AccountSignerOptions, 'signer'>;
19
+ type PerAccount<T> = {
20
+ [accountPubKey: string]: T;
21
+ };
22
+ interface IdentifierCreateRequest {
23
+ type: IdentifierKeyAlgorithm;
24
+ toResolve?: PendingAccount;
25
+ }
26
+ type AccountOrPending<Type extends AccountKeyAlgorithm = AccountKeyAlgorithm> = Account<Type> | PendingAccount<Type>;
27
+ type TokenOrPending = AccountOrPending<AccountKeyAlgorithm.TOKEN>;
28
+ export interface PendingOperations {
29
+ receive?: {
30
+ otherParty: AccountOrPending;
31
+ token: TokenOrPending;
32
+ amount: bigint;
33
+ exactReceive: boolean;
34
+ forward?: AccountOrPending;
35
+ }[];
36
+ send?: {
37
+ otherParty: AccountOrPending;
38
+ token: TokenOrPending;
39
+ amount: bigint;
40
+ external?: string;
41
+ }[];
42
+ createIdentifiers?: IdentifierCreateRequest[];
43
+ tokenSupply?: bigint;
44
+ adminModifyBalance?: {
45
+ isSet: boolean;
46
+ amount: bigint;
47
+ token: TokenOrPending;
48
+ }[];
49
+ permissionsChanges?: PerAccount<PerAccount<{
50
+ method: AdjustMethod;
51
+ permissions: Permissions;
52
+ }[]>>;
53
+ info?: AccountInfo;
54
+ setRep?: Account;
55
+ }
56
+ export interface PendingOperationsJSON {
57
+ receive?: {
58
+ otherParty: string;
59
+ token: string;
60
+ amount: string;
61
+ exactReceive: boolean;
62
+ forward?: string;
63
+ }[];
64
+ send?: {
65
+ otherParty: string;
66
+ token: string;
67
+ amount: string;
68
+ external?: string;
69
+ }[];
70
+ createIdentifiers?: {
71
+ type: IdentifierKeyAlgorithm;
72
+ }[];
73
+ tokenSupply?: string;
74
+ adminModifyBalance?: {
75
+ isSet: boolean;
76
+ amount: string;
77
+ token: string;
78
+ }[];
79
+ permissionsChanges?: PerAccount<PerAccount<{
80
+ method: AdjustMethod;
81
+ permissions: [string, string];
82
+ }[]>>;
83
+ info?: Pick<AccountInfo, 'name' | 'description' | 'metadata'> & {
84
+ defaultPermission?: [string, string];
85
+ };
86
+ setRep?: string;
87
+ }
88
+ export interface AccountSignerOptionsJSON {
89
+ account: string;
90
+ signer: string;
91
+ }
92
+ export interface AllPendingJSON {
93
+ renderedBlocks: string[];
94
+ nonRendered: [AccountSignerOptionsJSON, PendingOperationsJSON][];
95
+ }
96
+ export interface ComputeBlocksResponse {
97
+ blocks: Block[];
98
+ }
99
+ export declare class PendingAccount<AccountType extends AccountKeyAlgorithm = AccountKeyAlgorithm> {
100
+ #private;
101
+ static IsInstance: (obj: any, strict?: boolean) => obj is PendingAccount<AccountKeyAlgorithm>;
102
+ static GetValue<T extends AccountKeyAlgorithm>(data: AccountOrPending<T>): Account<T>;
103
+ set account(account: Account<AccountType>);
104
+ get account(): Account<AccountType>;
105
+ }
106
+ type AllPending = [AccountSignerOptions, PendingOperations][];
107
+ export declare class UserClientBuilder {
108
+ #private;
109
+ static isInstance: (obj: any, strict?: boolean) => obj is UserClientBuilder;
110
+ static PendingAccount: typeof PendingAccount;
111
+ static FromPendingJSON(options: BuilderOptions, getPrivateKey: (acct: Account) => Promise<Account>, multiAllPending: AllPendingJSON[]): Promise<UserClientBuilder>;
112
+ pendingToJSON(): AllPendingJSON;
113
+ constructor(options: BuilderOptions, previousRender?: ComputeBlocksResponse, previousPending?: AllPending);
114
+ get defaultOptions(): BuilderOptions;
115
+ updateAccounts(accountOptions: Partial<AccountSignerOptions>): void;
116
+ clone(): Promise<UserClientBuilder>;
117
+ computeBlocks(renderOptions: RenderOptions): Promise<ComputeBlocksResponse>;
118
+ send(recipient: AccountOrPending, amount: bigint, token: TokenOrPending, external?: string, options?: BuilderBlockOptions): void;
119
+ receive(from: AccountOrPending, amount: bigint, token: TokenOrPending, exact?: boolean, forward?: GenericAccount, options?: BuilderBlockOptions): void;
120
+ updatePermissions(principal: GenericAccount, permissions: AcceptedPermissionTypes, target?: GenericAccount, method?: AdjustMethod, options?: BuilderBlockOptions): void;
121
+ modifyTokenSupply(amount: bigint, options?: BuilderBlockOptions): void;
122
+ modifyTokenBalance(token: TokenOrPending, amount: bigint, isSet?: boolean, options?: BuilderBlockOptions): void;
123
+ setInfo(info: AccountInfo, options?: BuilderBlockOptions): void;
124
+ setRep(to: Account, options?: BuilderBlockOptions): void;
125
+ generateIdentifier<Algo extends IdentifierKeyAlgorithm>(type: Algo, options?: BuilderBlockOptions): PendingAccount<Algo>;
126
+ get blocks(): Block[];
127
+ get rendered(): boolean;
128
+ }
129
+ export {};
@@ -0,0 +1,72 @@
1
+ import * as KeetaNet from '.';
2
+ import type LocalNode from '../lib/node/local';
3
+ import type { Networks } from '../config';
4
+ import type Account from '../lib/account';
5
+ import type { UserClient } from '.';
6
+ import { toJSONSerializable } from '../lib/utils/conversion';
7
+ import KeetaError from '../lib/error';
8
+ export type ClientParams = {
9
+ ip?: string;
10
+ port?: number;
11
+ networkID: number;
12
+ networkAlias: Networks;
13
+ testPrivateAccount: {
14
+ seed: string;
15
+ };
16
+ repKeys: string[];
17
+ accountIndexes: number[];
18
+ trustedKeyIndex: number;
19
+ };
20
+ export type NodeCreationOptions = {
21
+ p2pTested?: boolean;
22
+ count?: number;
23
+ };
24
+ export declare function setup(options?: NodeCreationOptions): Promise<{
25
+ trustedKey: Account<import("../lib/account").AccountKeyAlgorithm.ECDSA_SECP256K1>;
26
+ repKeys: Account<import("../lib/account").AccountKeyAlgorithm.ECDSA_SECP256K1 | import("../lib/account").AccountKeyAlgorithm.ED25519 | import("../lib/account").AccountKeyAlgorithm.ECDSA_SECP256R1>[];
27
+ accounts: Account<import("../lib/account").AccountKeyAlgorithm.ECDSA_SECP256K1>[];
28
+ nodes: LocalNode[];
29
+ trustedClients: KeetaNet.UserClient[];
30
+ userClients: KeetaNet.UserClient[];
31
+ networkAddress: import("../lib/account").NetworkAddress;
32
+ baseToken: import("../lib/account").TokenAddress;
33
+ params: ClientParams;
34
+ cleanupFunctions: (() => Promise<void>)[];
35
+ }>;
36
+ declare function runBasicTests(nodes: LocalNode[], userClient: UserClient, trustedClient: UserClient, params: ClientParams, expect: any, _ignoreExpectErrorCode: any): Promise<void>;
37
+ declare function runBuilderStorageTests(_ignoreNodes: LocalNode[], userClient: UserClient, trustedClient: UserClient, params: ClientParams, expect: any, ExpectErrorCode: any): Promise<void>;
38
+ declare function runRecoverAccountTest(nodes: LocalNode[], userClient: UserClient, trustedClient: UserClient, params: ClientParams, expect: any, ExpectErrorCode: any): Promise<void>;
39
+ declare function runNonNodeTests(_ignore_nodes: LocalNode[], _ignore_userClient: UserClient, _ignore_trustedClient: UserClient, _ignore_params: ClientParams, expect: any, _ignore_ExpectErrorCode: any): Promise<void>;
40
+ export declare const clientTests: {
41
+ 'Basic Client Tests': {
42
+ test: typeof runBasicTests;
43
+ options: {
44
+ p2pTested: boolean;
45
+ count: number;
46
+ };
47
+ };
48
+ 'Basic Client Tests (No Node)': {
49
+ test: typeof runNonNodeTests;
50
+ options: {
51
+ p2pTested: boolean;
52
+ count: number;
53
+ timeout: number;
54
+ };
55
+ };
56
+ 'Builder/Storage Test': {
57
+ test: typeof runBuilderStorageTests;
58
+ options: {
59
+ p2pTested: boolean;
60
+ count: number;
61
+ };
62
+ };
63
+ 'Recover Account Test': {
64
+ test: typeof runRecoverAccountTest;
65
+ options: {
66
+ p2pTested: boolean;
67
+ count: number;
68
+ };
69
+ };
70
+ };
71
+ export declare const KeetaNetError: typeof KeetaError;
72
+ export { toJSONSerializable };