@alephium/web3 0.7.1 → 0.8.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.
@@ -81,6 +81,10 @@ export interface ContractOutput {
81
81
  spent?: string;
82
82
  type: string;
83
83
  }
84
+ export interface ContractParent {
85
+ /** @format address */
86
+ parent?: string;
87
+ }
84
88
  export interface Event {
85
89
  /** @format block-hash */
86
90
  blockHash: string;
@@ -212,6 +216,9 @@ export interface PerChainTimedCount {
212
216
  export interface ServiceUnavailable {
213
217
  detail: string;
214
218
  }
219
+ export interface SubContracts {
220
+ subContracts?: string[];
221
+ }
215
222
  export interface TimedCount {
216
223
  /** @format int64 */
217
224
  timestamp: number;
@@ -855,6 +862,37 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
855
862
  reverse?: boolean;
856
863
  }, params?: RequestParams) => Promise<Event[]>;
857
864
  };
865
+ contracts: {
866
+ /**
867
+ * @description Get contract parent address if exist
868
+ *
869
+ * @tags Contracts
870
+ * @name GetContractsContractParent
871
+ * @request GET:/contracts/{contract}/parent
872
+ */
873
+ getContractsContractParent: (contract: string, params?: RequestParams) => Promise<ContractParent>;
874
+ /**
875
+ * @description Get sub contract addresses
876
+ *
877
+ * @tags Contracts
878
+ * @name GetContractsContractSubContracts
879
+ * @request GET:/contracts/{contract}/sub-contracts
880
+ */
881
+ getContractsContractSubContracts: (contract: string, query?: {
882
+ /**
883
+ * Page number
884
+ * @format int32
885
+ */
886
+ page?: number;
887
+ /**
888
+ * Number of items per page
889
+ * @format int32
890
+ */
891
+ limit?: number;
892
+ /** Reverse pagination */
893
+ reverse?: boolean;
894
+ }, params?: RequestParams) => Promise<SubContracts>;
895
+ };
858
896
  utils: {
859
897
  /**
860
898
  * @description Perform a sanity check
@@ -636,6 +636,35 @@ class Api extends HttpClient {
636
636
  ...params
637
637
  }).then(utils_1.convertHttpResponse)
638
638
  };
639
+ this.contracts = {
640
+ /**
641
+ * @description Get contract parent address if exist
642
+ *
643
+ * @tags Contracts
644
+ * @name GetContractsContractParent
645
+ * @request GET:/contracts/{contract}/parent
646
+ */
647
+ getContractsContractParent: (contract, params = {}) => this.request({
648
+ path: `/contracts/${contract}/parent`,
649
+ method: 'GET',
650
+ format: 'json',
651
+ ...params
652
+ }).then(utils_1.convertHttpResponse),
653
+ /**
654
+ * @description Get sub contract addresses
655
+ *
656
+ * @tags Contracts
657
+ * @name GetContractsContractSubContracts
658
+ * @request GET:/contracts/{contract}/sub-contracts
659
+ */
660
+ getContractsContractSubContracts: (contract, query, params = {}) => this.request({
661
+ path: `/contracts/${contract}/sub-contracts`,
662
+ method: 'GET',
663
+ query: query,
664
+ format: 'json',
665
+ ...params
666
+ }).then(utils_1.convertHttpResponse)
667
+ };
639
668
  this.utils = {
640
669
  /**
641
670
  * @description Perform a sanity check
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alephium/web3",
3
- "version": "0.7.1",
3
+ "version": "0.8.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.0.1",
31
- "explorer_backend_version": "1.13.2"
31
+ "explorer_backend_version": "1.13.3"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "rm -rf dist/* && npx tsc --build . && webpack",
@@ -99,6 +99,11 @@ export interface ContractOutput {
99
99
  type: string
100
100
  }
101
101
 
102
+ export interface ContractParent {
103
+ /** @format address */
104
+ parent?: string
105
+ }
106
+
102
107
  export interface Event {
103
108
  /** @format block-hash */
104
109
  blockHash: string
@@ -248,6 +253,10 @@ export interface ServiceUnavailable {
248
253
  detail: string
249
254
  }
250
255
 
256
+ export interface SubContracts {
257
+ subContracts?: string[]
258
+ }
259
+
251
260
  export interface TimedCount {
252
261
  /** @format int64 */
253
262
  timestamp: number
@@ -1371,6 +1380,55 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1371
1380
  ...params
1372
1381
  }).then(convertHttpResponse)
1373
1382
  }
1383
+ contracts = {
1384
+ /**
1385
+ * @description Get contract parent address if exist
1386
+ *
1387
+ * @tags Contracts
1388
+ * @name GetContractsContractParent
1389
+ * @request GET:/contracts/{contract}/parent
1390
+ */
1391
+ getContractsContractParent: (contract: string, params: RequestParams = {}) =>
1392
+ this.request<ContractParent, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1393
+ path: `/contracts/${contract}/parent`,
1394
+ method: 'GET',
1395
+ format: 'json',
1396
+ ...params
1397
+ }).then(convertHttpResponse),
1398
+
1399
+ /**
1400
+ * @description Get sub contract addresses
1401
+ *
1402
+ * @tags Contracts
1403
+ * @name GetContractsContractSubContracts
1404
+ * @request GET:/contracts/{contract}/sub-contracts
1405
+ */
1406
+ getContractsContractSubContracts: (
1407
+ contract: string,
1408
+ query?: {
1409
+ /**
1410
+ * Page number
1411
+ * @format int32
1412
+ */
1413
+ page?: number
1414
+ /**
1415
+ * Number of items per page
1416
+ * @format int32
1417
+ */
1418
+ limit?: number
1419
+ /** Reverse pagination */
1420
+ reverse?: boolean
1421
+ },
1422
+ params: RequestParams = {}
1423
+ ) =>
1424
+ this.request<SubContracts, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1425
+ path: `/contracts/${contract}/sub-contracts`,
1426
+ method: 'GET',
1427
+ query: query,
1428
+ format: 'json',
1429
+ ...params
1430
+ }).then(convertHttpResponse)
1431
+ }
1374
1432
  utils = {
1375
1433
  /**
1376
1434
  * @description Perform a sanity check
@@ -1,4 +1,4 @@
1
- Interface IToken {
1
+ Interface IFungibleToken {
2
2
  pub fn getSymbol() -> ByteVec
3
3
 
4
4
  pub fn getName() -> ByteVec
@@ -0,0 +1,8 @@
1
+ Interface INFTCollection {
2
+ event Minted(minter: Address, tokenIndex: U256, tokenId: ByteVec)
3
+
4
+ pub fn getName() -> ByteVec
5
+ pub fn getSymbol() -> ByteVec
6
+ pub fn totalSupply() -> U256
7
+ pub fn nftByIndex(index: U256) -> INFT
8
+ }
@@ -0,0 +1,3 @@
1
+ Interface INFT {
2
+ pub fn getTokenUri() -> ByteVec
3
+ }