@alephium/web3 0.25.1 → 0.26.0

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.
@@ -114,6 +114,14 @@ export interface ExplorerInfo {
114
114
  /** @format int64 */
115
115
  lastFinalizedInputTime: number;
116
116
  }
117
+ export interface FungibleTokenMetadata {
118
+ /** @format 32-byte-hash */
119
+ id: string;
120
+ symbol: string;
121
+ name: string;
122
+ /** @format uint256 */
123
+ decimals: string;
124
+ }
117
125
  export interface Hashrate {
118
126
  /** @format int64 */
119
127
  timestamp: number;
@@ -164,6 +172,20 @@ export interface MempoolTransaction {
164
172
  /** @format int64 */
165
173
  lastSeen: number;
166
174
  }
175
+ export interface NFTCollectionMetadata {
176
+ /** @format address */
177
+ address: string;
178
+ collectionUri: string;
179
+ }
180
+ export interface NFTMetadata {
181
+ /** @format 32-byte-hash */
182
+ id: string;
183
+ tokenUri: string;
184
+ /** @format 32-byte-hash */
185
+ collectionId: string;
186
+ /** @format uint256 */
187
+ nftIndex: string;
188
+ }
167
189
  export interface NotFound {
168
190
  detail: string;
169
191
  resource: string;
@@ -243,6 +265,17 @@ export interface Token {
243
265
  /** @format uint256 */
244
266
  amount: string;
245
267
  }
268
+ export interface TokenInfo {
269
+ /** @format 32-byte-hash */
270
+ token: string;
271
+ /** Raw interface id, e.g. 0001 */
272
+ stdInterfaceId?: TokenStdInterfaceId | string;
273
+ }
274
+ export declare enum TokenStdInterfaceId {
275
+ Fungible = "fungible",
276
+ NonFungible = "non-fungible",
277
+ NonStandard = "non-standard"
278
+ }
246
279
  export interface TokenSupply {
247
280
  /** @format int64 */
248
281
  timestamp: number;
@@ -306,6 +339,12 @@ export interface ValU256 {
306
339
  value: string;
307
340
  type: string;
308
341
  }
342
+ export declare enum MaxSizeTokens {
343
+ Value80 = 80
344
+ }
345
+ export declare enum MaxSizeAddresses {
346
+ Value80 = 80
347
+ }
309
348
  import 'cross-fetch/polyfill';
310
349
  export type QueryParamsType = Record<string | number, any>;
311
350
  export type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
@@ -536,6 +575,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
536
575
  * @tags Addresses
537
576
  * @name GetAddressesAddressTokens
538
577
  * @request GET:/addresses/{address}/tokens
578
+ * @deprecated
539
579
  */
540
580
  getAddressesAddressTokens: (address: string, query?: {
541
581
  /**
@@ -751,7 +791,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
751
791
  };
752
792
  tokens: {
753
793
  /**
754
- * @description List tokens
794
+ * @description List token information
755
795
  *
756
796
  * @tags Tokens
757
797
  * @name GetTokens
@@ -768,7 +808,20 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
768
808
  * @format int32
769
809
  */
770
810
  limit?: number;
771
- }, params?: RequestParams) => Promise<string[]>;
811
+ /**
812
+ * fungible, non-fungible, non-standard or any interface id in hex-string format, e.g: 0001
813
+ * @format string
814
+ */
815
+ 'interface-id'?: TokenStdInterfaceId | string;
816
+ }, params?: RequestParams) => Promise<TokenInfo[]>;
817
+ /**
818
+ * @description list given tokens information
819
+ *
820
+ * @tags Tokens
821
+ * @name PostTokens
822
+ * @request POST:/tokens
823
+ */
824
+ postTokens: (data?: string[], params?: RequestParams) => Promise<TokenInfo[]>;
772
825
  /**
773
826
  * @description List token transactions
774
827
  *
@@ -788,6 +841,30 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
788
841
  */
789
842
  limit?: number;
790
843
  }, params?: RequestParams) => Promise<Transaction[]>;
