@alephium/web3 2.0.0-rc.3 → 2.0.1

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.
@@ -131,6 +131,7 @@ export interface BlockEntry {
131
131
  /** @format hex-string */
132
132
  target: string;
133
133
  ghostUncles: GhostUncleBlockEntry[];
134
+ conflictedTxs?: string[];
134
135
  }
135
136
  /** BlockHeaderEntry */
136
137
  export interface BlockHeaderEntry {
@@ -575,6 +576,7 @@ export interface CompileProjectResult {
575
576
  constants?: Constant[];
576
577
  enums?: Enum[];
577
578
  warnings?: string[];
579
+ testError?: string;
578
580
  }
579
581
  /** CompileScriptResult */
580
582
  export interface CompileScriptResult {
@@ -612,6 +614,20 @@ export interface Confirmed {
612
614
  toGroupConfirmations: number;
613
615
  type: string;
614
616
  }
617
+ /** Conflicted */
618
+ export interface Conflicted {
619
+ /** @format block-hash */
620
+ blockHash: string;
621
+ /** @format int32 */
622
+ txIndex: number;
623
+ /** @format int32 */
624
+ chainConfirmations: number;
625
+ /** @format int32 */
626
+ fromGroupConfirmations: number;
627
+ /** @format int32 */
628
+ toGroupConfirmations: number;
629
+ type: string;
630
+ }
615
631
  /** Constant */
616
632
  export interface Constant {
617
633
  name: string;
@@ -992,6 +1008,7 @@ export interface RichBlockEntry {
992
1008
  /** @format hex-string */
993
1009
  target: string;
994
1010
  ghostUncles: GhostUncleBlockEntry[];
1011
+ conflictedTxs?: string[];
995
1012
  }
996
1013
  /** RichBlocksAndEventsPerTimeStampRange */
997
1014
  export interface RichBlocksAndEventsPerTimeStampRange {
@@ -1241,7 +1258,7 @@ export interface TxNotFound {
1241
1258
  type: string;
1242
1259
  }
1243
1260
  /** TxStatus */
1244
- export type TxStatus = Confirmed | MemPooled | TxNotFound;
1261
+ export type TxStatus = Confirmed | Conflicted | MemPooled | TxNotFound;
1245
1262
  /** UTXO */
1246
1263
  export interface UTXO {
1247
1264
  ref: OutputRef;
@@ -1427,7 +1444,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
1427
1444
  }
1428
1445
  /**
1429
1446
  * @title Alephium API
1430
- * @version 4.0.0
1447
+ * @version 4.2.3
1431
1448
  * @baseUrl ../
1432
1449
  */
1433
1450
  export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
@@ -1923,7 +1940,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1923
1940
  * @summary Get the UTXOs of an address
1924
1941
  * @request GET:/addresses/{address}/utxos
1925
1942
  */
1926
- getAddressesAddressUtxos: (address: string, params?: RequestParams) => Promise<UTXOs>;
1943
+ getAddressesAddressUtxos: (address: string, query?: {
1944
+ 'error-if-exceed-max-utxos'?: boolean;
1945
+ }, params?: RequestParams) => Promise<UTXOs>;
1927
1946
  /**
1928
1947
  * No description
1929
1948
  *
@@ -2046,7 +2065,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
2046
2065
  fromGroup?: number;
2047
2066
  /** @format int32 */
2048
2067
  toGroup?: number;
2049
- }, params?: RequestParams) => Promise<Confirmed | MemPooled | TxNotFound>;
2068
+ }, params?: RequestParams) => Promise<Confirmed | Conflicted | MemPooled | TxNotFound>;
2050
2069
  /**
2051
2070
  * No description
2052
2071
  *
@@ -151,7 +151,7 @@ class HttpClient {
151
151
  exports.HttpClient = HttpClient;
152
152
  /**
153
153
  * @title Alephium API
154
- * @version 4.0.0
154
+ * @version 4.2.3
155
155
  * @baseUrl ../
156
156
  */
