mmn-client-js 1.0.14-node14 → 1.0.15
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/index.d.ts +284 -277
- package/dist/index.esm.js +846 -832
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +846 -839
- package/dist/index.js.map +1 -1
- package/package.json +10 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,285 +1,292 @@
|
|
|
1
|
-
interface JsonRpcRequest {
|
|
2
|
-
jsonrpc: '2.0';
|
|
3
|
-
method: string;
|
|
4
|
-
params?: unknown;
|
|
5
|
-
id: string | number;
|
|
6
|
-
}
|
|
7
|
-
interface JsonRpcError {
|
|
8
|
-
code: number;
|
|
9
|
-
message: string;
|
|
10
|
-
data?: unknown;
|
|
11
|
-
}
|
|
12
|
-
interface JsonRpcResponse<T = unknown> {
|
|
13
|
-
jsonrpc: '2.0';
|
|
14
|
-
result?: T;
|
|
15
|
-
error?: JsonRpcError;
|
|
16
|
-
id: string | number;
|
|
17
|
-
}
|
|
18
|
-
interface IEphemeralKeyPair {
|
|
19
|
-
privateKey: string;
|
|
20
|
-
publicKey: string;
|
|
21
|
-
}
|
|
22
|
-
declare enum ETransferType {
|
|
23
|
-
GiveCoffee = "give_coffee",
|
|
24
|
-
TransferToken = "transfer_token",
|
|
25
|
-
UnlockItem = "unlock_item"
|
|
26
|
-
}
|
|
27
|
-
interface ExtraInfo {
|
|
28
|
-
type: ETransferType | string;
|
|
29
|
-
ItemId?: string;
|
|
30
|
-
ItemType?: string;
|
|
31
|
-
ClanId?: string;
|
|
32
|
-
UserSenderId?: string;
|
|
33
|
-
UserSenderUsername?: string;
|
|
34
|
-
UserReceiverId?: string;
|
|
35
|
-
ChannelId?: string;
|
|
36
|
-
MessageRefId?: string;
|
|
37
|
-
ExtraAttribute?: string;
|
|
38
|
-
[x: string]: string;
|
|
39
|
-
}
|
|
40
|
-
interface TxMsg {
|
|
41
|
-
type: number;
|
|
42
|
-
sender: string;
|
|
43
|
-
recipient: string;
|
|
44
|
-
amount: string;
|
|
45
|
-
timestamp: number;
|
|
46
|
-
text_data: string;
|
|
47
|
-
nonce: number;
|
|
48
|
-
extra_info: string;
|
|
49
|
-
zk_proof: string;
|
|
50
|
-
zk_pub: string;
|
|
51
|
-
}
|
|
52
|
-
interface SignedTx {
|
|
53
|
-
tx_msg: TxMsg;
|
|
54
|
-
signature: string;
|
|
55
|
-
}
|
|
56
|
-
interface SendTransactionBase {
|
|
57
|
-
sender: string;
|
|
58
|
-
recipient: string;
|
|
59
|
-
amount: string;
|
|
60
|
-
nonce: number;
|
|
61
|
-
timestamp?: number;
|
|
62
|
-
textData?: string;
|
|
63
|
-
privateKey: string;
|
|
64
|
-
extraInfo?: ExtraInfo;
|
|
65
|
-
}
|
|
66
|
-
interface SendTransactionRequest extends SendTransactionBase {
|
|
67
|
-
zkProof: string;
|
|
68
|
-
zkPub: string;
|
|
69
|
-
publicKey: string;
|
|
70
|
-
}
|
|
71
|
-
interface AddTxResponse {
|
|
72
|
-
ok: boolean;
|
|
73
|
-
tx_hash: string;
|
|
74
|
-
error: string;
|
|
75
|
-
}
|
|
76
|
-
interface GetCurrentNonceResponse {
|
|
77
|
-
address: string;
|
|
78
|
-
nonce: number;
|
|
79
|
-
tag: string;
|
|
80
|
-
error: string;
|
|
81
|
-
}
|
|
82
|
-
interface GetAccountByAddressResponse {
|
|
83
|
-
address: string;
|
|
84
|
-
balance: string;
|
|
85
|
-
nonce: number;
|
|
86
|
-
decimals: number;
|
|
87
|
-
}
|
|
88
|
-
interface MmnClientConfig {
|
|
89
|
-
baseUrl: string;
|
|
90
|
-
timeout?: number;
|
|
91
|
-
headers?: Record<string, string>;
|
|
92
|
-
}
|
|
93
|
-
interface Transaction {
|
|
94
|
-
chain_id: string;
|
|
95
|
-
hash: string;
|
|
96
|
-
nonce: number;
|
|
97
|
-
block_hash: string;
|
|
98
|
-
block_number: number;
|
|
99
|
-
block_timestamp: number;
|
|
100
|
-
transaction_index: number;
|
|
101
|
-
from_address: string;
|
|
102
|
-
to_address: string;
|
|
103
|
-
value: string;
|
|
104
|
-
gas: number;
|
|
105
|
-
gas_price: string;
|
|
106
|
-
data: string;
|
|
107
|
-
function_selector: string;
|
|
108
|
-
max_fee_per_gas: string;
|
|
109
|
-
max_priority_fee_per_gas: string;
|
|
110
|
-
max_fee_per_blob_gas?: string;
|
|
111
|
-
blob_versioned_hashes?: string[];
|
|
112
|
-
transaction_type: number;
|
|
113
|
-
r: string;
|
|
114
|
-
s: string;
|
|
115
|
-
v: string;
|
|
116
|
-
access_list_json?: string;
|
|
117
|
-
authorization_list_json?: string;
|
|
118
|
-
contract_address?: string;
|
|
119
|
-
gas_used?: number;
|
|
120
|
-
cumulative_gas_used?: number;
|
|
121
|
-
effective_gas_price?: string;
|
|
122
|
-
blob_gas_used?: number;
|
|
123
|
-
blob_gas_price?: string;
|
|
124
|
-
logs_bloom?: string;
|
|
125
|
-
status?: number;
|
|
126
|
-
transaction_timestamp: number;
|
|
127
|
-
text_data: string;
|
|
128
|
-
extra_info: string;
|
|
129
|
-
}
|
|
130
|
-
interface Meta {
|
|
131
|
-
chain_id: number;
|
|
132
|
-
address?: string;
|
|
133
|
-
signature?: string;
|
|
134
|
-
page: number;
|
|
135
|
-
limit?: number;
|
|
136
|
-
total_items?: number;
|
|
137
|
-
total_pages?: number;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
interface
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
data
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
1
|
+
interface JsonRpcRequest {
|
|
2
|
+
jsonrpc: '2.0';
|
|
3
|
+
method: string;
|
|
4
|
+
params?: unknown;
|
|
5
|
+
id: string | number;
|
|
6
|
+
}
|
|
7
|
+
interface JsonRpcError {
|
|
8
|
+
code: number;
|
|
9
|
+
message: string;
|
|
10
|
+
data?: unknown;
|
|
11
|
+
}
|
|
12
|
+
interface JsonRpcResponse<T = unknown> {
|
|
13
|
+
jsonrpc: '2.0';
|
|
14
|
+
result?: T;
|
|
15
|
+
error?: JsonRpcError;
|
|
16
|
+
id: string | number;
|
|
17
|
+
}
|
|
18
|
+
interface IEphemeralKeyPair {
|
|
19
|
+
privateKey: string;
|
|
20
|
+
publicKey: string;
|
|
21
|
+
}
|
|
22
|
+
declare enum ETransferType {
|
|
23
|
+
GiveCoffee = "give_coffee",
|
|
24
|
+
TransferToken = "transfer_token",
|
|
25
|
+
UnlockItem = "unlock_item"
|
|
26
|
+
}
|
|
27
|
+
interface ExtraInfo {
|
|
28
|
+
type: ETransferType | string;
|
|
29
|
+
ItemId?: string;
|
|
30
|
+
ItemType?: string;
|
|
31
|
+
ClanId?: string;
|
|
32
|
+
UserSenderId?: string;
|
|
33
|
+
UserSenderUsername?: string;
|
|
34
|
+
UserReceiverId?: string;
|
|
35
|
+
ChannelId?: string;
|
|
36
|
+
MessageRefId?: string;
|
|
37
|
+
ExtraAttribute?: string;
|
|
38
|
+
[x: string]: string | string[];
|
|
39
|
+
}
|
|
40
|
+
interface TxMsg {
|
|
41
|
+
type: number;
|
|
42
|
+
sender: string;
|
|
43
|
+
recipient: string;
|
|
44
|
+
amount: string;
|
|
45
|
+
timestamp: number;
|
|
46
|
+
text_data: string;
|
|
47
|
+
nonce: number;
|
|
48
|
+
extra_info: string;
|
|
49
|
+
zk_proof: string;
|
|
50
|
+
zk_pub: string;
|
|
51
|
+
}
|
|
52
|
+
interface SignedTx {
|
|
53
|
+
tx_msg: TxMsg;
|
|
54
|
+
signature: string;
|
|
55
|
+
}
|
|
56
|
+
interface SendTransactionBase {
|
|
57
|
+
sender: string;
|
|
58
|
+
recipient: string;
|
|
59
|
+
amount: string;
|
|
60
|
+
nonce: number;
|
|
61
|
+
timestamp?: number;
|
|
62
|
+
textData?: string;
|
|
63
|
+
privateKey: string;
|
|
64
|
+
extraInfo?: ExtraInfo;
|
|
65
|
+
}
|
|
66
|
+
interface SendTransactionRequest extends SendTransactionBase {
|
|
67
|
+
zkProof: string;
|
|
68
|
+
zkPub: string;
|
|
69
|
+
publicKey: string;
|
|
70
|
+
}
|
|
71
|
+
interface AddTxResponse {
|
|
72
|
+
ok: boolean;
|
|
73
|
+
tx_hash: string;
|
|
74
|
+
error: string;
|
|
75
|
+
}
|
|
76
|
+
interface GetCurrentNonceResponse {
|
|
77
|
+
address: string;
|
|
78
|
+
nonce: number;
|
|
79
|
+
tag: string;
|
|
80
|
+
error: string;
|
|
81
|
+
}
|
|
82
|
+
interface GetAccountByAddressResponse {
|
|
83
|
+
address: string;
|
|
84
|
+
balance: string;
|
|
85
|
+
nonce: number;
|
|
86
|
+
decimals: number;
|
|
87
|
+
}
|
|
88
|
+
interface MmnClientConfig {
|
|
89
|
+
baseUrl: string;
|
|
90
|
+
timeout?: number;
|
|
91
|
+
headers?: Record<string, string>;
|
|
92
|
+
}
|
|
93
|
+
interface Transaction {
|
|
94
|
+
chain_id: string;
|
|
95
|
+
hash: string;
|
|
96
|
+
nonce: number;
|
|
97
|
+
block_hash: string;
|
|
98
|
+
block_number: number;
|
|
99
|
+
block_timestamp: number;
|
|
100
|
+
transaction_index: number;
|
|
101
|
+
from_address: string;
|
|
102
|
+
to_address: string;
|
|
103
|
+
value: string;
|
|
104
|
+
gas: number;
|
|
105
|
+
gas_price: string;
|
|
106
|
+
data: string;
|
|
107
|
+
function_selector: string;
|
|
108
|
+
max_fee_per_gas: string;
|
|
109
|
+
max_priority_fee_per_gas: string;
|
|
110
|
+
max_fee_per_blob_gas?: string;
|
|
111
|
+
blob_versioned_hashes?: string[];
|
|
112
|
+
transaction_type: number;
|
|
113
|
+
r: string;
|
|
114
|
+
s: string;
|
|
115
|
+
v: string;
|
|
116
|
+
access_list_json?: string;
|
|
117
|
+
authorization_list_json?: string;
|
|
118
|
+
contract_address?: string;
|
|
119
|
+
gas_used?: number;
|
|
120
|
+
cumulative_gas_used?: number;
|
|
121
|
+
effective_gas_price?: string;
|
|
122
|
+
blob_gas_used?: number;
|
|
123
|
+
blob_gas_price?: string;
|
|
124
|
+
logs_bloom?: string;
|
|
125
|
+
status?: number;
|
|
126
|
+
transaction_timestamp: number;
|
|
127
|
+
text_data: string;
|
|
128
|
+
extra_info: string;
|
|
129
|
+
}
|
|
130
|
+
interface Meta {
|
|
131
|
+
chain_id: number;
|
|
132
|
+
address?: string;
|
|
133
|
+
signature?: string;
|
|
134
|
+
page: number;
|
|
135
|
+
limit?: number;
|
|
136
|
+
total_items?: number;
|
|
137
|
+
total_pages?: number;
|
|
138
|
+
has_more?: boolean;
|
|
139
|
+
next_timestamp?: string;
|
|
140
|
+
next_hash?: string;
|
|
141
|
+
}
|
|
142
|
+
interface WalletDetail {
|
|
143
|
+
address: string;
|
|
144
|
+
balance: string;
|
|
145
|
+
account_nonce: number;
|
|
146
|
+
last_balance_update: number;
|
|
147
|
+
}
|
|
148
|
+
interface WalletDetailResponse {
|
|
149
|
+
data: WalletDetail;
|
|
150
|
+
}
|
|
151
|
+
interface ListTransactionResponse {
|
|
152
|
+
meta: Meta;
|
|
153
|
+
data?: Transaction[];
|
|
154
|
+
}
|
|
155
|
+
interface TransactionDetailResponse {
|
|
156
|
+
data: {
|
|
157
|
+
transaction: Transaction;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
interface IndexerClientConfig {
|
|
161
|
+
endpoint: string;
|
|
162
|
+
chainId: string;
|
|
163
|
+
timeout?: number;
|
|
164
|
+
headers?: Record<string, string>;
|
|
165
|
+
}
|
|
166
|
+
interface ZkClientConfig {
|
|
167
|
+
endpoint: string;
|
|
168
|
+
timeout?: number;
|
|
169
|
+
headers?: Record<string, string>;
|
|
170
|
+
}
|
|
171
|
+
declare enum EZkClientType {
|
|
172
|
+
MEZON = "mezon",
|
|
173
|
+
OAUTH = "oauth"
|
|
174
|
+
}
|
|
175
|
+
interface GetZkProofRequest {
|
|
176
|
+
userId: string;
|
|
177
|
+
ephemeralPublicKey: string;
|
|
178
|
+
jwt: string;
|
|
179
|
+
address: string;
|
|
180
|
+
clientType?: EZkClientType;
|
|
181
|
+
}
|
|
182
|
+
interface IZkProof {
|
|
183
|
+
proof: string;
|
|
184
|
+
public_input: string;
|
|
182
185
|
}
|
|
183
186
|
|
|
184
|
-
declare class IndexerClient {
|
|
185
|
-
private endpoint;
|
|
186
|
-
private chainId;
|
|
187
|
-
private timeout;
|
|
188
|
-
private headers;
|
|
189
|
-
constructor(config: IndexerClientConfig);
|
|
190
|
-
/**
|
|
191
|
-
* Make HTTP request with automatic CORS handling
|
|
192
|
-
* Works out-of-the-box without CORS configuration
|
|
193
|
-
* @param method - HTTP method (GET or POST)
|
|
194
|
-
* @param path - API endpoint path
|
|
195
|
-
* @param params - URL query parameters
|
|
196
|
-
* @param body - Request body for POST requests
|
|
197
|
-
* @returns Promise resolving to response data
|
|
198
|
-
*/
|
|
199
|
-
private makeRequest;
|
|
200
|
-
getTransactionByHash(hash: string): Promise<Transaction>;
|
|
201
|
-
|
|
202
|
-
|
|
187
|
+
declare class IndexerClient {
|
|
188
|
+
private endpoint;
|
|
189
|
+
private chainId;
|
|
190
|
+
private timeout;
|
|
191
|
+
private headers;
|
|
192
|
+
constructor(config: IndexerClientConfig);
|
|
193
|
+
/**
|
|
194
|
+
* Make HTTP request with automatic CORS handling
|
|
195
|
+
* Works out-of-the-box without CORS configuration
|
|
196
|
+
* @param method - HTTP method (GET or POST)
|
|
197
|
+
* @param path - API endpoint path
|
|
198
|
+
* @param params - URL query parameters
|
|
199
|
+
* @param body - Request body for POST requests
|
|
200
|
+
* @returns Promise resolving to response data
|
|
201
|
+
*/
|
|
202
|
+
private makeRequest;
|
|
203
|
+
getTransactionByHash(hash: string): Promise<Transaction>;
|
|
204
|
+
getTransactionsByWalletBeforeTimestamp(wallet: string, filter: number, limit?: number, timestamp_lt?: string, last_hash?: string): Promise<ListTransactionResponse>;
|
|
205
|
+
getTransactionByWallet(wallet: string, page: number | undefined, limit: number | undefined, filter: number, sortBy?: string, sortOrder?: 'asc' | 'desc'): Promise<ListTransactionResponse>;
|
|
206
|
+
getWalletDetail(wallet: string): Promise<WalletDetail>;
|
|
203
207
|
}
|
|
204
208
|
|
|
205
|
-
declare class MmnClient {
|
|
206
|
-
private config;
|
|
207
|
-
private requestId;
|
|
208
|
-
constructor(config: MmnClientConfig);
|
|
209
|
-
private makeRequest;
|
|
210
|
-
/**
|
|
211
|
-
* Securely convert raw Ed25519 private key to PKCS#8 format
|
|
212
|
-
* @param raw - Raw 32-byte Ed25519 private key
|
|
213
|
-
* @returns PKCS#8 formatted private key in hex
|
|
214
|
-
* @throws Error if input validation fails
|
|
215
|
-
*/
|
|
216
|
-
private rawEd25519ToPkcs8Hex;
|
|
217
|
-
/**
|
|
218
|
-
* Encode length in ASN.1 DER format
|
|
219
|
-
* ASN.1 length encoding rules:
|
|
220
|
-
* - Short form (0-127): single byte with the length value
|
|
221
|
-
* - Long form (128+): first byte is 0x80 + number of length bytes, followed by length bytes
|
|
222
|
-
* @param length - The length value to encode
|
|
223
|
-
* @returns ASN.1 DER encoded length bytes
|
|
224
|
-
*/
|
|
225
|
-
private encodeLength;
|
|
226
|
-
/**
|
|
227
|
-
* Generate secure entropy using multiple sources for maximum compatibility
|
|
228
|
-
* @returns Array of 32 random bytes
|
|
229
|
-
*/
|
|
230
|
-
private generateSecureEntropy;
|
|
231
|
-
/**
|
|
232
|
-
* Securely generate ephemeral key pair with proper entropy
|
|
233
|
-
* React Native compatible version with multiple fallbacks
|
|
234
|
-
* @returns Ephemeral key pair with private and public keys
|
|
235
|
-
* @throws Error if key generation fails
|
|
236
|
-
*/
|
|
237
|
-
generateEphemeralKeyPair(): IEphemeralKeyPair;
|
|
238
|
-
getAddressFromUserId(userId: string): string;
|
|
239
|
-
/**
|
|
240
|
-
* Create and sign a transaction message
|
|
241
|
-
*/
|
|
242
|
-
private createAndSignTx;
|
|
243
|
-
/**
|
|
244
|
-
* Securely sign a transaction with Ed25519
|
|
245
|
-
* @param tx - Transaction message to sign
|
|
246
|
-
* @param privateKeyHex - Private key in PKCS#8 hex format
|
|
247
|
-
* @returns Base58 encoded signature
|
|
248
|
-
* @throws Error if signing fails
|
|
249
|
-
*/
|
|
250
|
-
private signTransaction;
|
|
251
|
-
/**
|
|
252
|
-
* Serialize transaction for signing
|
|
253
|
-
*/
|
|
254
|
-
private serializeTransaction;
|
|
255
|
-
/**
|
|
256
|
-
* Add a signed transaction to the blockchain
|
|
257
|
-
*/
|
|
258
|
-
private addTx;
|
|
259
|
-
/**
|
|
260
|
-
* Send a transaction (create, sign, and submit)
|
|
261
|
-
*/
|
|
262
|
-
sendTransaction(params: SendTransactionRequest): Promise<AddTxResponse>;
|
|
263
|
-
sendTransactionByAddress(params: SendTransactionRequest): Promise<AddTxResponse>;
|
|
264
|
-
sendTransactionByPrivateKey(params: SendTransactionBase): Promise<AddTxResponse>;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
209
|
+
declare class MmnClient {
|
|
210
|
+
private config;
|
|
211
|
+
private requestId;
|
|
212
|
+
constructor(config: MmnClientConfig);
|
|
213
|
+
private makeRequest;
|
|
214
|
+
/**
|
|
215
|
+
* Securely convert raw Ed25519 private key to PKCS#8 format
|
|
216
|
+
* @param raw - Raw 32-byte Ed25519 private key
|
|
217
|
+
* @returns PKCS#8 formatted private key in hex
|
|
218
|
+
* @throws Error if input validation fails
|
|
219
|
+
*/
|
|
220
|
+
private rawEd25519ToPkcs8Hex;
|
|
221
|
+
/**
|
|
222
|
+
* Encode length in ASN.1 DER format
|
|
223
|
+
* ASN.1 length encoding rules:
|
|
224
|
+
* - Short form (0-127): single byte with the length value
|
|
225
|
+
* - Long form (128+): first byte is 0x80 + number of length bytes, followed by length bytes
|
|
226
|
+
* @param length - The length value to encode
|
|
227
|
+
* @returns ASN.1 DER encoded length bytes
|
|
228
|
+
*/
|
|
229
|
+
private encodeLength;
|
|
230
|
+
/**
|
|
231
|
+
* Generate secure entropy using multiple sources for maximum compatibility
|
|
232
|
+
* @returns Array of 32 random bytes
|
|
233
|
+
*/
|
|
234
|
+
private generateSecureEntropy;
|
|
235
|
+
/**
|
|
236
|
+
* Securely generate ephemeral key pair with proper entropy
|
|
237
|
+
* React Native compatible version with multiple fallbacks
|
|
238
|
+
* @returns Ephemeral key pair with private and public keys
|
|
239
|
+
* @throws Error if key generation fails
|
|
240
|
+
*/
|
|
241
|
+
generateEphemeralKeyPair(): IEphemeralKeyPair;
|
|
242
|
+
getAddressFromUserId(userId: string): string;
|
|
243
|
+
/**
|
|
244
|
+
* Create and sign a transaction message
|
|
245
|
+
*/
|
|
246
|
+
private createAndSignTx;
|
|
247
|
+
/**
|
|
248
|
+
* Securely sign a transaction with Ed25519
|
|
249
|
+
* @param tx - Transaction message to sign
|
|
250
|
+
* @param privateKeyHex - Private key in PKCS#8 hex format
|
|
251
|
+
* @returns Base58 encoded signature
|
|
252
|
+
* @throws Error if signing fails
|
|
253
|
+
*/
|
|
254
|
+
private signTransaction;
|
|
255
|
+
/**
|
|
256
|
+
* Serialize transaction for signing
|
|
257
|
+
*/
|
|
258
|
+
private serializeTransaction;
|
|
259
|
+
/**
|
|
260
|
+
* Add a signed transaction to the blockchain
|
|
261
|
+
*/
|
|
262
|
+
private addTx;
|
|
263
|
+
/**
|
|
264
|
+
* Send a transaction (create, sign, and submit)
|
|
265
|
+
*/
|
|
266
|
+
sendTransaction(params: SendTransactionRequest): Promise<AddTxResponse>;
|
|
267
|
+
sendTransactionByAddress(params: SendTransactionRequest): Promise<AddTxResponse>;
|
|
268
|
+
sendTransactionByPrivateKey(params: SendTransactionBase): Promise<AddTxResponse>;
|
|
269
|
+
postDonationCampaignFeed(params: SendTransactionRequest): Promise<AddTxResponse>;
|
|
270
|
+
/**
|
|
271
|
+
* Get current nonce for an account
|
|
272
|
+
*/
|
|
273
|
+
getCurrentNonce(userId: string, tag?: 'latest' | 'pending'): Promise<GetCurrentNonceResponse>;
|
|
274
|
+
getCurrentNonceByAddress(address: string, tag?: 'latest' | 'pending'): Promise<GetCurrentNonceResponse>;
|
|
275
|
+
getAccountByUserId(userId: string): Promise<GetAccountByAddressResponse>;
|
|
276
|
+
scaleAmountToDecimals(originalAmount: string | number, decimals?: number): string;
|
|
277
|
+
validateAddress(addr: string): boolean;
|
|
278
|
+
validateAmount(balance: string, amount: string | number): boolean;
|
|
279
|
+
}
|
|
274
280
|
declare function createMmnClient(config: MmnClientConfig): MmnClient;
|
|
275
281
|
|
|
276
|
-
declare class ZkClient {
|
|
277
|
-
private endpoint;
|
|
278
|
-
private timeout;
|
|
279
|
-
private headers;
|
|
280
|
-
constructor(config: ZkClientConfig);
|
|
281
|
-
private makeRequest;
|
|
282
|
-
getZkProofs({ userId, ephemeralPublicKey, jwt, address, clientType, }: GetZkProofRequest): Promise<IZkProof>;
|
|
282
|
+
declare class ZkClient {
|
|
283
|
+
private endpoint;
|
|
284
|
+
private timeout;
|
|
285
|
+
private headers;
|
|
286
|
+
constructor(config: ZkClientConfig);
|
|
287
|
+
private makeRequest;
|
|
288
|
+
getZkProofs({ userId, ephemeralPublicKey, jwt, address, clientType, }: GetZkProofRequest): Promise<IZkProof>;
|
|
283
289
|
}
|
|
284
290
|
|
|
285
|
-
export {
|
|
291
|
+
export { ETransferType, EZkClientType, IndexerClient, MmnClient, ZkClient, createMmnClient };
|
|
292
|
+
export type { AddTxResponse, ExtraInfo, GetAccountByAddressResponse, GetCurrentNonceResponse, GetZkProofRequest, IEphemeralKeyPair, IZkProof, IndexerClientConfig, JsonRpcError, JsonRpcRequest, JsonRpcResponse, ListTransactionResponse, Meta, MmnClientConfig, SendTransactionBase, SendTransactionRequest, SignedTx, Transaction, TransactionDetailResponse, TxMsg, WalletDetail, WalletDetailResponse, ZkClientConfig };
|