844
+ /**
845
+ * @description Return metadata for the given fungible tokens, if metadata doesn't exist or token isn't a fungible, it won't be in the output list
846
+ *
847
+ * @tags Tokens
848
+ * @name PostTokensFungibleMetadata
849
+ * @request POST:/tokens/fungible-metadata
850
+ */
851
+ postTokensFungibleMetadata: (data?: string[], params?: RequestParams) => Promise<FungibleTokenMetadata[]>;
852
+ /**
853
+ * @description Return metadata for the given nft tokens, if metadata doesn't exist or token isn't a nft, it won't be in the output list
854
+ *
855
+ * @tags Tokens
856
+ * @name PostTokensNftMetadata
857
+ * @request POST:/tokens/nft-metadata
858
+ */
859
+ postTokensNftMetadata: (data?: string[], params?: RequestParams) => Promise<NFTMetadata[]>;
860
+ /**
861
+ * @description Return metadata for the given nft collection addresses, if metadata doesn't exist or address isn't a nft collection, it won't be in the output list
862
+ *
863
+ * @tags Tokens
864
+ * @name PostTokensNftCollectionMetadata
865
+ * @request POST:/tokens/nft-collection-metadata
866
+ */
867
+ postTokensNftCollectionMetadata: (data?: string[], params?: RequestParams) => Promise<NFTCollectionMetadata[]>;
791
868
  };
