@alephium/web3 0.2.0-rc.13 → 0.2.0-rc.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/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/api/api-explorer.d.ts +147 -32
- package/dist/src/api/api-explorer.js +133 -1
- package/package.json +2 -2
- package/src/api/api-explorer.ts +233 -40
package/src/api/api-explorer.ts
CHANGED
|
@@ -28,6 +28,29 @@ export interface AddressInfo {
|
|
|
28
28
|
txNumber: number
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
export interface AssetOutput {
|
|
32
|
+
/** @format int32 */
|
|
33
|
+
hint: number
|
|
34
|
+
|
|
35
|
+
/** @format 32-byte-hash */
|
|
36
|
+
key: string
|
|
37
|
+
|
|
38
|
+
/** @format uint256 */
|
|
39
|
+
attoAlphAmount: string
|
|
40
|
+
address: string
|
|
41
|
+
tokens?: Token[]
|
|
42
|
+
|
|
43
|
+
/** @format int64 */
|
|
44
|
+
lockTime?: number
|
|
45
|
+
|
|
46
|
+
/** @format hex-string */
|
|
47
|
+
message?: string
|
|
48
|
+
|
|
49
|
+
/** @format 32-byte-hash */
|
|
50
|
+
spent?: string
|
|
51
|
+
type: string
|
|
52
|
+
}
|
|
53
|
+
|
|
31
54
|
export interface BadRequest {
|
|
32
55
|
detail: string
|
|
33
56
|
}
|
|
@@ -76,6 +99,23 @@ export interface ConfirmedTransaction {
|
|
|
76
99
|
type: string
|
|
77
100
|
}
|
|
78
101
|
|
|
102
|
+
export interface ContractOutput {
|
|
103
|
+
/** @format int32 */
|
|
104
|
+
hint: number
|
|
105
|
+
|
|
106
|
+
/** @format 32-byte-hash */
|
|
107
|
+
key: string
|
|
108
|
+
|
|
109
|
+
/** @format uint256 */
|
|
110
|
+
attoAlphAmount: string
|
|
111
|
+
address: string
|
|
112
|
+
tokens?: Token[]
|
|
113
|
+
|
|
114
|
+
/** @format 32-byte-hash */
|
|
115
|
+
spent?: string
|
|
116
|
+
type: string
|
|
117
|
+
}
|
|
118
|
+
|
|
79
119
|
export interface ExplorerInfo {
|
|
80
120
|
releaseVersion: string
|
|
81
121
|
commit: string
|
|
@@ -90,14 +130,14 @@ export interface Hashrate {
|
|
|
90
130
|
|
|
91
131
|
export interface Input {
|
|
92
132
|
outputRef: OutputRef
|
|
93
|
-
unlockScript?: string
|
|
94
133
|
|
|
95
|
-
/** @format
|
|
96
|
-
|
|
97
|
-
address
|
|
134
|
+
/** @format hex-string */
|
|
135
|
+
unlockScript?: string
|
|
136
|
+
address?: string
|
|
98
137
|
|
|
99
138
|
/** @format uint256 */
|
|
100
|
-
|
|
139
|
+
attoAlphAmount?: string
|
|
140
|
+
tokens?: Token[]
|
|
101
141
|
}
|
|
102
142
|
|
|
103
143
|
export interface InternalServerError {
|
|
@@ -110,28 +150,17 @@ export interface ListBlocks {
|
|
|
110
150
|
blocks?: BlockEntryLite[]
|
|
111
151
|
}
|
|
112
152
|
|
|
153
|
+
export interface LogbackValue {
|
|
154
|
+
name: string
|
|
155
|
+
level: string
|
|
156
|
+
}
|
|
157
|
+
|
|
113
158
|
export interface NotFound {
|
|
114
159
|
detail: string
|
|
115
160
|
resource: string
|
|
116
161
|
}
|
|
117
162
|
|
|
118
|
-
export
|
|
119
|
-
/** @format int32 */
|
|
120
|
-
hint: number
|
|
121
|
-
|
|
122
|
-
/** @format 32-byte-hash */
|
|
123
|
-
key: string
|
|
124
|
-
|
|
125
|
-
/** @format uint256 */
|
|
126
|
-
amount: string
|
|
127
|
-
address: string
|
|
128
|
-
|
|
129
|
-
/** @format int64 */
|
|
130
|
-
lockTime?: number
|
|
131
|
-
|
|
132
|
-
/** @format 32-byte-hash */
|
|
133
|
-
spent?: string
|
|
134
|
-
}
|
|
163
|
+
export type Output = AssetOutput | ContractOutput
|
|
135
164
|
|
|
136
165
|
export interface OutputRef {
|
|
137
166
|
/** @format int32 */
|
|
@@ -198,6 +227,14 @@ export interface TimedCount {
|
|
|
198
227
|
totalCountAllChains: number
|
|
199
228
|
}
|
|
200
229
|
|
|
230
|
+
export interface Token {
|
|
231
|
+
/** @format 32-byte-hash */
|
|
232
|
+
id: string
|
|
233
|
+
|
|
234
|
+
/** @format uint256 */
|
|
235
|
+
amount: string
|
|
236
|
+
}
|
|
237
|
+
|
|
201
238
|
export interface TokenSupply {
|
|
202
239
|
/** @format int64 */
|
|
203
240
|
timestamp: number
|
|
@@ -239,20 +276,6 @@ export interface Transaction {
|
|
|
239
276
|
|
|
240
277
|
export type TransactionLike = ConfirmedTransaction | UnconfirmedTransaction
|
|
241
278
|
|
|
242
|
-
export interface UInput {
|
|
243
|
-
outputRef: OutputRef
|
|
244
|
-
unlockScript?: string
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export interface UOutput {
|
|
248
|
-
/** @format uint256 */
|
|
249
|
-
amount: string
|
|
250
|
-
address: string
|
|
251
|
-
|
|
252
|
-
/** @format int64 */
|
|
253
|
-
lockTime?: number
|
|
254
|
-
}
|
|
255
|
-
|
|
256
279
|
export interface Unauthorized {
|
|
257
280
|
detail: string
|
|
258
281
|
}
|
|
@@ -266,14 +289,17 @@ export interface UnconfirmedTransaction {
|
|
|
266
289
|
|
|
267
290
|
/** @format int32 */
|
|
268
291
|
chainTo: number
|
|
269
|
-
inputs?:
|
|
270
|
-
outputs?:
|
|
292
|
+
inputs?: Input[]
|
|
293
|
+
outputs?: AssetOutput[]
|
|
271
294
|
|
|
272
295
|
/** @format int32 */
|
|
273
296
|
gasAmount: number
|
|
274
297
|
|
|
275
298
|
/** @format uint256 */
|
|
276
299
|
gasPrice: string
|
|
300
|
+
|
|
301
|
+
/** @format int64 */
|
|
302
|
+
lastSeen: number
|
|
277
303
|
type: string
|
|
278
304
|
}
|
|
279
305
|
|
|
@@ -560,6 +586,25 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
560
586
|
...params
|
|
561
587
|
}).then(convertHttpResponse)
|
|
562
588
|
}
|
|
589
|
+
transactionByOutputRefKey = {
|
|
590
|
+
/**
|
|
591
|
+
* @description Get a transaction from a output reference key
|
|
592
|
+
*
|
|
593
|
+
* @tags Transactions
|
|
594
|
+
* @name GetTransactionByOutputRefKeyOutputRefKey
|
|
595
|
+
* @request GET:/transaction-by-output-ref-key/{output-ref-key}
|
|
596
|
+
*/
|
|
597
|
+
getTransactionByOutputRefKeyOutputRefKey: (outputRefKey: string, params: RequestParams = {}) =>
|
|
598
|
+
this.request<
|
|
599
|
+
ConfirmedTransaction,
|
|
600
|
+
BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
|
|
601
|
+
>({
|
|
602
|
+
path: `/transaction-by-output-ref-key/${outputRefKey}`,
|
|
603
|
+
method: 'GET',
|
|
604
|
+
format: 'json',
|
|
605
|
+
...params
|
|
606
|
+
}).then(convertHttpResponse)
|
|
607
|
+
}
|
|
563
608
|
addresses = {
|
|
564
609
|
/**
|
|
565
610
|
* @description Get address information
|
|
@@ -611,6 +656,24 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
611
656
|
...params
|
|
612
657
|
}).then(convertHttpResponse),
|
|
613
658
|
|
|
659
|
+
/**
|
|
660
|
+
* @description List unconfirmed transactions of a given address
|
|
661
|
+
*
|
|
662
|
+
* @tags Addresses
|
|
663
|
+
* @name GetAddressesAddressUnconfirmedTransactions
|
|
664
|
+
* @request GET:/addresses/{address}/unconfirmed-transactions
|
|
665
|
+
*/
|
|
666
|
+
getAddressesAddressUnconfirmedTransactions: (address: string, params: RequestParams = {}) =>
|
|
667
|
+
this.request<
|
|
668
|
+
UnconfirmedTransaction[],
|
|
669
|
+
BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
|
|
670
|
+
>({
|
|
671
|
+
path: `/addresses/${address}/unconfirmed-transactions`,
|
|
672
|
+
method: 'GET',
|
|
673
|
+
format: 'json',
|
|
674
|
+
...params
|
|
675
|
+
}).then(convertHttpResponse),
|
|
676
|
+
|
|
614
677
|
/**
|
|
615
678
|
* @description Get address balance
|
|
616
679
|
*
|
|
@@ -624,6 +687,75 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
624
687
|
method: 'GET',
|
|
625
688
|
format: 'json',
|
|
626
689
|
...params
|
|
690
|
+
}).then(convertHttpResponse),
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* @description List address tokens
|
|
694
|
+
*
|
|
695
|
+
* @tags Addresses
|
|
696
|
+
* @name GetAddressesAddressTokens
|
|
697
|
+
* @request GET:/addresses/{address}/tokens
|
|
698
|
+
*/
|
|
699
|
+
getAddressesAddressTokens: (address: string, params: RequestParams = {}) =>
|
|
700
|
+
this.request<string[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
701
|
+
path: `/addresses/${address}/tokens`,
|
|
702
|
+
method: 'GET',
|
|
703
|
+
format: 'json',
|
|
704
|
+
...params
|
|
705
|
+
}).then(convertHttpResponse),
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* @description List address tokens
|
|
709
|
+
*
|
|
710
|
+
* @tags Addresses
|
|
711
|
+
* @name GetAddressesAddressTokensTokenIdTransactions
|
|
712
|
+
* @request GET:/addresses/{address}/tokens/{token-id}/transactions
|
|
713
|
+
*/
|
|
714
|
+
getAddressesAddressTokensTokenIdTransactions: (
|
|
715
|
+
address: string,
|
|
716
|
+
tokenId: string,
|
|
717
|
+
query?: { page?: number; limit?: number; reverse?: boolean },
|
|
718
|
+
params: RequestParams = {}
|
|
719
|
+
) =>
|
|
720
|
+
this.request<Transaction[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
721
|
+
path: `/addresses/${address}/tokens/${tokenId}/transactions`,
|
|
722
|
+
method: 'GET',
|
|
723
|
+
query: query,
|
|
724
|
+
format: 'json',
|
|
725
|
+
...params
|
|
726
|
+
}).then(convertHttpResponse),
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* @description Get address balance of given token
|
|
730
|
+
*
|
|
731
|
+
* @tags Addresses
|
|
732
|
+
* @name GetAddressesAddressTokensTokenIdBalance
|
|
733
|
+
* @request GET:/addresses/{address}/tokens/{token-id}/balance
|
|
734
|
+
*/
|
|
735
|
+
getAddressesAddressTokensTokenIdBalance: (address: string, tokenId: string, params: RequestParams = {}) =>
|
|
736
|
+
this.request<AddressBalance, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
737
|
+
path: `/addresses/${address}/tokens/${tokenId}/balance`,
|
|
738
|
+
method: 'GET',
|
|
739
|
+
format: 'json',
|
|
740
|
+
...params
|
|
741
|
+
}).then(convertHttpResponse)
|
|
742
|
+
}
|
|
743
|
+
addressesActive = {
|
|
744
|
+
/**
|
|
745
|
+
* @description Are the addresses active (at least 1 transaction)
|
|
746
|
+
*
|
|
747
|
+
* @tags Addresses
|
|
748
|
+
* @name PostAddressesActive
|
|
749
|
+
* @request POST:/addresses-active
|
|
750
|
+
*/
|
|
751
|
+
postAddressesActive: (data?: string[], params: RequestParams = {}) =>
|
|
752
|
+
this.request<boolean[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
753
|
+
path: `/addresses-active`,
|
|
754
|
+
method: 'POST',
|
|
755
|
+
body: data,
|
|
756
|
+
type: ContentType.Json,
|
|
757
|
+
format: 'json',
|
|
758
|
+
...params
|
|
627
759
|
}).then(convertHttpResponse)
|
|
628
760
|
}
|
|
629
761
|
infos = {
|
|
@@ -760,6 +892,66 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
760
892
|
}
|
|
761
893
|
).then(convertHttpResponse)
|
|
762
894
|
}
|
|
895
|
+
unconfirmedTransactions = {
|
|
896
|
+
/**
|
|
897
|
+
* @description list unconfirmed transactions
|
|
898
|
+
*
|
|
899
|
+
* @tags Unconfirmed Transactions
|
|
900
|
+
* @name GetUnconfirmedTransactions
|
|
901
|
+
* @request GET:/unconfirmed-transactions
|
|
902
|
+
*/
|
|
903
|
+
getUnconfirmedTransactions: (
|
|
904
|
+
query?: { page?: number; limit?: number; reverse?: boolean },
|
|
905
|
+
params: RequestParams = {}
|
|
906
|
+
) =>
|
|
907
|
+
this.request<
|
|
908
|
+
UnconfirmedTransaction[],
|
|
909
|
+
BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
|
|
910
|
+
>({
|
|
911
|
+
path: `/unconfirmed-transactions`,
|
|
912
|
+
method: 'GET',
|
|
913
|
+
query: query,
|
|
914
|
+
format: 'json',
|
|
915
|
+
...params
|
|
916
|
+
}).then(convertHttpResponse)
|
|
917
|
+
}
|
|
918
|
+
tokens = {
|
|
919
|
+
/**
|
|
920
|
+
* @description List tokens
|
|
921
|
+
*
|
|
922
|
+
* @tags Tokens
|
|
923
|
+
* @name GetTokens
|
|
924
|
+
* @request GET:/tokens
|
|
925
|
+
*/
|
|
926
|
+
getTokens: (query?: { page?: number; limit?: number; reverse?: boolean }, params: RequestParams = {}) =>
|
|
927
|
+
this.request<string[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
928
|
+
path: `/tokens`,
|
|
929
|
+
method: 'GET',
|
|
930
|
+
query: query,
|
|
931
|
+
format: 'json',
|
|
932
|
+
...params
|
|
933
|
+
}).then(convertHttpResponse),
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* @description List token transactions
|
|
937
|
+
*
|
|
938
|
+
* @tags Tokens
|
|
939
|
+
* @name GetTokensTokenIdTransactions
|
|
940
|
+
* @request GET:/tokens/{token-id}/transactions
|
|
941
|
+
*/
|
|
942
|
+
getTokensTokenIdTransactions: (
|
|
943
|
+
tokenId: string,
|
|
944
|
+
query?: { page?: number; limit?: number; reverse?: boolean },
|
|
945
|
+
params: RequestParams = {}
|
|
946
|
+
) =>
|
|
947
|
+
this.request<Transaction[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
948
|
+
path: `/tokens/${tokenId}/transactions`,
|
|
949
|
+
method: 'GET',
|
|
950
|
+
query: query,
|
|
951
|
+
format: 'json',
|
|
952
|
+
...params
|
|
953
|
+
}).then(convertHttpResponse)
|
|
954
|
+
}
|
|
763
955
|
charts = {
|
|
764
956
|
/**
|
|
765
957
|
* @description `interval-type` query param: hourly, daily
|
|
@@ -855,17 +1047,18 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
855
1047
|
}).then(convertHttpResponse),
|
|
856
1048
|
|
|
857
1049
|
/**
|
|
858
|
-
* @description Update
|
|
1050
|
+
* @description Update logback values
|
|
859
1051
|
*
|
|
860
1052
|
* @tags Utils
|
|
861
1053
|
* @name PutUtilsUpdateLogConfig
|
|
862
1054
|
* @request PUT:/utils/update-log-config
|
|
863
1055
|
*/
|
|
864
|
-
putUtilsUpdateLogConfig: (data
|
|
1056
|
+
putUtilsUpdateLogConfig: (data?: LogbackValue[], params: RequestParams = {}) =>
|
|
865
1057
|
this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
866
1058
|
path: `/utils/update-log-config`,
|
|
867
1059
|
method: 'PUT',
|
|
868
1060
|
body: data,
|
|
1061
|
+
type: ContentType.Json,
|
|
869
1062
|
...params
|
|
870
1063
|
}).then(convertHttpResponse)
|
|
871
1064
|
}
|