157
157
  class Api extends HttpClient {
@@ -829,9 +829,10 @@ class Api extends HttpClient {
829
829
  * @summary Get the UTXOs of an address
830
830
  * @request GET:/addresses/{address}/utxos
831
831
  */
832
- getAddressesAddressUtxos: (address, params = {}) => this.request({
832
+ getAddressesAddressUtxos: (address, query, params = {}) => this.request({
833
833
  path: `/addresses/${address}/utxos`,
834
834
  method: 'GET',
835
+ query: query,
835
836
  format: 'json',
836
837
  ...params
837
838
  }).then(utils_1.convertHttpResponse),
@@ -59,7 +59,7 @@ necc.utils.hmacSha256Sync = (key, ...messages) => {
59
59
  };
60
60
  function checkKeyType(keyType) {
61
61
  if (keyType !== 'default' && keyType !== 'bip340-schnorr' && keyType !== 'gl-secp256k1') {
62
- throw new Error(`Invalid key type ${keyType}`);
62
+ throw new Error(`Invalid key type ${keyType}, only supports secp256k1 and schnorr for now`);
63
63
  }
64
64
  }
65
65
  // hash has to be 32 bytes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alephium/web3",
3
- "version": "2.0.0-rc.3",
3
+ "version": "2.0.1",
4
4
  "description": "A JS/TS library to interact with the Alephium platform",
5
5
  "license": "GPL",
6
6
  "main": "dist/src/index.js",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "author": "Alephium dev <dev@alephium.org>",
35
35
  "config": {
36
- "alephium_version": "4.0.0",
36
+ "alephium_version": "4.2.3",
37
37
  "explorer_backend_version": "2.3.2"
38
38
  },
39
39
  "type": "commonjs",
@@ -155,6 +155,7 @@ export interface BlockEntry {
155
155
  /** @format hex-string */
156
156
  target: string
157
157
  ghostUncles: GhostUncleBlockEntry[]
158
+ conflictedTxs?: string[]
158
159
  }
159
160
 
160
161
  /** BlockHeaderEntry */
@@ -645,6 +646,7 @@ export interface CompileProjectResult {
645
646
  constants?: Constant[]
646
647
  enums?: Enum[]
647
648
  warnings?: string[]
649
+ testError?: string
648
650
  }
649
651
 
650
652
  /** CompileScriptResult */
@@ -686,6 +688,21 @@ export interface Confirmed {
686
688
  type: string
687
689
  }
688
690
 
691
+ /** Conflicted */
692
+ export interface Conflicted {
693
+ /** @format block-hash */
694
+ blockHash: string
695
+ /** @format int32 */
696
+ txIndex: number
697
+ /** @format int32 */
698
+ chainConfirmations: number
699
+ /** @format int32 */
700
+ fromGroupConfirmations: number
701
+ /** @format int32 */
702
+ toGroupConfirmations: number
703
+ type: string
704
+ }
705
+
689
706
  /** Constant */
690
707
  export interface Constant {
691
708
  name: string
@@ -1121,6 +1138,7 @@ export interface RichBlockEntry {
1121
1138
  /** @format hex-string */
1122
1139
  target: string
1123
1140
  ghostUncles: GhostUncleBlockEntry[]
1141
+ conflictedTxs?: string[]
1124
1142
  }
1125
1143
 
1126
1144
  /** RichBlocksAndEventsPerTimeStampRange */
@@ -1400,7 +1418,7 @@ export interface TxNotFound {
1400
1418
  }
1401
1419
 
1402
1420
  /** TxStatus */
1403
- export type TxStatus = Confirmed | MemPooled | TxNotFound
1421
+ export type TxStatus = Confirmed | Conflicted | MemPooled | TxNotFound
1404
1422
 
1405
1423
  /** UTXO */
1406
1424
  export interface UTXO {
@@ -1760,7 +1778,7 @@ export class HttpClient<SecurityDataType = unknown> {
1760
1778
 
1761
1779
  /**
1762
1780
  * @title Alephium API
1763
- * @version 4.0.0
1781
+ * @version 4.2.3
1764
1782
  * @baseUrl ../
1765
1783
  */
1766
1784
  export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
@@ -2770,13 +2788,20 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2770
2788
  * @summary Get the UTXOs of an address
2771
2789
  * @request GET:/addresses/{address}/utxos
2772
2790
  */
2773
- getAddressesAddressUtxos: (address: string, params: RequestParams = {}) =>
2791
+ getAddressesAddressUtxos: (
2792
+ address: string,
2793
+ query?: {
2794
+ 'error-if-exceed-max-utxos'?: boolean
2795
+ },
2796
+ params: RequestParams = {}
2797
+ ) =>
2774
2798
  this.request<
2775
2799
  UTXOs,
2776
2800
  BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable | GatewayTimeout
2777
2801
  >({
2778
2802
  path: `/addresses/${address}/utxos`,
2779
2803
  method: 'GET',
2804
+ query: query,
2780
2805
  format: 'json',
2781
2806
  ...params
2782
2807
  }).then(convertHttpResponse),
package/src/utils/sign.ts CHANGED
@@ -38,7 +38,7 @@ necc.utils.hmacSha256Sync = (key: Uint8Array, ...messages: Uint8Array[]): Uint8A
38
38
 
39
39
  function checkKeyType(keyType: KeyType) {
40
40
  if (keyType !== 'default' && keyType !== 'bip340-schnorr' && keyType !== 'gl-secp256k1') {
41
- throw new Error(`Invalid key type ${keyType}`)
41
+ throw new Error(`Invalid key type ${keyType}, only supports secp256k1 and schnorr for now`)
42
42
  }
43
43
  }
44
44