792
869
  charts: {
793
870
  /**
@@ -907,18 +984,18 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
907
984
  * @description Get contract parent address if exist
908
985
  *
909
986
  * @tags Contracts
910
- * @name GetContractsContractParent
911
- * @request GET:/contracts/{contract}/parent
987
+ * @name GetContractsContractAddressParent
988
+ * @request GET:/contracts/{contract_address}/parent
912
989
  */
913
- getContractsContractParent: (contract: string, params?: RequestParams) => Promise<ContractParent>;
990
+ getContractsContractAddressParent: (contractAddress: string, params?: RequestParams) => Promise<ContractParent>;
914
991
  /**
915
992
  * @description Get sub contract addresses
916
993
  *
917
994
  * @tags Contracts
918
- * @name GetContractsContractSubContracts
919
- * @request GET:/contracts/{contract}/sub-contracts
995
+ * @name GetContractsContractAddressSubContracts
996
+ * @request GET:/contracts/{contract_address}/sub-contracts
920
997
  */
921
- getContractsContractSubContracts: (contract: string, query?: {
998
+ getContractsContractAddressSubContracts: (contractAddress: string, query?: {
922
999
  /**
923
1000
  * Page number
924
1001
  * @format int32
@@ -10,12 +10,26 @@
10
10
  * ---------------------------------------------------------------
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.Api = exports.HttpClient = exports.ContentType = exports.IntervalType = void 0;
13
+ exports.Api = exports.HttpClient = exports.ContentType = exports.MaxSizeAddresses = exports.MaxSizeTokens = exports.TokenStdInterfaceId = exports.IntervalType = void 0;
14
14
  var IntervalType;
15
15
  (function (IntervalType) {
16
16
  IntervalType["Daily"] = "daily";
17
17
  IntervalType["Hourly"] = "hourly";
18
18
  })(IntervalType = exports.IntervalType || (exports.IntervalType = {}));
19
+ var TokenStdInterfaceId;
20
+ (function (TokenStdInterfaceId) {
21
+ TokenStdInterfaceId["Fungible"] = "fungible";
22
+ TokenStdInterfaceId["NonFungible"] = "non-fungible";
23
+ TokenStdInterfaceId["NonStandard"] = "non-standard";
24
+ })(TokenStdInterfaceId = exports.TokenStdInterfaceId || (exports.TokenStdInterfaceId = {}));
25
+ var MaxSizeTokens;
26
+ (function (MaxSizeTokens) {
27
+ MaxSizeTokens[MaxSizeTokens["Value80"] = 80] = "Value80";
28
+ })(MaxSizeTokens = exports.MaxSizeTokens || (exports.MaxSizeTokens = {}));
29
+ var MaxSizeAddresses;
30
+ (function (MaxSizeAddresses) {
31
+ MaxSizeAddresses[MaxSizeAddresses["Value80"] = 80] = "Value80";
32
+ })(MaxSizeAddresses = exports.MaxSizeAddresses || (exports.MaxSizeAddresses = {}));
19
33
  require("cross-fetch/polyfill");
20
34
  const utils_1 = require("./utils");
21
35
  var ContentType;
@@ -322,6 +336,7 @@ class Api extends HttpClient {
322
336
  * @tags Addresses
323
337
  * @name GetAddressesAddressTokens
324
338
  * @request GET:/addresses/{address}/tokens
339
+ * @deprecated
325
340
  */
326
341
  getAddressesAddressTokens: (address, query, params = {}) => this.request({
327
342
  path: `/addresses/${address}/tokens`,
@@ -553,7 +568,7 @@ class Api extends HttpClient {
553
568
  };
554
569
  this.tokens = {
555
570
  /**
556
- * @description List tokens
571
+ * @description List token information
557
572
  *
558
573
  * @tags Tokens
559
574
  * @name GetTokens
@@ -566,6 +581,21 @@ class Api extends HttpClient {
566
581
  format: 'json',
567
582
  ...params
568
583
  }).then(utils_1.convertHttpResponse),
584
+ /**
585
+ * @description list given tokens information
586
+ *
587
+ * @tags Tokens
588
+ * @name PostTokens
589
+ * @request POST:/tokens
590
+ */
591
+ postTokens: (data, params = {}) => this.request({
592
+ path: `/tokens`,
593
+ method: 'POST',
594
+ body: data,
595
+ type: ContentType.Json,
596
+ format: 'json',
597
+ ...params
598
+ }).then(utils_1.convertHttpResponse),
569
599
  /**
570
600
  * @description List token transactions
571
601
  *
@@ -579,6 +609,51 @@ class Api extends HttpClient {
579
609
  query: query,
580
610
  format: 'json',
581
611
  ...params
612
+ }).then(utils_1.convertHttpResponse),
613
+ /**
614
+ * @description Return metadata for the given fungible tokens, if metadata doesn't exist or token isn't a fungible, it won't be in the output list
615
+ *
616
+ * @tags Tokens
617
+ * @name PostTokensFungibleMetadata
618
+ * @request POST:/tokens/fungible-metadata
619
+ */
620
+ postTokensFungibleMetadata: (data, params = {}) => this.request({
621
+ path: `/tokens/fungible-metadata`,
622
+ method: 'POST',
623
+ body: data,
624
+ type: ContentType.Json,
625
+ format: 'json',
626
+ ...params
627
+ }).then(utils_1.convertHttpResponse),
628
+ /**
629
+ * @description Return metadata for the given nft tokens, if metadata doesn't exist or token isn't a nft, it won't be in the output list
630
+ *
631
+ * @tags Tokens
632
+ * @name PostTokensNftMetadata
633
+ * @request POST:/tokens/nft-metadata
634
+ */
635
+ postTokensNftMetadata: (data, params = {}) => this.request({
636
+ path: `/tokens/nft-metadata`,
637
+ method: 'POST',
638
+ body: data,
639
+ type: ContentType.Json,
640
+ format: 'json',
641
+ ...params
642
+ }).then(utils_1.convertHttpResponse),
643
+ /**
644
+ * @description Return metadata for the given nft collection addresses, if metadata doesn't exist or address isn't a nft collection, it won't be in the output list
645
+ *
646
+ * @tags Tokens
647
+ * @name PostTokensNftCollectionMetadata
648
+ * @request POST:/tokens/nft-collection-metadata
649
+ */
650
+ postTokensNftCollectionMetadata: (data, params = {}) => this.request({
651
+ path: `/tokens/nft-collection-metadata`,
652
+ method: 'POST',
653
+ body: data,
654
+ type: ContentType.Json,
655
+ format: 'json',
656
+ ...params
582
657
  }).then(utils_1.convertHttpResponse)
583
658
  };
584
659
  this.charts = {
@@ -676,11 +751,11 @@ class Api extends HttpClient {
676
751
  * @description Get contract parent address if exist
677
752
  *
678
753
  * @tags Contracts
679
- * @name GetContractsContractParent
680
- * @request GET:/contracts/{contract}/parent
754
+ * @name GetContractsContractAddressParent
755
+ * @request GET:/contracts/{contract_address}/parent
681
756
  */
682
- getContractsContractParent: (contract, params = {}) => this.request({
683
- path: `/contracts/${contract}/parent`,
757
+ getContractsContractAddressParent: (contractAddress, params = {}) => this.request({
758
+ path: `/contracts/${contractAddress}/parent`,
684
759
  method: 'GET',
685
760
  format: 'json',
686
761
  ...params
@@ -689,11 +764,11 @@ class Api extends HttpClient {
689
764
  * @description Get sub contract addresses
690
765
  *
691
766
  * @tags Contracts
692
- * @name GetContractsContractSubContracts
693
- * @request GET:/contracts/{contract}/sub-contracts
767
+ * @name GetContractsContractAddressSubContracts
768
+ * @request GET:/contracts/{contract_address}/sub-contracts
694
769
  */
695
- getContractsContractSubContracts: (contract, query, params = {}) => this.request({
696
- path: `/contracts/${contract}/sub-contracts`,
770
+ getContractsContractAddressSubContracts: (contractAddress, query, params = {}) => this.request({
771
+ path: `/contracts/${contractAddress}/sub-contracts`,
697
772
  method: 'GET',
698
773
  query: query,
699
774
  format: 'json',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alephium/web3",
3
- "version": "0.25.1",
3
+ "version": "0.26.0",
4
4
  "description": "A JS/TS library to interact with the Alephium platform",
5
5
  "license": "GPL",
6
6
  "main": "dist/src/index.js",
@@ -28,7 +28,7 @@
28
28
  "author": "Alephium dev <dev@alephium.org>",
29
29
  "config": {
30
30
  "alephium_version": "2.5.5",
31
- "explorer_backend_version": "1.15.1"
31
+ "explorer_backend_version": "1.16.0"
32
32
  },
33
33
  "type": "commonjs",
34
34
  "dependencies": {
@@ -136,6 +136,15 @@ export interface ExplorerInfo {
136
136
  lastFinalizedInputTime: number
137
137
  }
138
138
 
139
+ export interface FungibleTokenMetadata {
140
+ /** @format 32-byte-hash */
141
+ id: string
142
+ symbol: string
143
+ name: string
144
+ /** @format uint256 */
145
+ decimals: string
146
+ }
147
+
139
148
  export interface Hashrate {
140
149
  /** @format int64 */
141
150
  timestamp: number
@@ -193,6 +202,22 @@ export interface MempoolTransaction {
193
202
  lastSeen: number
194
203
  }
195
204
 
205
+ export interface NFTCollectionMetadata {
206
+ /** @format address */
207
+ address: string
208
+ collectionUri: string
209
+ }
210
+
211
+ export interface NFTMetadata {
212
+ /** @format 32-byte-hash */
213
+ id: string
214
+ tokenUri: string
215
+ /** @format 32-byte-hash */
216
+ collectionId: string
217
+ /** @format uint256 */
218
+ nftIndex: string
219
+ }
220
+
196
221
  export interface NotFound {
197
222
  detail: string
198
223
  resource: string
@@ -284,6 +309,19 @@ export interface Token {
284
309
  amount: string
285
310
  }
286
311
 
312
+ export interface TokenInfo {
313
+ /** @format 32-byte-hash */
314
+ token: string
315
+ /** Raw interface id, e.g. 0001 */
316
+ stdInterfaceId?: TokenStdInterfaceId | string
317
+ }
318
+
319
+ export enum TokenStdInterfaceId {
320
+ Fungible = 'fungible',
321
+ NonFungible = 'non-fungible',
322
+ NonStandard = 'non-standard'
323
+ }
324
+
287
325
  export interface TokenSupply {
288
326
  /** @format int64 */
289
327
  timestamp: number
@@ -358,6 +396,14 @@ export interface ValU256 {
358
396
  type: string
359
397
  }
360
398
 
399
+ export enum MaxSizeTokens {
400
+ Value80 = 80
401
+ }
402
+
403
+ export enum MaxSizeAddresses {
404
+ Value80 = 80
405
+ }
406
+
361
407
  import 'cross-fetch/polyfill'
362
408
  import { convertHttpResponse } from './utils'
363
409
 
@@ -845,6 +891,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
845
891
  * @tags Addresses
846
892
  * @name GetAddressesAddressTokens
847
893
  * @request GET:/addresses/{address}/tokens
894
+ * @deprecated
848
895
  */
849
896
  getAddressesAddressTokens: (
850
897
  address: string,
@@ -1223,7 +1270,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1223
1270
  }
1224
1271
  tokens = {
1225
1272
  /**
1226
- * @description List tokens
1273
+ * @description List token information
1227
1274
  *
1228
1275
  * @tags Tokens
1229
1276
  * @name GetTokens
@@ -1241,10 +1288,15 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1241
1288
  * @format int32
1242
1289
  */
1243
1290
  limit?: number
1291
+ /**
1292
+ * fungible, non-fungible, non-standard or any interface id in hex-string format, e.g: 0001
1293
+ * @format string
1294
+ */
1295
+ 'interface-id'?: TokenStdInterfaceId | string
1244
1296
  },
1245
1297
  params: RequestParams = {}
1246
1298
  ) =>
1247
- this.request<string[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1299
+ this.request<TokenInfo[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1248
1300
  path: `/tokens`,
1249
1301
  method: 'GET',
1250
1302
  query: query,
@@ -1252,6 +1304,23 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1252
1304
  ...params
1253
1305
  }).then(convertHttpResponse),
1254
1306
 
1307
+ /**
1308
+ * @description list given tokens information
1309
+ *
1310
+ * @tags Tokens
1311
+ * @name PostTokens
1312
+ * @request POST:/tokens
1313
+ */
1314
+ postTokens: (data?: string[], params: RequestParams = {}) =>
1315
+ this.request<TokenInfo[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1316
+ path: `/tokens`,
1317
+ method: 'POST',
1318
+ body: data,
1319
+ type: ContentType.Json,
1320
+ format: 'json',
1321
+ ...params
1322
+ }).then(convertHttpResponse),
1323
+
1255
1324
  /**
1256
1325
  * @description List token transactions
1257
1326
  *
@@ -1281,6 +1350,63 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1281
1350
  query: query,
1282
1351
  format: 'json',
1283
1352
  ...params
1353
+ }).then(convertHttpResponse),
1354
+
1355
+ /**
1356
+ * @description Return metadata for the given fungible tokens, if metadata doesn't exist or token isn't a fungible, it won't be in the output list
1357
+ *
1358
+ * @tags Tokens
1359
+ * @name PostTokensFungibleMetadata
1360
+ * @request POST:/tokens/fungible-metadata
1361
+ */
1362
+ postTokensFungibleMetadata: (data?: string[], params: RequestParams = {}) =>
1363
+ this.request<
1364
+ FungibleTokenMetadata[],
1365
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
1366
+ >({
1367
+ path: `/tokens/fungible-metadata`,
1368
+ method: 'POST',
1369
+ body: data,
1370
+ type: ContentType.Json,
1371
+ format: 'json',
1372
+ ...params
1373
+ }).then(convertHttpResponse),
1374
+
1375
+ /**
1376
+ * @description Return metadata for the given nft tokens, if metadata doesn't exist or token isn't a nft, it won't be in the output list
1377
+ *
1378
+ * @tags Tokens
1379
+ * @name PostTokensNftMetadata
1380
+ * @request POST:/tokens/nft-metadata
1381
+ */
1382
+ postTokensNftMetadata: (data?: string[], params: RequestParams = {}) =>
1383
+ this.request<NFTMetadata[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1384
+ path: `/tokens/nft-metadata`,
1385
+ method: 'POST',
1386
+ body: data,
1387
+ type: ContentType.Json,
1388
+ format: 'json',
1389
+ ...params
1390
+ }).then(convertHttpResponse),
1391
+
1392
+ /**
1393
+ * @description Return metadata for the given nft collection addresses, if metadata doesn't exist or address isn't a nft collection, it won't be in the output list
1394
+ *
1395
+ * @tags Tokens
1396
+ * @name PostTokensNftCollectionMetadata
1397
+ * @request POST:/tokens/nft-collection-metadata
1398
+ */
1399
+ postTokensNftCollectionMetadata: (data?: string[], params: RequestParams = {}) =>
1400
+ this.request<
1401
+ NFTCollectionMetadata[],
1402
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
1403
+ >({
1404
+ path: `/tokens/nft-collection-metadata`,
1405
+ method: 'POST',
1406
+ body: data,
1407
+ type: ContentType.Json,
1408
+ format: 'json',
1409
+ ...params
1284
1410
  }).then(convertHttpResponse)
1285
1411
  }
1286
1412
  charts = {
@@ -1467,12 +1593,12 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1467
1593
  * @description Get contract parent address if exist
1468
1594
  *
1469
1595
  * @tags Contracts
1470
- * @name GetContractsContractParent
1471
- * @request GET:/contracts/{contract}/parent
1596
+ * @name GetContractsContractAddressParent
1597
+ * @request GET:/contracts/{contract_address}/parent
1472
1598
  */
1473
- getContractsContractParent: (contract: string, params: RequestParams = {}) =>
1599
+ getContractsContractAddressParent: (contractAddress: string, params: RequestParams = {}) =>
1474
1600
  this.request<ContractParent, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1475
- path: `/contracts/${contract}/parent`,
1601
+ path: `/contracts/${contractAddress}/parent`,
1476
1602
  method: 'GET',
1477
1603
  format: 'json',
1478
1604
  ...params
@@ -1482,11 +1608,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1482
1608
  * @description Get sub contract addresses
1483
1609
  *
1484
1610
  * @tags Contracts
1485
- * @name GetContractsContractSubContracts
1486
- * @request GET:/contracts/{contract}/sub-contracts
1611
+ * @name GetContractsContractAddressSubContracts
1612
+ * @request GET:/contracts/{contract_address}/sub-contracts
1487
1613
  */
1488
- getContractsContractSubContracts: (
1489
- contract: string,
1614
+ getContractsContractAddressSubContracts: (
1615
+ contractAddress: string,
1490
1616
  query?: {
1491
1617
  /**
1492
1618
  * Page number
@@ -1502,7 +1628,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1502
1628
  params: RequestParams = {}
1503
1629
  ) =>
1504
1630
  this.request<SubContracts, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1505
- path: `/contracts/${contract}/sub-contracts`,
1631
+ path: `/contracts/${contractAddress}/sub-contracts`,
1506
1632
  method: 'GET',
1507
1633
  query: query,
1508
1634
  format: 'json',