@alephium/web3 0.5.0-rc.10 → 0.5.0-rc.12
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/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/api/api-alephium.d.ts +56 -6
- package/dist/src/api/api-alephium.js +5 -3
- package/dist/src/api/api-explorer.d.ts +155 -6
- package/dist/src/api/api-explorer.js +5 -3
- package/dist/src/signer/signer.d.ts +2 -8
- package/dist/src/signer/tx-builder.js +3 -3
- package/dist/src/signer/types.d.ts +0 -15
- package/dist/src/transaction/sign-verify.d.ts +2 -2
- package/dist/src/utils/sign.d.ts +2 -2
- package/dist/src/utils/utils.d.ts +3 -3
- package/package.json +4 -4
- package/src/api/api-alephium.ts +177 -180
- package/src/api/api-explorer.ts +249 -76
- package/src/signer/signer.ts +1 -18
- package/src/signer/tx-builder.ts +4 -4
- package/src/signer/types.ts +0 -7
- package/src/transaction/sign-verify.ts +2 -2
- package/src/utils/sign.ts +2 -2
- package/src/utils/utils.ts +3 -3
package/src/api/api-explorer.ts
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
export interface AddressBalance {
|
|
13
13
|
/** @format uint256 */
|
|
14
14
|
balance: string
|
|
15
|
-
|
|
16
15
|
/** @format uint256 */
|
|
17
16
|
lockedBalance: string
|
|
18
17
|
}
|
|
@@ -20,10 +19,8 @@ export interface AddressBalance {
|
|
|
20
19
|
export interface AddressInfo {
|
|
21
20
|
/** @format uint256 */
|
|
22
21
|
balance: string
|
|
23
|
-
|
|
24
22
|
/** @format uint256 */
|
|
25
23
|
lockedBalance: string
|
|
26
|
-
|
|
27
24
|
/** @format int32 */
|
|
28
25
|
txNumber: number
|
|
29
26
|
}
|
|
@@ -31,21 +28,16 @@ export interface AddressInfo {
|
|
|
31
28
|
export interface AssetOutput {
|
|
32
29
|
/** @format int32 */
|
|
33
30
|
hint: number
|
|
34
|
-
|
|
35
31
|
/** @format 32-byte-hash */
|
|
36
32
|
key: string
|
|
37
|
-
|
|
38
33
|
/** @format uint256 */
|
|
39
34
|
attoAlphAmount: string
|
|
40
35
|
address: string
|
|
41
36
|
tokens?: Token[]
|
|
42
|
-
|
|
43
37
|
/** @format int64 */
|
|
44
38
|
lockTime?: number
|
|
45
|
-
|
|
46
39
|
/** @format hex-string */
|
|
47
40
|
message?: string
|
|
48
|
-
|
|
49
41
|
/** @format 32-byte-hash */
|
|
50
42
|
spent?: string
|
|
51
43
|
type: string
|
|
@@ -58,23 +50,17 @@ export interface BadRequest {
|
|
|
58
50
|
export interface BlockEntryLite {
|
|
59
51
|
/** @format block-hash */
|
|
60
52
|
hash: string
|
|
61
|
-
|
|
62
53
|
/** @format int64 */
|
|
63
54
|
timestamp: number
|
|
64
|
-
|
|
65
55
|
/** @format int32 */
|
|
66
56
|
chainFrom: number
|
|
67
|
-
|
|
68
57
|
/** @format int32 */
|
|
69
58
|
chainTo: number
|
|
70
|
-
|
|
71
59
|
/** @format int32 */
|
|
72
60
|
height: number
|
|
73
|
-
|
|
74
61
|
/** @format int32 */
|
|
75
62
|
txNumber: number
|
|
76
63
|
mainChain: boolean
|
|
77
|
-
|
|
78
64
|
/** @format bigint */
|
|
79
65
|
hashRate: string
|
|
80
66
|
}
|
|
@@ -82,18 +68,14 @@ export interface BlockEntryLite {
|
|
|
82
68
|
export interface ConfirmedTransaction {
|
|
83
69
|
/** @format 32-byte-hash */
|
|
84
70
|
hash: string
|
|
85
|
-
|
|
86
71
|
/** @format block-hash */
|
|
87
72
|
blockHash: string
|
|
88
|
-
|
|
89
73
|
/** @format int64 */
|
|
90
74
|
timestamp: number
|
|
91
75
|
inputs?: Input[]
|
|
92
76
|
outputs?: Output[]
|
|
93
|
-
|
|
94
77
|
/** @format int32 */
|
|
95
78
|
gasAmount: number
|
|
96
|
-
|
|
97
79
|
/** @format uint256 */
|
|
98
80
|
gasPrice: string
|
|
99
81
|
coinbase: boolean
|
|
@@ -103,15 +85,12 @@ export interface ConfirmedTransaction {
|
|
|
103
85
|
export interface ContractOutput {
|
|
104
86
|
/** @format int32 */
|
|
105
87
|
hint: number
|
|
106
|
-
|
|
107
88
|
/** @format 32-byte-hash */
|
|
108
89
|
key: string
|
|
109
|
-
|
|
110
90
|
/** @format uint256 */
|
|
111
91
|
attoAlphAmount: string
|
|
112
92
|
address: string
|
|
113
93
|
tokens?: Token[]
|
|
114
|
-
|
|
115
94
|
/** @format 32-byte-hash */
|
|
116
95
|
spent?: string
|
|
117
96
|
type: string
|
|
@@ -120,12 +99,10 @@ export interface ContractOutput {
|
|
|
120
99
|
export interface Event {
|
|
121
100
|
/** @format block-hash */
|
|
122
101
|
blockHash: string
|
|
123
|
-
|
|
124
102
|
/** @format 32-byte-hash */
|
|
125
103
|
txHash: string
|
|
126
104
|
contractAddress: string
|
|
127
105
|
inputAddress?: string
|
|
128
|
-
|
|
129
106
|
/** @format int32 */
|
|
130
107
|
eventIndex: number
|
|
131
108
|
fields?: Val[]
|
|
@@ -145,14 +122,11 @@ export interface Hashrate {
|
|
|
145
122
|
|
|
146
123
|
export interface Input {
|
|
147
124
|
outputRef: OutputRef
|
|
148
|
-
|
|
149
125
|
/** @format hex-string */
|
|
150
126
|
unlockScript?: string
|
|
151
|
-
|
|
152
127
|
/** @format 32-byte-hash */
|
|
153
128
|
txHashRef?: string
|
|
154
129
|
address?: string
|
|
155
|
-
|
|
156
130
|
/** @format uint256 */
|
|
157
131
|
attoAlphAmount?: string
|
|
158
132
|
tokens?: Token[]
|
|
@@ -188,7 +162,6 @@ export type Output = AssetOutput | ContractOutput
|
|
|
188
162
|
export interface OutputRef {
|
|
189
163
|
/** @format int32 */
|
|
190
164
|
hint: number
|
|
191
|
-
|
|
192
165
|
/** @format 32-byte-hash */
|
|
193
166
|
key: string
|
|
194
167
|
}
|
|
@@ -196,10 +169,8 @@ export interface OutputRef {
|
|
|
196
169
|
export interface PerChainCount {
|
|
197
170
|
/** @format int32 */
|
|
198
171
|
chainFrom: number
|
|
199
|
-
|
|
200
172
|
/** @format int32 */
|
|
201
173
|
chainTo: number
|
|
202
|
-
|
|
203
174
|
/** @format int64 */
|
|
204
175
|
count: number
|
|
205
176
|
}
|
|
@@ -207,13 +178,10 @@ export interface PerChainCount {
|
|
|
207
178
|
export interface PerChainDuration {
|
|
208
179
|
/** @format int32 */
|
|
209
180
|
chainFrom: number
|
|
210
|
-
|
|
211
181
|
/** @format int32 */
|
|
212
182
|
chainTo: number
|
|
213
|
-
|
|
214
183
|
/** @format int64 */
|
|
215
184
|
duration: number
|
|
216
|
-
|
|
217
185
|
/** @format int64 */
|
|
218
186
|
value: number
|
|
219
187
|
}
|
|
@@ -221,13 +189,10 @@ export interface PerChainDuration {
|
|
|
221
189
|
export interface PerChainHeight {
|
|
222
190
|
/** @format int32 */
|
|
223
191
|
chainFrom: number
|
|
224
|
-
|
|
225
192
|
/** @format int32 */
|
|
226
193
|
chainTo: number
|
|
227
|
-
|
|
228
194
|
/** @format int64 */
|
|
229
195
|
height: number
|
|
230
|
-
|
|
231
196
|
/** @format int64 */
|
|
232
197
|
value: number
|
|
233
198
|
}
|
|
@@ -245,7 +210,6 @@ export interface ServiceUnavailable {
|
|
|
245
210
|
export interface TimedCount {
|
|
246
211
|
/** @format int64 */
|
|
247
212
|
timestamp: number
|
|
248
|
-
|
|
249
213
|
/** @format int64 */
|
|
250
214
|
totalCountAllChains: number
|
|
251
215
|
}
|
|
@@ -253,7 +217,6 @@ export interface TimedCount {
|
|
|
253
217
|
export interface Token {
|
|
254
218
|
/** @format 32-byte-hash */
|
|
255
219
|
id: string
|
|
256
|
-
|
|
257
220
|
/** @format uint256 */
|
|
258
221
|
amount: string
|
|
259
222
|
}
|
|
@@ -261,19 +224,14 @@ export interface Token {
|
|
|
261
224
|
export interface TokenSupply {
|
|
262
225
|
/** @format int64 */
|
|
263
226
|
timestamp: number
|
|
264
|
-
|
|
265
227
|
/** @format uint256 */
|
|
266
228
|
total: string
|
|
267
|
-
|
|
268
229
|
/** @format uint256 */
|
|
269
230
|
circulating: string
|
|
270
|
-
|
|
271
231
|
/** @format uint256 */
|
|
272
232
|
reserved: string
|
|
273
|
-
|
|
274
233
|
/** @format uint256 */
|
|
275
234
|
locked: string
|
|
276
|
-
|
|
277
235
|
/** @format uint256 */
|
|
278
236
|
maximum: string
|
|
279
237
|
}
|
|
@@ -281,18 +239,14 @@ export interface TokenSupply {
|
|
|
281
239
|
export interface Transaction {
|
|
282
240
|
/** @format 32-byte-hash */
|
|
283
241
|
hash: string
|
|
284
|
-
|
|
285
242
|
/** @format block-hash */
|
|
286
243
|
blockHash: string
|
|
287
|
-
|
|
288
244
|
/** @format int64 */
|
|
289
245
|
timestamp: number
|
|
290
246
|
inputs?: Input[]
|
|
291
247
|
outputs?: Output[]
|
|
292
|
-
|
|
293
248
|
/** @format int32 */
|
|
294
249
|
gasAmount: number
|
|
295
|
-
|
|
296
250
|
/** @format uint256 */
|
|
297
251
|
gasPrice: string
|
|
298
252
|
coinbase: boolean
|
|
@@ -307,21 +261,16 @@ export interface Unauthorized {
|
|
|
307
261
|
export interface UnconfirmedTransaction {
|
|
308
262
|
/** @format 32-byte-hash */
|
|
309
263
|
hash: string
|
|
310
|
-
|
|
311
264
|
/** @format int32 */
|
|
312
265
|
chainFrom: number
|
|
313
|
-
|
|
314
266
|
/** @format int32 */
|
|
315
267
|
chainTo: number
|
|
316
268
|
inputs?: Input[]
|
|
317
269
|
outputs?: Output[]
|
|
318
|
-
|
|
319
270
|
/** @format int32 */
|
|
320
271
|
gasAmount: number
|
|
321
|
-
|
|
322
272
|
/** @format uint256 */
|
|
323
273
|
gasPrice: string
|
|
324
|
-
|
|
325
274
|
/** @format int64 */
|
|
326
275
|
lastSeen: number
|
|
327
276
|
type: string
|
|
@@ -407,7 +356,8 @@ type CancelToken = Symbol | string | number
|
|
|
407
356
|
export enum ContentType {
|
|
408
357
|
Json = 'application/json',
|
|
409
358
|
FormData = 'multipart/form-data',
|
|
410
|
-
UrlEncoded = 'application/x-www-form-urlencoded'
|
|
359
|
+
UrlEncoded = 'application/x-www-form-urlencoded',
|
|
360
|
+
Text = 'text/plain'
|
|
411
361
|
}
|
|
412
362
|
|
|
413
363
|
export class HttpClient<SecurityDataType = unknown> {
|
|
@@ -432,16 +382,16 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
432
382
|
this.securityData = data
|
|
433
383
|
}
|
|
434
384
|
|
|
435
|
-
|
|
385
|
+
protected encodeQueryParam(key: string, value: any) {
|
|
436
386
|
const encodedKey = encodeURIComponent(key)
|
|
437
387
|
return `${encodedKey}=${encodeURIComponent(typeof value === 'number' ? value : `${value}`)}`
|
|
438
388
|
}
|
|
439
389
|
|
|
440
|
-
|
|
390
|
+
protected addQueryParam(query: QueryParamsType, key: string) {
|
|
441
391
|
return this.encodeQueryParam(key, query[key])
|
|
442
392
|
}
|
|
443
393
|
|
|
444
|
-
|
|
394
|
+
protected addArrayQueryParam(query: QueryParamsType, key: string) {
|
|
445
395
|
const value = query[key]
|
|
446
396
|
return value.map((v: any) => this.encodeQueryParam(key, v)).join('&')
|
|
447
397
|
}
|
|
@@ -462,6 +412,7 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
462
412
|
private contentFormatters: Record<ContentType, (input: any) => any> = {
|
|
463
413
|
[ContentType.Json]: (input: any) =>
|
|
464
414
|
input !== null && (typeof input === 'object' || typeof input === 'string') ? JSON.stringify(input) : input,
|
|
415
|
+
[ContentType.Text]: (input: any) => (input !== null && typeof input !== 'string' ? JSON.stringify(input) : input),
|
|
465
416
|
[ContentType.FormData]: (input: any) =>
|
|
466
417
|
Object.keys(input || {}).reduce((formData, key) => {
|
|
467
418
|
const property = input[key]
|
|
@@ -478,7 +429,7 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
478
429
|
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input)
|
|
479
430
|
}
|
|
480
431
|
|
|
481
|
-
|
|
432
|
+
protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
|
|
482
433
|
return {
|
|
483
434
|
...this.baseApiParams,
|
|
484
435
|
...params1,
|
|
@@ -491,7 +442,7 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
491
442
|
}
|
|
492
443
|
}
|
|
493
444
|
|
|
494
|
-
|
|
445
|
+
protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
|
|
495
446
|
if (this.abortControllers.has(cancelToken)) {
|
|
496
447
|
const abortController = this.abortControllers.get(cancelToken)
|
|
497
448
|
if (abortController) {
|
|
@@ -538,10 +489,10 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
538
489
|
return this.customFetch(`${baseUrl || this.baseUrl || ''}${path}${queryString ? `?${queryString}` : ''}`, {
|
|
539
490
|
...requestParams,
|
|
540
491
|
headers: {
|
|
541
|
-
...(
|
|
542
|
-
...(
|
|
492
|
+
...(requestParams.headers || {}),
|
|
493
|
+
...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {})
|
|
543
494
|
},
|
|
544
|
-
signal: cancelToken ? this.createAbortSignal(cancelToken) :
|
|
495
|
+
signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal,
|
|
545
496
|
body: typeof body === 'undefined' || body === null ? null : payloadFormatter(body)
|
|
546
497
|
}).then(async (response) => {
|
|
547
498
|
const r = response as HttpResponse<T, E>
|
|
@@ -586,7 +537,23 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
586
537
|
* @name GetBlocks
|
|
587
538
|
* @request GET:/blocks
|
|
588
539
|
*/
|
|
589
|
-
getBlocks: (
|
|
540
|
+
getBlocks: (
|
|
541
|
+
query?: {
|
|
542
|
+
/**
|
|
543
|
+
* Page number
|
|
544
|
+
* @format int32
|
|
545
|
+
*/
|
|
546
|
+
page?: number
|
|
547
|
+
/**
|
|
548
|
+
* Number of items per page
|
|
549
|
+
* @format int32
|
|
550
|
+
*/
|
|
551
|
+
limit?: number
|
|
552
|
+
/** Reverse pagination */
|
|
553
|
+
reverse?: boolean
|
|
554
|
+
},
|
|
555
|
+
params: RequestParams = {}
|
|
556
|
+
) =>
|
|
590
557
|
this.request<ListBlocks, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
591
558
|
path: `/blocks`,
|
|
592
559
|
method: 'GET',
|
|
@@ -619,7 +586,20 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
619
586
|
*/
|
|
620
587
|
getBlocksBlockHashTransactions: (
|
|
621
588
|
blockHash: string,
|
|
622
|
-
query?: {
|
|
589
|
+
query?: {
|
|
590
|
+
/**
|
|
591
|
+
* Page number
|
|
592
|
+
* @format int32
|
|
593
|
+
*/
|
|
594
|
+
page?: number
|
|
595
|
+
/**
|
|
596
|
+
* Number of items per page
|
|
597
|
+
* @format int32
|
|
598
|
+
*/
|
|
599
|
+
limit?: number
|
|
600
|
+
/** Reverse pagination */
|
|
601
|
+
reverse?: boolean
|
|
602
|
+
},
|
|
623
603
|
params: RequestParams = {}
|
|
624
604
|
) =>
|
|
625
605
|
this.request<Transaction[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
@@ -671,7 +651,20 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
671
651
|
*/
|
|
672
652
|
getAddressesAddressTransactions: (
|
|
673
653
|
address: string,
|
|
674
|
-
query?: {
|
|
654
|
+
query?: {
|
|
655
|
+
/**
|
|
656
|
+
* Page number
|
|
657
|
+
* @format int32
|
|
658
|
+
*/
|
|
659
|
+
page?: number
|
|
660
|
+
/**
|
|
661
|
+
* Number of items per page
|
|
662
|
+
* @format int32
|
|
663
|
+
*/
|
|
664
|
+
limit?: number
|
|
665
|
+
/** Reverse pagination */
|
|
666
|
+
reverse?: boolean
|
|
667
|
+
},
|
|
675
668
|
params: RequestParams = {}
|
|
676
669
|
) =>
|
|
677
670
|
this.request<Transaction[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
@@ -690,7 +683,20 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
690
683
|
* @request POST:/addresses/transactions
|
|
691
684
|
*/
|
|
692
685
|
postAddressesTransactions: (
|
|
693
|
-
query?: {
|
|
686
|
+
query?: {
|
|
687
|
+
/**
|
|
688
|
+
* Page number
|
|
689
|
+
* @format int32
|
|
690
|
+
*/
|
|
691
|
+
page?: number
|
|
692
|
+
/**
|
|
693
|
+
* Number of items per page
|
|
694
|
+
* @format int32
|
|
695
|
+
*/
|
|
696
|
+
limit?: number
|
|
697
|
+
/** Reverse pagination */
|
|
698
|
+
reverse?: boolean
|
|
699
|
+
},
|
|
694
700
|
data?: string[],
|
|
695
701
|
params: RequestParams = {}
|
|
696
702
|
) =>
|
|
@@ -713,7 +719,30 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
713
719
|
*/
|
|
714
720
|
getAddressesAddressTimerangedTransactions: (
|
|
715
721
|
address: string,
|
|
716
|
-
query: {
|
|
722
|
+
query: {
|
|
723
|
+
/**
|
|
724
|
+
* @format int64
|
|
725
|
+
* @min 0
|
|
726
|
+
*/
|
|
727
|
+
fromTs: number
|
|
728
|
+
/**
|
|
729
|
+
* @format int64
|
|
730
|
+
* @min 0
|
|
731
|
+
*/
|
|
732
|
+
toTs: number
|
|
733
|
+
/**
|
|
734
|
+
* Page number
|
|
735
|
+
* @format int32
|
|
736
|
+
*/
|
|
737
|
+
page?: number
|
|
738
|
+
/**
|
|
739
|
+
* Number of items per page
|
|
740
|
+
* @format int32
|
|
741
|
+
*/
|
|
742
|
+
limit?: number
|
|
743
|
+
/** Reverse pagination */
|
|
744
|
+
reverse?: boolean
|
|
745
|
+
},
|
|
717
746
|
params: RequestParams = {}
|
|
718
747
|
) =>
|
|
719
748
|
this.request<Transaction[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
@@ -794,7 +823,20 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
794
823
|
getAddressesAddressTokensTokenIdTransactions: (
|
|
795
824
|
address: string,
|
|
796
825
|
tokenId: string,
|
|
797
|
-
query?: {
|
|
826
|
+
query?: {
|
|
827
|
+
/**
|
|
828
|
+
* Page number
|
|
829
|
+
* @format int32
|
|
830
|
+
*/
|
|
831
|
+
page?: number
|
|
832
|
+
/**
|
|
833
|
+
* Number of items per page
|
|
834
|
+
* @format int32
|
|
835
|
+
*/
|
|
836
|
+
limit?: number
|
|
837
|
+
/** Reverse pagination */
|
|
838
|
+
reverse?: boolean
|
|
839
|
+
},
|
|
798
840
|
params: RequestParams = {}
|
|
799
841
|
) =>
|
|
800
842
|
this.request<Transaction[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
@@ -846,7 +888,18 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
846
888
|
*/
|
|
847
889
|
getAddressesAddressExportTransactionsCsv: (
|
|
848
890
|
address: string,
|
|
849
|
-
query: {
|
|
891
|
+
query: {
|
|
892
|
+
/**
|
|
893
|
+
* @format int64
|
|
894
|
+
* @min 0
|
|
895
|
+
*/
|
|
896
|
+
fromTs: number
|
|
897
|
+
/**
|
|
898
|
+
* @format int64
|
|
899
|
+
* @min 0
|
|
900
|
+
*/
|
|
901
|
+
toTs: number
|
|
902
|
+
},
|
|
850
903
|
params: RequestParams = {}
|
|
851
904
|
) =>
|
|
852
905
|
this.request<string, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
@@ -894,7 +947,23 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
894
947
|
* @name GetInfosSupply
|
|
895
948
|
* @request GET:/infos/supply
|
|
896
949
|
*/
|
|
897
|
-
getInfosSupply: (
|
|
950
|
+
getInfosSupply: (
|
|
951
|
+
query?: {
|
|
952
|
+
/**
|
|
953
|
+
* Page number
|
|
954
|
+
* @format int32
|
|
955
|
+
*/
|
|
956
|
+
page?: number
|
|
957
|
+
/**
|
|
958
|
+
* Number of items per page
|
|
959
|
+
* @format int32
|
|
960
|
+
*/
|
|
961
|
+
limit?: number
|
|
962
|
+
/** Reverse pagination */
|
|
963
|
+
reverse?: boolean
|
|
964
|
+
},
|
|
965
|
+
params: RequestParams = {}
|
|
966
|
+
) =>
|
|
898
967
|
this.request<TokenSupply[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
899
968
|
path: `/infos/supply`,
|
|
900
969
|
method: 'GET',
|
|
@@ -999,7 +1068,20 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
999
1068
|
* @request GET:/unconfirmed-transactions
|
|
1000
1069
|
*/
|
|
1001
1070
|
getUnconfirmedTransactions: (
|
|
1002
|
-
query?: {
|
|
1071
|
+
query?: {
|
|
1072
|
+
/**
|
|
1073
|
+
* Page number
|
|
1074
|
+
* @format int32
|
|
1075
|
+
*/
|
|
1076
|
+
page?: number
|
|
1077
|
+
/**
|
|
1078
|
+
* Number of items per page
|
|
1079
|
+
* @format int32
|
|
1080
|
+
*/
|
|
1081
|
+
limit?: number
|
|
1082
|
+
/** Reverse pagination */
|
|
1083
|
+
reverse?: boolean
|
|
1084
|
+
},
|
|
1003
1085
|
params: RequestParams = {}
|
|
1004
1086
|
) =>
|
|
1005
1087
|
this.request<TransactionLike[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
@@ -1018,7 +1100,23 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1018
1100
|
* @name GetTokens
|
|
1019
1101
|
* @request GET:/tokens
|
|
1020
1102
|
*/
|
|
1021
|
-
getTokens: (
|
|
1103
|
+
getTokens: (
|
|
1104
|
+
query?: {
|
|
1105
|
+
/**
|
|
1106
|
+
* Page number
|
|
1107
|
+
* @format int32
|
|
1108
|
+
*/
|
|
1109
|
+
page?: number
|
|
1110
|
+
/**
|
|
1111
|
+
* Number of items per page
|
|
1112
|
+
* @format int32
|
|
1113
|
+
*/
|
|
1114
|
+
limit?: number
|
|
1115
|
+
/** Reverse pagination */
|
|
1116
|
+
reverse?: boolean
|
|
1117
|
+
},
|
|
1118
|
+
params: RequestParams = {}
|
|
1119
|
+
) =>
|
|
1022
1120
|
this.request<string[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
1023
1121
|
path: `/tokens`,
|
|
1024
1122
|
method: 'GET',
|
|
@@ -1036,7 +1134,20 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1036
1134
|
*/
|
|
1037
1135
|
getTokensTokenIdTransactions: (
|
|
1038
1136
|
tokenId: string,
|
|
1039
|
-
query?: {
|
|
1137
|
+
query?: {
|
|
1138
|
+
/**
|
|
1139
|
+
* Page number
|
|
1140
|
+
* @format int32
|
|
1141
|
+
*/
|
|
1142
|
+
page?: number
|
|
1143
|
+
/**
|
|
1144
|
+
* Number of items per page
|
|
1145
|
+
* @format int32
|
|
1146
|
+
*/
|
|
1147
|
+
limit?: number
|
|
1148
|
+
/** Reverse pagination */
|
|
1149
|
+
reverse?: boolean
|
|
1150
|
+
},
|
|
1040
1151
|
params: RequestParams = {}
|
|
1041
1152
|
) =>
|
|
1042
1153
|
this.request<Transaction[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
@@ -1057,7 +1168,19 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1057
1168
|
* @request GET:/charts/hashrates
|
|
1058
1169
|
*/
|
|
1059
1170
|
getChartsHashrates: (
|
|
1060
|
-
query: {
|
|
1171
|
+
query: {
|
|
1172
|
+
/**
|
|
1173
|
+
* @format int64
|
|
1174
|
+
* @min 0
|
|
1175
|
+
*/
|
|
1176
|
+
fromTs: number
|
|
1177
|
+
/**
|
|
1178
|
+
* @format int64
|
|
1179
|
+
* @min 0
|
|
1180
|
+
*/
|
|
1181
|
+
toTs: number
|
|
1182
|
+
'interval-type': IntervalType
|
|
1183
|
+
},
|
|
1061
1184
|
params: RequestParams = {}
|
|
1062
1185
|
) =>
|
|
1063
1186
|
this.request<Hashrate[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
@@ -1077,7 +1200,19 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1077
1200
|
* @request GET:/charts/transactions-count
|
|
1078
1201
|
*/
|
|
1079
1202
|
getChartsTransactionsCount: (
|
|
1080
|
-
query: {
|
|
1203
|
+
query: {
|
|
1204
|
+
/**
|
|
1205
|
+
* @format int64
|
|
1206
|
+
* @min 0
|
|
1207
|
+
*/
|
|
1208
|
+
fromTs: number
|
|
1209
|
+
/**
|
|
1210
|
+
* @format int64
|
|
1211
|
+
* @min 0
|
|
1212
|
+
*/
|
|
1213
|
+
toTs: number
|
|
1214
|
+
'interval-type': IntervalType
|
|
1215
|
+
},
|
|
1081
1216
|
params: RequestParams = {}
|
|
1082
1217
|
) =>
|
|
1083
1218
|
this.request<TimedCount[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
@@ -1097,7 +1232,19 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1097
1232
|
* @request GET:/charts/transactions-count-per-chain
|
|
1098
1233
|
*/
|
|
1099
1234
|
getChartsTransactionsCountPerChain: (
|
|
1100
|
-
query: {
|
|
1235
|
+
query: {
|
|
1236
|
+
/**
|
|
1237
|
+
* @format int64
|
|
1238
|
+
* @min 0
|
|
1239
|
+
*/
|
|
1240
|
+
fromTs: number
|
|
1241
|
+
/**
|
|
1242
|
+
* @format int64
|
|
1243
|
+
* @min 0
|
|
1244
|
+
*/
|
|
1245
|
+
toTs: number
|
|
1246
|
+
'interval-type': IntervalType
|
|
1247
|
+
},
|
|
1101
1248
|
params: RequestParams = {}
|
|
1102
1249
|
) =>
|
|
1103
1250
|
this.request<
|
|
@@ -1136,7 +1283,20 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1136
1283
|
*/
|
|
1137
1284
|
getContractEventsContractAddressContractAddress: (
|
|
1138
1285
|
contractAddress: string,
|
|
1139
|
-
query?: {
|
|
1286
|
+
query?: {
|
|
1287
|
+
/**
|
|
1288
|
+
* Page number
|
|
1289
|
+
* @format int32
|
|
1290
|
+
*/
|
|
1291
|
+
page?: number
|
|
1292
|
+
/**
|
|
1293
|
+
* Number of items per page
|
|
1294
|
+
* @format int32
|
|
1295
|
+
*/
|
|
1296
|
+
limit?: number
|
|
1297
|
+
/** Reverse pagination */
|
|
1298
|
+
reverse?: boolean
|
|
1299
|
+
},
|
|
1140
1300
|
params: RequestParams = {}
|
|
1141
1301
|
) =>
|
|
1142
1302
|
this.request<Event[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
@@ -1157,7 +1317,20 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1157
1317
|
getContractEventsContractAddressContractAddressInputAddressInputAddress: (
|
|
1158
1318
|
contractAddress: string,
|
|
1159
1319
|
inputAddress: string,
|
|
1160
|
-
query?: {
|
|
1320
|
+
query?: {
|
|
1321
|
+
/**
|
|
1322
|
+
* Page number
|
|
1323
|
+
* @format int32
|
|
1324
|
+
*/
|
|
1325
|
+
page?: number
|
|
1326
|
+
/**
|
|
1327
|
+
* Number of items per page
|
|
1328
|
+
* @format int32
|
|
1329
|
+
*/
|
|
1330
|
+
limit?: number
|
|
1331
|
+
/** Reverse pagination */
|
|
1332
|
+
reverse?: boolean
|
|
1333
|
+
},
|
|
1161
1334
|
params: RequestParams = {}
|
|
1162
1335
|
) =>
|
|
1163
1336
|
this.request<Event[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
package/src/signer/signer.ts
CHANGED
|
@@ -38,11 +38,6 @@ import {
|
|
|
38
38
|
SignUnsignedTxResult,
|
|
39
39
|
SubmissionResult,
|
|
40
40
|
SubmitTransactionParams,
|
|
41
|
-
ExtSignTransferTxParams,
|
|
42
|
-
ExtSignDeployContractTxParams,
|
|
43
|
-
ExtSignExecuteScriptTxParams,
|
|
44
|
-
ExtSignUnsignedTxParams,
|
|
45
|
-
ExtSignMessageParams,
|
|
46
41
|
KeyType
|
|
47
42
|
} from './types'
|
|
48
43
|
import { TransactionBuilder } from './tx-builder'
|
|
@@ -90,18 +85,6 @@ export abstract class InteractiveSignerProvider<
|
|
|
90
85
|
}
|
|
91
86
|
|
|
92
87
|
abstract disconnect(): Promise<void>
|
|
93
|
-
|
|
94
|
-
// Methods inherited from SignerProvider, but require networkId in the params
|
|
95
|
-
abstract override signAndSubmitTransferTx(params: ExtSignTransferTxParams): Promise<SignTransferTxResult>
|
|
96
|
-
abstract override signAndSubmitDeployContractTx(
|
|
97
|
-
params: ExtSignDeployContractTxParams
|
|
98
|
-
): Promise<SignDeployContractTxResult>
|
|
99
|
-
abstract override signAndSubmitExecuteScriptTx(
|
|
100
|
-
params: ExtSignExecuteScriptTxParams
|
|
101
|
-
): Promise<SignExecuteScriptTxResult>
|
|
102
|
-
abstract override signAndSubmitUnsignedTx(params: ExtSignUnsignedTxParams): Promise<SignUnsignedTxResult>
|
|
103
|
-
abstract override signUnsignedTx(params: ExtSignUnsignedTxParams): Promise<SignUnsignedTxResult>
|
|
104
|
-
abstract override signMessage(params: ExtSignMessageParams): Promise<SignMessageResult>
|
|
105
88
|
}
|
|
106
89
|
|
|
107
90
|
export abstract class SignerProviderSimple extends SignerProvider {
|
|
@@ -263,7 +246,7 @@ function extendMessage(message: string): string {
|
|
|
263
246
|
return 'Alephium Signed Message: ' + message
|
|
264
247
|
}
|
|
265
248
|
|
|
266
|
-
export function verifySignedMessage(message: string, publicKey: string, signature: string, keyType
|
|
249
|
+
export function verifySignedMessage(message: string, publicKey: string, signature: string, keyType?: KeyType): boolean {
|
|
267
250
|
const extendedMessage = extendMessage(message)
|
|
268
251
|
const messageHash = blake.blake2b(extendedMessage, undefined, 32)
|
|
269
252
|
return utils.verifySignature(utils.binToHex(messageHash), publicKey, signature, keyType)
|