@alephium/web3 0.3.0-rc.4 → 0.3.0-rc.7

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.
@@ -908,7 +908,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
908
908
  }
909
909
  /**
910
910
  * @title Alephium API
911
- * @version 1.6.0
911
+ * @version 1.6.2
912
912
  * @baseUrl ../
913
913
  */
914
914
  export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
@@ -149,7 +149,7 @@ class HttpClient {
149
149
  exports.HttpClient = HttpClient;
150
150
  /**
151
151
  * @title Alephium API
152
- * @version 1.6.0
152
+ * @version 1.6.2
153
153
  * @baseUrl ../
154
154
  */
155
155
  class Api extends HttpClient {
@@ -62,6 +62,7 @@ export interface ConfirmedTransaction {
62
62
  gasAmount: number;
63
63
  /** @format uint256 */
64
64
  gasPrice: string;
65
+ coinbase: boolean;
65
66
  type: string;
66
67
  }
67
68
  export interface ContractOutput {
@@ -77,6 +78,17 @@ export interface ContractOutput {
77
78
  spent?: string;
78
79
  type: string;
79
80
  }
81
+ export interface Event {
82
+ /** @format block-hash */
83
+ blockHash: string;
84
+ /** @format 32-byte-hash */
85
+ txHash: string;
86
+ contractAddress: string;
87
+ inputAddress?: string;
88
+ /** @format int32 */
89
+ eventIndex: number;
90
+ fields?: Val[];
91
+ }
80
92
  export interface ExplorerInfo {
81
93
  releaseVersion: string;
82
94
  commit: string;
@@ -101,6 +113,10 @@ export interface Input {
101
113
  export interface InternalServerError {
102
114
  detail: string;
103
115
  }
116
+ export declare enum IntervalType {
117
+ Daily = "daily",
118
+ Hourly = "hourly"
119
+ }
104
120
  export interface ListBlocks {
105
121
  /** @format int32 */
106
122
  total: number;
@@ -196,6 +212,7 @@ export interface Transaction {
196
212
  gasAmount: number;
197
213
  /** @format uint256 */
198
214
  gasPrice: string;
215
+ coinbase: boolean;
199
216
  }
200
217
  export declare type TransactionLike = ConfirmedTransaction | UnconfirmedTransaction;
201
218
  export interface Unauthorized {
@@ -218,6 +235,35 @@ export interface UnconfirmedTransaction {
218
235
  lastSeen: number;
219
236
  type: string;
220
237
  }
238
+ export declare type Val = ValAddress | ValArray | ValBool | ValByteVec | ValI256 | ValU256;
239
+ export interface ValAddress {
240
+ /** @format address */
241
+ value: string;
242
+ type: string;
243
+ }
244
+ export interface ValArray {
245
+ value: Val[];
246
+ type: string;
247
+ }
248
+ export interface ValBool {
249
+ value: boolean;
250
+ type: string;
251
+ }
252
+ export interface ValByteVec {
253
+ /** @format hex-string */
254
+ value: string;
255
+ type: string;
256
+ }
257
+ export interface ValI256 {
258
+ /** @format bigint */
259
+ value: string;
260
+ type: string;
261
+ }
262
+ export interface ValU256 {
263
+ /** @format uint256 */
264
+ value: string;
265
+ type: string;
266
+ }
221
267
  import 'cross-fetch/polyfill';
222
268
  export declare type QueryParamsType = Record<string | number, any>;
223
269
  export declare type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
@@ -324,14 +370,6 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
324
370
  * @request GET:/transactions/{transaction_hash}
325
371
  */
326
372
  getTransactionsTransactionHash: (transactionHash: string, params?: RequestParams) => Promise<ConfirmedTransaction | UnconfirmedTransaction>;
327
- /**
328
- * @description Get a transaction from a output reference key
329
- *
330
- * @tags Transactions
331
- * @name GetTransactionsByOutputRefKeyOutputRefKey
332
- * @request GET:/transactions/by/output-ref-key/{output_ref_key}
333
- */
334
- getTransactionsByOutputRefKeyOutputRefKey: (outputRefKey: string, params?: RequestParams) => Promise<Transaction>;
335
373
  };
336
374
  addresses: {
337
375
  /**
@@ -432,6 +470,14 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
432
470
  * @request GET:/addresses/{address}/tokens/{token_id}/balance
433
471
  */
434
472
  getAddressesAddressTokensTokenIdBalance: (address: string, tokenId: string, params?: RequestParams) => Promise<AddressBalance>;
473
+ /**
474
+ * @description Are the addresses used (at least 1 transaction)
475
+ *
476
+ * @tags Addresses, Addresses
477
+ * @name PostAddressesUsed
478
+ * @request POST:/addresses/used
479
+ */
480
+ postAddressesUsed: (data?: string[], params?: RequestParams) => Promise<boolean[]>;
435
481
  /**
436
482
  * No description
437
483
  *
@@ -444,16 +490,6 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
444
490
  toTs: number;
445
491
  }, params?: RequestParams) => Promise<string>;
446
492
  };
447
- addressesActive: {
448
- /**
449
- * @description Are the addresses active (at least 1 transaction)
450
- *
451
- * @tags Addresses
452
- * @name PostAddressesActive
453
- * @request POST:/addresses-active
454
- */
455
- postAddressesActive: (data?: string[], params?: RequestParams) => Promise<boolean[]>;
456
- };
457
493
  infos: {
458
494
  /**
459
495
  * @description Get explorer informations
@@ -584,7 +620,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
584
620
  getChartsHashrates: (query: {
585
621
  fromTs: number;
586
622
  toTs: number;
587
- 'interval-type': string;
623
+ 'interval-type': IntervalType;
588
624
  }, params?: RequestParams) => Promise<Hashrate[]>;
589
625
  /**
590
626
  * @description `interval-type` query param: hourly, daily
@@ -597,7 +633,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
597
633
  getChartsTransactionsCount: (query: {
598
634
  fromTs: number;
599
635
  toTs: number;
600
- 'interval-type': string;
636
+ 'interval-type': IntervalType;
601
637
  }, params?: RequestParams) => Promise<TimedCount[]>;
602
638
  /**
603
639
  * @description `interval-type` query param: hourly, daily
@@ -610,9 +646,43 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
610
646
  getChartsTransactionsCountPerChain: (query: {
611
647
  fromTs: number;
612
648
  toTs: number;
613
- 'interval-type': string;
649
+ 'interval-type': IntervalType;
614
650
  }, params?: RequestParams) => Promise<PerChainTimedCount[]>;
615
651
  };
652
+ contractEvents: {
653
+ /**
654
+ * @description Get contract events by transaction id
655
+ *
656
+ * @tags Contract events
657
+ * @name GetContractEventsTransactionIdTransactionId
658
+ * @request GET:/contract-events/transaction-id/{transaction_id}
659
+ */
660
+ getContractEventsTransactionIdTransactionId: (transactionId: string, params?: RequestParams) => Promise<Event[]>;
661
+ /**
662
+ * @description Get contract events by contract address
663
+ *
664
+ * @tags Contract events
665
+ * @name GetContractEventsContractAddressContractAddress
666
+ * @request GET:/contract-events/contract-address/{contract_address}
667
+ */
668
+ getContractEventsContractAddressContractAddress: (contractAddress: string, query?: {
669
+ page?: number;
670
+ limit?: number;
671
+ reverse?: boolean;
672
+ }, params?: RequestParams) => Promise<Event[]>;
673
+ /**
674
+ * @description Get contract events by contract and input addresses
675
+ *
676
+ * @tags Contract events
677
+ * @name GetContractEventsContractAddressContractAddressInputAddressInputAddress
678
+ * @request GET:/contract-events/contract-address/{contract_address}/input-address/{input_address}
679
+ */
680
+ getContractEventsContractAddressContractAddressInputAddressInputAddress: (contractAddress: string, inputAddress: string, query?: {
681
+ page?: number;
682
+ limit?: number;
683
+ reverse?: boolean;
684
+ }, params?: RequestParams) => Promise<Event[]>;
685
+ };
616
686
  utils: {
617
687
  /**
618
688
  * @description Perform a sanity check
@@ -10,7 +10,12 @@
10
10
  * ---------------------------------------------------------------
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.Api = exports.HttpClient = exports.ContentType = void 0;
13
+ exports.Api = exports.HttpClient = exports.ContentType = exports.IntervalType = void 0;
14
+ var IntervalType;
15
+ (function (IntervalType) {
16
+ IntervalType["Daily"] = "daily";
17
+ IntervalType["Hourly"] = "hourly";
18
+ })(IntervalType = exports.IntervalType || (exports.IntervalType = {}));
14
19
  require("cross-fetch/polyfill");
15
20
  const utils_1 = require("./utils");
16
21
  var ContentType;
@@ -210,19 +215,6 @@ class Api extends HttpClient {
210
215
  method: 'GET',
211
216
  format: 'json',
212
217
  ...params
213
- }).then(utils_1.convertHttpResponse),
214
- /**
215
- * @description Get a transaction from a output reference key
216
- *
217
- * @tags Transactions
218
- * @name GetTransactionsByOutputRefKeyOutputRefKey
219
- * @request GET:/transactions/by/output-ref-key/{output_ref_key}
220
- */
221
- getTransactionsByOutputRefKeyOutputRefKey: (outputRefKey, params = {}) => this.request({
222
- path: `/transactions/by/output-ref-key/${outputRefKey}`,
223
- method: 'GET',
224
- format: 'json',
225
- ...params
226
218
  }).then(utils_1.convertHttpResponse)
227
219
  };
228
220
  this.addresses = {
@@ -362,6 +354,21 @@ class Api extends HttpClient {
362
354
  format: 'json',
363
355
  ...params
364
356
  }).then(utils_1.convertHttpResponse),
357
+ /**
358
+ * @description Are the addresses used (at least 1 transaction)
359
+ *
360
+ * @tags Addresses, Addresses
361
+ * @name PostAddressesUsed
362
+ * @request POST:/addresses/used
363
+ */
364
+ postAddressesUsed: (data, params = {}) => this.request({
365
+ path: `/addresses/used`,
366
+ method: 'POST',
367
+ body: data,
368
+ type: ContentType.Json,
369
+ format: 'json',
370
+ ...params
371
+ }).then(utils_1.convertHttpResponse),
365
372
  /**
366
373
  * No description
367
374
  *
@@ -376,23 +383,6 @@ class Api extends HttpClient {
376
383
  ...params
377
384
  }).then(utils_1.convertHttpResponse)
378
385
  };
379
- this.addressesActive = {
380
- /**
381
- * @description Are the addresses active (at least 1 transaction)
382
- *
383
- * @tags Addresses
384
- * @name PostAddressesActive
385
- * @request POST:/addresses-active
386
- */
387
- postAddressesActive: (data, params = {}) => this.request({
388
- path: `/addresses-active`,
389
- method: 'POST',
390
- body: data,
391
- type: ContentType.Json,
392
- format: 'json',
393
- ...params
394
- }).then(utils_1.convertHttpResponse)
395
- };
396
386
  this.infos = {
397
387
  /**
398
388
  * @description Get explorer informations
@@ -601,6 +591,49 @@ class Api extends HttpClient {
601
591
  ...params
602
592
  }).then(utils_1.convertHttpResponse)
603
593
  };
594
+ this.contractEvents = {
595
+ /**
596
+ * @description Get contract events by transaction id
597
+ *
598
+ * @tags Contract events
599
+ * @name GetContractEventsTransactionIdTransactionId
600
+ * @request GET:/contract-events/transaction-id/{transaction_id}
601
+ */
602
+ getContractEventsTransactionIdTransactionId: (transactionId, params = {}) => this.request({
603
+ path: `/contract-events/transaction-id/${transactionId}`,
604
+ method: 'GET',
605
+ format: 'json',
606
+ ...params
607
+ }).then(utils_1.convertHttpResponse),
608
+ /**
609
+ * @description Get contract events by contract address
610
+ *
611
+ * @tags Contract events
612
+ * @name GetContractEventsContractAddressContractAddress
613
+ * @request GET:/contract-events/contract-address/{contract_address}
614
+ */
615
+ getContractEventsContractAddressContractAddress: (contractAddress, query, params = {}) => this.request({
616
+ path: `/contract-events/contract-address/${contractAddress}`,
617
+ method: 'GET',
618
+ query: query,
619
+ format: 'json',
620
+ ...params
621
+ }).then(utils_1.convertHttpResponse),
622
+ /**
623
+ * @description Get contract events by contract and input addresses
624
+ *
625
+ * @tags Contract events
626
+ * @name GetContractEventsContractAddressContractAddressInputAddressInputAddress
627
+ * @request GET:/contract-events/contract-address/{contract_address}/input-address/{input_address}
628
+ */
629
+ getContractEventsContractAddressContractAddressInputAddressInputAddress: (contractAddress, inputAddress, query, params = {}) => this.request({
630
+ path: `/contract-events/contract-address/${contractAddress}/input-address/${inputAddress}`,
631
+ method: 'GET',
632
+ query: query,
633
+ format: 'json',
634
+ ...params
635
+ }).then(utils_1.convertHttpResponse)
636
+ };
604
637
  this.utils = {
605
638
  /**
606
639
  * @description Perform a sanity check
@@ -27,7 +27,6 @@ export declare class ExplorerProvider {
27
27
  readonly blocks: any;
28
28
  readonly transactions: any;
29
29
  readonly addresses: any;
30
- readonly addressesActive: any;
31
30
  readonly infos: any;
32
31
  readonly unconfirmedTransactions: any;
33
32
  readonly tokens: any;
@@ -119,7 +119,6 @@ class ExplorerProvider {
119
119
  this.blocks = api_explorer_1.Api['blocks'];
120
120
  this.transactions = api_explorer_1.Api['transactions'];
121
121
  this.addresses = api_explorer_1.Api['addresses'];
122
- this.addressesActive = api_explorer_1.Api['addressesActive'];
123
122
  this.infos = api_explorer_1.Api['infos'];
124
123
  this.unconfirmedTransactions = api_explorer_1.Api['unconfirmedTransactions'];
125
124
  this.tokens = api_explorer_1.Api['tokens'];
@@ -142,7 +141,6 @@ class ExplorerProvider {
142
141
  this.blocks = { ...explorerApi.blocks };
143
142
  this.transactions = { ...explorerApi.transactions };
144
143
  this.addresses = { ...explorerApi.addresses };
145
- this.addressesActive = { ...explorerApi.addressesActive };
146
144
  this.infos = { ...explorerApi.infos };
147
145
  this.unconfirmedTransactions = { ...explorerApi.unconfirmedTransactions };
148
146
  this.tokens = { ...explorerApi.tokens };
@@ -5,7 +5,7 @@ export declare type EventSig = node.EventSig;
5
5
  export declare type FunctionSig = node.FunctionSig;
6
6
  export declare type Fields = NamedVals;
7
7
  export declare type Arguments = NamedVals;
8
- declare enum SourceType {
8
+ declare enum SourceKind {
9
9
  Contract = 0,
10
10
  Script = 1,
11
11
  AbstractContract = 2,
@@ -16,28 +16,29 @@ export declare type CompilerOptions = node.CompilerOptions & {
16
16
  };
17
17
  export declare const DEFAULT_NODE_COMPILER_OPTIONS: node.CompilerOptions;
18
18
  export declare const DEFAULT_COMPILER_OPTIONS: CompilerOptions;
19
- declare class TypedMatcher<T extends SourceType> {
19
+ declare class TypedMatcher<T extends SourceKind> {
20
20
  matcher: RegExp;
21
21
  type: T;
22
22
  constructor(pattern: string, type: T);
23
- match(str: string): number;
24
23
  }
25
- declare class SourceFile {
26
- type: SourceType;
27
- contractPath: string;
24
+ declare class SourceInfo {
25
+ type: SourceKind;
26
+ name: string;
27
+ contractRelativePath: string;
28
28
  sourceCode: string;
29
29
  sourceCodeHash: string;
30
30
  getArtifactPath(artifactsRootDir: string): string;
31
- constructor(type: SourceType, sourceCode: string, sourceCodeHash: string, contractPath: string);
32
- static from(type: SourceType, sourceCode: string, contractPath: string): Promise<SourceFile>;
31
+ constructor(type: SourceKind, name: string, sourceCode: string, sourceCodeHash: string, contractRelativePath: string);
32
+ static from(type: SourceKind, name: string, sourceCode: string, contractRelativePath: string): Promise<SourceInfo>;
33
33
  }
34
34
  declare class Compiled<T extends Artifact> {
35
- sourceFile: SourceFile;
35
+ sourceInfo: SourceInfo;
36
36
  artifact: T;
37
37
  warnings: string[];
38
- constructor(sourceFile: SourceFile, artifact: T, warnings: string[]);
38
+ constructor(sourceInfo: SourceInfo, artifact: T, warnings: string[]);
39
39
  }
40
40
  declare type CodeInfo = {
41
+ sourceFile: string;
41
42
  sourceCodeHash: string;
42
43
  bytecodeDebugPatch: string;
43
44
  codeHashDebug: string;
@@ -50,25 +51,24 @@ declare class ProjectArtifact {
50
51
  static checkCompilerOptionsParameter(compilerOptions: node.CompilerOptions): void;
51
52
  constructor(compilerOptionsUsed: node.CompilerOptions, infos: Map<string, CodeInfo>);
52
53
  saveToFile(rootPath: string): Promise<void>;
53
- needToReCompile(compilerOptions: node.CompilerOptions, files: SourceFile[]): boolean;
54
+ needToReCompile(compilerOptions: node.CompilerOptions, sourceInfos: SourceInfo[]): boolean;
54
55
  static from(rootPath: string): Promise<ProjectArtifact | undefined>;
55
56
  }
56
57
  export declare class Project {
57
- sourceFiles: SourceFile[];
58
- contracts: Compiled<Contract>[];
59
- scripts: Compiled<Script>[];
58
+ sourceInfos: SourceInfo[];
59
+ contracts: Map<string, Compiled<Contract>>;
60
+ scripts: Map<string, Compiled<Script>>;
60
61
  projectArtifact: ProjectArtifact;
61
62
  readonly contractsRootDir: string;
62
63
  readonly artifactsRootDir: string;
63
64
  static currentProject: Project;
64
- static readonly abstractContractMatcher: TypedMatcher<SourceType>;
65
- static readonly contractMatcher: TypedMatcher<SourceType.Contract>;
66
- static readonly interfaceMatcher: TypedMatcher<SourceType.Interface>;
67
- static readonly scriptMatcher: TypedMatcher<SourceType.Script>;
68
- static readonly matchers: TypedMatcher<SourceType>[];
69
- static buildProjectArtifact(sourceFiles: SourceFile[], contracts: Compiled<Contract>[], scripts: Compiled<Script>[], compilerOptions: node.CompilerOptions): ProjectArtifact;
65
+ static readonly abstractContractMatcher: TypedMatcher<SourceKind>;
66
+ static readonly contractMatcher: TypedMatcher<SourceKind.Contract>;
67
+ static readonly interfaceMatcher: TypedMatcher<SourceKind.Interface>;
68
+ static readonly scriptMatcher: TypedMatcher<SourceKind.Script>;
69
+ static readonly matchers: TypedMatcher<SourceKind>[];
70
+ static buildProjectArtifact(sourceInfos: SourceInfo[], contracts: Map<string, Compiled<Contract>>, scripts: Map<string, Compiled<Script>>, compilerOptions: node.CompilerOptions): ProjectArtifact;
70
71
  private constructor();
71
- private getContractPath;
72
72
  static checkCompilerWarnings(warnings: string[], errorOnWarnings: boolean): void;
73
73
  static contract(name: string): Contract;
74
74
  static script(name: string): Script;