@alephium/web3 0.28.1 → 0.29.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.
- package/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/api/api-alephium.d.ts +29 -1
- package/dist/src/api/api-alephium.js +17 -1
- package/dist/src/api/api-explorer.d.ts +59 -2
- package/dist/src/api/api-explorer.js +48 -0
- package/dist/src/api/explorer-provider.d.ts +1 -0
- package/dist/src/api/explorer-provider.js +1 -0
- package/dist/src/api/node-provider.js +1 -0
- package/dist/src/api/types.d.ts +1 -0
- package/dist/src/api/types.js +33 -2
- package/dist/src/contract/contract.d.ts +1 -0
- package/dist/src/debug.d.ts +3 -0
- package/dist/src/debug.js +33 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/signer/types.d.ts +1 -0
- package/package.json +3 -3
- package/src/api/api-alephium.ts +43 -1
- package/src/api/api-explorer.ts +99 -2
- package/src/api/explorer-provider.ts +2 -0
- package/src/api/node-provider.ts +3 -1
- package/src/api/types.ts +32 -1
- package/src/contract/contract.ts +1 -0
- package/src/debug.ts +31 -0
- package/src/index.ts +1 -0
- package/src/signer/types.ts +1 -0
|
@@ -157,6 +157,8 @@ export interface BuildDeployContractTx {
|
|
|
157
157
|
initialTokenAmounts?: Token[];
|
|
158
158
|
/** @format uint256 */
|
|
159
159
|
issueTokenAmount?: string;
|
|
160
|
+
/** @format address */
|
|
161
|
+
issueTokenTo?: string;
|
|
160
162
|
/** @format gas */
|
|
161
163
|
gasAmount?: number;
|
|
162
164
|
/** @format uint256 */
|
|
@@ -213,6 +215,13 @@ export interface BuildInfo {
|
|
|
213
215
|
releaseVersion: string;
|
|
214
216
|
commit: string;
|
|
215
217
|
}
|
|
218
|
+
export interface BuildMultiAddressesTransaction {
|
|
219
|
+
from: Source[];
|
|
220
|
+
/** @format uint256 */
|
|
221
|
+
gasPrice?: string;
|
|
222
|
+
/** @format block-hash */
|
|
223
|
+
targetBlockHash?: string;
|
|
224
|
+
}
|
|
216
225
|
export interface BuildMultisig {
|
|
217
226
|
/** @format address */
|
|
218
227
|
fromAddress: string;
|
|
@@ -670,6 +679,16 @@ export interface SignResult {
|
|
|
670
679
|
/** @format signature */
|
|
671
680
|
signature: string;
|
|
672
681
|
}
|
|
682
|
+
export interface Source {
|
|
683
|
+
/** @format hex-string */
|
|
684
|
+
fromPublicKey: string;
|
|
685
|
+
destinations: Destination[];
|
|
686
|
+
/** @format hex-string */
|
|
687
|
+
fromPublicKeyType?: string;
|
|
688
|
+
/** @format gas */
|
|
689
|
+
gasAmount?: number;
|
|
690
|
+
utxos?: OutputRef[];
|
|
691
|
+
}
|
|
673
692
|
export interface SubmitMultisig {
|
|
674
693
|
unsignedTx: string;
|
|
675
694
|
signatures: string[];
|
|
@@ -963,7 +982,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
963
982
|
}
|
|
964
983
|
/**
|
|
965
984
|
* @title Alephium API
|
|
966
|
-
* @version 2.
|
|
985
|
+
* @version 2.8.0
|
|
967
986
|
* @baseUrl ../
|
|
968
987
|
*/
|
|
969
988
|
export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
@@ -1431,6 +1450,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1431
1450
|
* @request POST:/transactions/build
|
|
1432
1451
|
*/
|
|
1433
1452
|
postTransactionsBuild: (data: BuildTransaction, params?: RequestParams) => Promise<BuildTransactionResult>;
|
|
1453
|
+
/**
|
|
1454
|
+
* No description
|
|
1455
|
+
*
|
|
1456
|
+
* @tags Transactions
|
|
1457
|
+
* @name PostTransactionsBuildMultiAddresses
|
|
1458
|
+
* @summary Build an unsigned transaction with multiple addresses to a number of recipients
|
|
1459
|
+
* @request POST:/transactions/build-multi-addresses
|
|
1460
|
+
*/
|
|
1461
|
+
postTransactionsBuildMultiAddresses: (data: BuildMultiAddressesTransaction, params?: RequestParams) => Promise<BuildTransactionResult>;
|
|
1434
1462
|
/**
|
|
1435
1463
|
* No description
|
|
1436
1464
|
*
|
|
@@ -151,7 +151,7 @@ class HttpClient {
|
|
|
151
151
|
exports.HttpClient = HttpClient;
|
|
152
152
|
/**
|
|
153
153
|
* @title Alephium API
|
|
154
|
-
* @version 2.
|
|
154
|
+
* @version 2.8.0
|
|
155
155
|
* @baseUrl ../
|
|
156
156
|
*/
|
|
157
157
|
class Api extends HttpClient {
|
|
@@ -811,6 +811,22 @@ class Api extends HttpClient {
|
|
|
811
811
|
format: 'json',
|
|
812
812
|
...params
|
|
813
813
|
}).then(utils_1.convertHttpResponse),
|
|
814
|
+
/**
|
|
815
|
+
* No description
|
|
816
|
+
*
|
|
817
|
+
* @tags Transactions
|
|
818
|
+
* @name PostTransactionsBuildMultiAddresses
|
|
819
|
+
* @summary Build an unsigned transaction with multiple addresses to a number of recipients
|
|
820
|
+
* @request POST:/transactions/build-multi-addresses
|
|
821
|
+
*/
|
|
822
|
+
postTransactionsBuildMultiAddresses: (data, params = {}) => this.request({
|
|
823
|
+
path: `/transactions/build-multi-addresses`,
|
|
824
|
+
method: 'POST',
|
|
825
|
+
body: data,
|
|
826
|
+
type: ContentType.Json,
|
|
827
|
+
format: 'json',
|
|
828
|
+
...params
|
|
829
|
+
}).then(utils_1.convertHttpResponse),
|
|
814
830
|
/**
|
|
815
831
|
* No description
|
|
816
832
|
*
|
|
@@ -37,6 +37,9 @@ export interface AddressTokenBalance {
|
|
|
37
37
|
/** @format uint256 */
|
|
38
38
|
lockedBalance: string;
|
|
39
39
|
}
|
|
40
|
+
export interface AmountHistory {
|
|
41
|
+
amountHistory?: TimedAmount[];
|
|
42
|
+
}
|
|
40
43
|
export interface AssetOutput {
|
|
41
44
|
/** @format int32 */
|
|
42
45
|
hint: number;
|
|
@@ -145,7 +148,8 @@ export interface InternalServerError {
|
|
|
145
148
|
}
|
|
146
149
|
export declare enum IntervalType {
|
|
147
150
|
Daily = "daily",
|
|
148
|
-
Hourly = "hourly"
|
|
151
|
+
Hourly = "hourly",
|
|
152
|
+
Weekly = "weekly"
|
|
149
153
|
}
|
|
150
154
|
export interface ListBlocks {
|
|
151
155
|
/** @format int32 */
|
|
@@ -253,12 +257,22 @@ export interface ServiceUnavailable {
|
|
|
253
257
|
export interface SubContracts {
|
|
254
258
|
subContracts?: string[];
|
|
255
259
|
}
|
|
260
|
+
export interface TimedAmount {
|
|
261
|
+
/** @format int64 */
|
|
262
|
+
timestamp: number;
|
|
263
|
+
/** @format bigint */
|
|
264
|
+
amount: string;
|
|
265
|
+
}
|
|
256
266
|
export interface TimedCount {
|
|
257
267
|
/** @format int64 */
|
|
258
268
|
timestamp: number;
|
|
259
269
|
/** @format int64 */
|
|
260
270
|
totalCountAllChains: number;
|
|
261
271
|
}
|
|
272
|
+
export interface TimedPrices {
|
|
273
|
+
timestamps?: number[];
|
|
274
|
+
prices?: number[];
|
|
275
|
+
}
|
|
262
276
|
export interface Token {
|
|
263
277
|
/** @format 32-byte-hash */
|
|
264
278
|
id: string;
|
|
@@ -662,6 +676,27 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
662
676
|
*/
|
|
663
677
|
toTs: number;
|
|
664
678
|
}, params?: RequestParams) => Promise<string>;
|
|
679
|
+
/**
|
|
680
|
+
* No description
|
|
681
|
+
*
|
|
682
|
+
* @tags Addresses
|
|
683
|
+
* @name GetAddressesAddressAmountHistoryDeprecated
|
|
684
|
+
* @request GET:/addresses/{address}/amount-history-DEPRECATED
|
|
685
|
+
* @deprecated
|
|
686
|
+
*/
|
|
687
|
+
getAddressesAddressAmountHistoryDeprecated: (address: string, query: {
|
|
688
|
+
/**
|
|
689
|
+
* @format int64
|
|
690
|
+
* @min 0
|
|
691
|
+
*/
|
|
692
|
+
fromTs: number;
|
|
693
|
+
/**
|
|
694
|
+
* @format int64
|
|
695
|
+
* @min 0
|
|
696
|
+
*/
|
|
697
|
+
toTs: number;
|
|
698
|
+
'interval-type': IntervalType;
|
|
699
|
+
}, params?: RequestParams) => Promise<string>;
|
|
665
700
|
/**
|
|
666
701
|
* No description
|
|
667
702
|
*
|
|
@@ -681,7 +716,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
681
716
|
*/
|
|
682
717
|
toTs: number;
|
|
683
718
|
'interval-type': IntervalType;
|
|
684
|
-
}, params?: RequestParams) => Promise<
|
|
719
|
+
}, params?: RequestParams) => Promise<AmountHistory>;
|
|
685
720
|
};
|
|
686
721
|
infos: {
|
|
687
722
|
/**
|
|
@@ -1008,6 +1043,28 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1008
1043
|
limit?: number;
|
|
1009
1044
|
}, params?: RequestParams) => Promise<SubContracts>;
|
|
1010
1045
|
};
|
|
1046
|
+
market: {
|
|
1047
|
+
/**
|
|
1048
|
+
* No description
|
|
1049
|
+
*
|
|
1050
|
+
* @tags Market
|
|
1051
|
+
* @name PostMarketPrices
|
|
1052
|
+
* @request POST:/market/prices
|
|
1053
|
+
*/
|
|
1054
|
+
postMarketPrices: (query: {
|
|
1055
|
+
currency: string;
|
|
1056
|
+
}, data?: string[], params?: RequestParams) => Promise<number[]>;
|
|
1057
|
+
/**
|
|
1058
|
+
* No description
|
|
1059
|
+
*
|
|
1060
|
+
* @tags Market
|
|
1061
|
+
* @name GetMarketPricesSymbolCharts
|
|
1062
|
+
* @request GET:/market/prices/{symbol}/charts
|
|
1063
|
+
*/
|
|
1064
|
+
getMarketPricesSymbolCharts: (symbol: string, query: {
|
|
1065
|
+
currency: string;
|
|
1066
|
+
}, params?: RequestParams) => Promise<TimedPrices>;
|
|
1067
|
+
};
|
|
1011
1068
|
utils: {
|
|
1012
1069
|
/**
|
|
1013
1070
|
* @description Perform a sanity check
|
|
@@ -15,6 +15,7 @@ var IntervalType;
|
|
|
15
15
|
(function (IntervalType) {
|
|
16
16
|
IntervalType["Daily"] = "daily";
|
|
17
17
|
IntervalType["Hourly"] = "hourly";
|
|
18
|
+
IntervalType["Weekly"] = "weekly";
|
|
18
19
|
})(IntervalType = exports.IntervalType || (exports.IntervalType = {}));
|
|
19
20
|
var TokenStdInterfaceId;
|
|
20
21
|
(function (TokenStdInterfaceId) {
|
|
@@ -415,6 +416,21 @@ class Api extends HttpClient {
|
|
|
415
416
|
format: 'text',
|
|
416
417
|
...params
|
|
417
418
|
}).then(utils_1.convertHttpResponse),
|
|
419
|
+
/**
|
|
420
|
+
* No description
|
|
421
|
+
*
|
|
422
|
+
* @tags Addresses
|
|
423
|
+
* @name GetAddressesAddressAmountHistoryDeprecated
|
|
424
|
+
* @request GET:/addresses/{address}/amount-history-DEPRECATED
|
|
425
|
+
* @deprecated
|
|
426
|
+
*/
|
|
427
|
+
getAddressesAddressAmountHistoryDeprecated: (address, query, params = {}) => this.request({
|
|
428
|
+
path: `/addresses/${address}/amount-history-DEPRECATED`,
|
|
429
|
+
method: 'GET',
|
|
430
|
+
query: query,
|
|
431
|
+
format: 'json',
|
|
432
|
+
...params
|
|
433
|
+
}).then(utils_1.convertHttpResponse),
|
|
418
434
|
/**
|
|
419
435
|
* No description
|
|
420
436
|
*
|
|
@@ -775,6 +791,38 @@ class Api extends HttpClient {
|
|
|
775
791
|
...params
|
|
776
792
|
}).then(utils_1.convertHttpResponse)
|
|
777
793
|
};
|
|
794
|
+
this.market = {
|
|
795
|
+
/**
|
|
796
|
+
* No description
|
|
797
|
+
*
|
|
798
|
+
* @tags Market
|
|
799
|
+
* @name PostMarketPrices
|
|
800
|
+
* @request POST:/market/prices
|
|
801
|
+
*/
|
|
802
|
+
postMarketPrices: (query, data, params = {}) => this.request({
|
|
803
|
+
path: `/market/prices`,
|
|
804
|
+
method: 'POST',
|
|
805
|
+
query: query,
|
|
806
|
+
body: data,
|
|
807
|
+
type: ContentType.Json,
|
|
808
|
+
format: 'json',
|
|
809
|
+
...params
|
|
810
|
+
}).then(utils_1.convertHttpResponse),
|
|
811
|
+
/**
|
|
812
|
+
* No description
|
|
813
|
+
*
|
|
814
|
+
* @tags Market
|
|
815
|
+
* @name GetMarketPricesSymbolCharts
|
|
816
|
+
* @request GET:/market/prices/{symbol}/charts
|
|
817
|
+
*/
|
|
818
|
+
getMarketPricesSymbolCharts: (symbol, query, params = {}) => this.request({
|
|
819
|
+
path: `/market/prices/${symbol}/charts`,
|
|
820
|
+
method: 'GET',
|
|
821
|
+
query: query,
|
|
822
|
+
format: 'json',
|
|
823
|
+
...params
|
|
824
|
+
}).then(utils_1.convertHttpResponse)
|
|
825
|
+
};
|
|
778
826
|
this.utils = {
|
|
779
827
|
/**
|
|
780
828
|
* @description Perform a sanity check
|
|
@@ -10,6 +10,7 @@ export declare class ExplorerProvider {
|
|
|
10
10
|
readonly charts: ExplorerApi<string>['charts'];
|
|
11
11
|
readonly contractEvents: ExplorerApi<string>['contractEvents'];
|
|
12
12
|
readonly contracts: ExplorerApi<string>['contracts'];
|
|
13
|
+
readonly market: ExplorerApi<string>['market'];
|
|
13
14
|
readonly utils: ExplorerApi<string>['utils'];
|
|
14
15
|
constructor(baseUrl: string, apiKey?: string, customFetch?: typeof fetch);
|
|
15
16
|
constructor(provider: ExplorerProvider);
|
|
@@ -55,6 +55,7 @@ class ExplorerProvider {
|
|
|
55
55
|
this.charts = { ...explorerApi.charts };
|
|
56
56
|
this.utils = { ...explorerApi.utils };
|
|
57
57
|
this.contracts = { ...explorerApi.contracts };
|
|
58
|
+
this.market = { ...explorerApi.market };
|
|
58
59
|
this.contractEvents = { ...explorerApi.contractEvents };
|
|
59
60
|
}
|
|
60
61
|
// This can prevent the proxied explorer provider from being modified
|
|
@@ -160,6 +160,7 @@ class NodeProvider {
|
|
|
160
160
|
this.utils = { ...nodeApi.utils };
|
|
161
161
|
this.miners = { ...nodeApi.miners };
|
|
162
162
|
this.events = { ...nodeApi.events };
|
|
163
|
+
(0, types_1.requestWithLog)(this);
|
|
163
164
|
}
|
|
164
165
|
// This can prevent the proxied node provider from being modified
|
|
165
166
|
static Proxy(nodeProvider) {
|
package/dist/src/api/types.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface ApiRequestArguments {
|
|
|
30
30
|
}
|
|
31
31
|
export type ApiRequestHandler = (args: ApiRequestArguments) => Promise<any>;
|
|
32
32
|
export declare function forwardRequests(api: Record<string, any>, handler: ApiRequestHandler): void;
|
|
33
|
+
export declare function requestWithLog(api: Record<string, any>): void;
|
|
33
34
|
export declare function request(provider: Record<string, any>, args: ApiRequestArguments): Promise<any>;
|
|
34
35
|
export declare enum StdInterfaceIds {
|
|
35
36
|
FungibleToken = "0001",
|
package/dist/src/api/types.js
CHANGED
|
@@ -17,8 +17,9 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with the library. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.StdInterfaceIds = exports.request = exports.forwardRequests = exports.typeLength = exports.getDefaultValue = exports.fromApiVal = exports.fromApiArray = exports.fromApiVals = exports.toApiVal = exports.toApiArray = exports.toApiAddress = exports.toApiByteVec = exports.fromApiNumber256 = exports.toApiNumber256Optional = exports.toApiNumber256 = exports.toApiBoolean = exports.fromApiTokens = exports.fromApiToken = exports.toApiTokens = exports.toApiToken = void 0;
|
|
20
|
+
exports.StdInterfaceIds = exports.request = exports.requestWithLog = exports.forwardRequests = exports.typeLength = exports.getDefaultValue = exports.fromApiVal = exports.fromApiArray = exports.fromApiVals = exports.toApiVal = exports.toApiArray = exports.toApiAddress = exports.toApiByteVec = exports.fromApiNumber256 = exports.toApiNumber256Optional = exports.toApiNumber256 = exports.toApiBoolean = exports.fromApiTokens = exports.fromApiToken = exports.toApiTokens = exports.toApiToken = void 0;
|
|
21
21
|
const constants_1 = require("../constants");
|
|
22
|
+
const debug_1 = require("../debug");
|
|
22
23
|
const utils_1 = require("../utils");
|
|
23
24
|
utils_1.assertType;
|
|
24
25
|
function toApiToken(token) {
|
|
@@ -263,17 +264,47 @@ function typeLength(tpe) {
|
|
|
263
264
|
return dims.reduce((a, b) => a * b);
|
|
264
265
|
}
|
|
265
266
|
exports.typeLength = typeLength;
|
|
267
|
+
async function call(args, handler) {
|
|
268
|
+
const debugModeEnabled = (0, debug_1.isDebugModeEnabled)();
|
|
269
|
+
const { path, method, params } = args;
|
|
270
|
+
if (debugModeEnabled) {
|
|
271
|
+
console.log(`[REQUEST] ${path} ${method} ${JSON.stringify(params)}`);
|
|
272
|
+
}
|
|
273
|
+
try {
|
|
274
|
+
const response = await handler(args);
|
|
275
|
+
if (debugModeEnabled) {
|
|
276
|
+
console.log(`[RESPONSE] ${path} ${method} ${JSON.stringify(response)}`);
|
|
277
|
+
}
|
|
278
|
+
return response;
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
if (debugModeEnabled) {
|
|
282
|
+
console.error(`[ERROR] ${path} ${method} `, error);
|
|
283
|
+
}
|
|
284
|
+
throw error;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
266
287
|
function forwardRequests(api, handler) {
|
|
267
288
|
// Update class properties to forward requests
|
|
268
289
|
for (const [path, pathObject] of Object.entries(api)) {
|
|
269
290
|
for (const method of Object.keys(pathObject)) {
|
|
270
291
|
pathObject[`${method}`] = async (...params) => {
|
|
271
|
-
return
|
|
292
|
+
return call({ path, method, params }, handler);
|
|
272
293
|
};
|
|
273
294
|
}
|
|
274
295
|
}
|
|
275
296
|
}
|
|
276
297
|
exports.forwardRequests = forwardRequests;
|
|
298
|
+
function requestWithLog(api) {
|
|
299
|
+
for (const [path, pathObject] of Object.entries(api)) {
|
|
300
|
+
for (const [method, handler] of Object.entries(pathObject)) {
|
|
301
|
+
pathObject[`${method}`] = async (...params) => {
|
|
302
|
+
return call({ path, method, params }, () => handler(...params));
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
exports.requestWithLog = requestWithLog;
|
|
277
308
|
async function request(provider, args) {
|
|
278
309
|
const call = provider[`${args.path}`][`${args.method}`];
|
|
279
310
|
return call(...args.params);
|
|
@@ -224,6 +224,7 @@ export interface DeployContractParams<P extends Fields = Fields> {
|
|
|
224
224
|
initialAttoAlphAmount?: Number256;
|
|
225
225
|
initialTokenAmounts?: Token[];
|
|
226
226
|
issueTokenAmount?: Number256;
|
|
227
|
+
issueTokenTo?: string;
|
|
227
228
|
gasAmount?: number;
|
|
228
229
|
gasPrice?: Number256;
|
|
229
230
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2018 - 2022 The Alephium Authors
|
|
4
|
+
This file is part of the alephium project.
|
|
5
|
+
|
|
6
|
+
The library is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
The library is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Lesser General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
along with the library. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.disableDebugMode = exports.enableDebugMode = exports.isDebugModeEnabled = void 0;
|
|
21
|
+
let debugModeEnabled = false;
|
|
22
|
+
function isDebugModeEnabled() {
|
|
23
|
+
return debugModeEnabled;
|
|
24
|
+
}
|
|
25
|
+
exports.isDebugModeEnabled = isDebugModeEnabled;
|
|
26
|
+
function enableDebugMode() {
|
|
27
|
+
debugModeEnabled = true;
|
|
28
|
+
}
|
|
29
|
+
exports.enableDebugMode = enableDebugMode;
|
|
30
|
+
function disableDebugMode() {
|
|
31
|
+
debugModeEnabled = false;
|
|
32
|
+
}
|
|
33
|
+
exports.disableDebugMode = disableDebugMode;
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alephium/web3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.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",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"author": "Alephium dev <dev@alephium.org>",
|
|
29
29
|
"config": {
|
|
30
|
-
"alephium_version": "2.
|
|
31
|
-
"explorer_backend_version": "1.16.
|
|
30
|
+
"alephium_version": "2.8.0",
|
|
31
|
+
"explorer_backend_version": "1.16.1"
|
|
32
32
|
},
|
|
33
33
|
"type": "commonjs",
|
|
34
34
|
"dependencies": {
|
package/src/api/api-alephium.ts
CHANGED
|
@@ -185,6 +185,8 @@ export interface BuildDeployContractTx {
|
|
|
185
185
|
initialTokenAmounts?: Token[]
|
|
186
186
|
/** @format uint256 */
|
|
187
187
|
issueTokenAmount?: string
|
|
188
|
+
/** @format address */
|
|
189
|
+
issueTokenTo?: string
|
|
188
190
|
/** @format gas */
|
|
189
191
|
gasAmount?: number
|
|
190
192
|
/** @format uint256 */
|
|
@@ -246,6 +248,14 @@ export interface BuildInfo {
|
|
|
246
248
|
commit: string
|
|
247
249
|
}
|
|
248
250
|
|
|
251
|
+
export interface BuildMultiAddressesTransaction {
|
|
252
|
+
from: Source[]
|
|
253
|
+
/** @format uint256 */
|
|
254
|
+
gasPrice?: string
|
|
255
|
+
/** @format block-hash */
|
|
256
|
+
targetBlockHash?: string
|
|
257
|
+
}
|
|
258
|
+
|
|
249
259
|
export interface BuildMultisig {
|
|
250
260
|
/** @format address */
|
|
251
261
|
fromAddress: string
|
|
@@ -773,6 +783,17 @@ export interface SignResult {
|
|
|
773
783
|
signature: string
|
|
774
784
|
}
|
|
775
785
|
|
|
786
|
+
export interface Source {
|
|
787
|
+
/** @format hex-string */
|
|
788
|
+
fromPublicKey: string
|
|
789
|
+
destinations: Destination[]
|
|
790
|
+
/** @format hex-string */
|
|
791
|
+
fromPublicKeyType?: string
|
|
792
|
+
/** @format gas */
|
|
793
|
+
gasAmount?: number
|
|
794
|
+
utxos?: OutputRef[]
|
|
795
|
+
}
|
|
796
|
+
|
|
776
797
|
export interface SubmitMultisig {
|
|
777
798
|
unsignedTx: string
|
|
778
799
|
signatures: string[]
|
|
@@ -1256,7 +1277,7 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
1256
1277
|
|
|
1257
1278
|
/**
|
|
1258
1279
|
* @title Alephium API
|
|
1259
|
-
* @version 2.
|
|
1280
|
+
* @version 2.8.0
|
|
1260
1281
|
* @baseUrl ../
|
|
1261
1282
|
*/
|
|
1262
1283
|
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
@@ -2114,6 +2135,27 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
2114
2135
|
...params
|
|
2115
2136
|
}).then(convertHttpResponse),
|
|
2116
2137
|
|
|
2138
|
+
/**
|
|
2139
|
+
* No description
|
|
2140
|
+
*
|
|
2141
|
+
* @tags Transactions
|
|
2142
|
+
* @name PostTransactionsBuildMultiAddresses
|
|
2143
|
+
* @summary Build an unsigned transaction with multiple addresses to a number of recipients
|
|
2144
|
+
* @request POST:/transactions/build-multi-addresses
|
|
2145
|
+
*/
|
|
2146
|
+
postTransactionsBuildMultiAddresses: (data: BuildMultiAddressesTransaction, params: RequestParams = {}) =>
|
|
2147
|
+
this.request<
|
|
2148
|
+
BuildTransactionResult,
|
|
2149
|
+
BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
|
|
2150
|
+
>({
|
|
2151
|
+
path: `/transactions/build-multi-addresses`,
|
|
2152
|
+
method: 'POST',
|
|
2153
|
+
body: data,
|
|
2154
|
+
type: ContentType.Json,
|
|
2155
|
+
format: 'json',
|
|
2156
|
+
...params
|
|
2157
|
+
}).then(convertHttpResponse),
|
|
2158
|
+
|
|
2117
2159
|
/**
|
|
2118
2160
|
* No description
|
|
2119
2161
|
*
|
package/src/api/api-explorer.ts
CHANGED
|
@@ -52,6 +52,10 @@ export interface AddressTokenBalance {
|
|
|
52
52
|
lockedBalance: string
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
export interface AmountHistory {
|
|
56
|
+
amountHistory?: TimedAmount[]
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
export interface AssetOutput {
|
|
56
60
|
/** @format int32 */
|
|
57
61
|
hint: number
|
|
@@ -171,7 +175,8 @@ export interface InternalServerError {
|
|
|
171
175
|
|
|
172
176
|
export enum IntervalType {
|
|
173
177
|
Daily = 'daily',
|
|
174
|
-
Hourly = 'hourly'
|
|
178
|
+
Hourly = 'hourly',
|
|
179
|
+
Weekly = 'weekly'
|
|
175
180
|
}
|
|
176
181
|
|
|
177
182
|
export interface ListBlocks {
|
|
@@ -295,6 +300,13 @@ export interface SubContracts {
|
|
|
295
300
|
subContracts?: string[]
|
|
296
301
|
}
|
|
297
302
|
|
|
303
|
+
export interface TimedAmount {
|
|
304
|
+
/** @format int64 */
|
|
305
|
+
timestamp: number
|
|
306
|
+
/** @format bigint */
|
|
307
|
+
amount: string
|
|
308
|
+
}
|
|
309
|
+
|
|
298
310
|
export interface TimedCount {
|
|
299
311
|
/** @format int64 */
|
|
300
312
|
timestamp: number
|
|
@@ -302,6 +314,11 @@ export interface TimedCount {
|
|
|
302
314
|
totalCountAllChains: number
|
|
303
315
|
}
|
|
304
316
|
|
|
317
|
+
export interface TimedPrices {
|
|
318
|
+
timestamps?: number[]
|
|
319
|
+
prices?: number[]
|
|
320
|
+
}
|
|
321
|
+
|
|
305
322
|
export interface Token {
|
|
306
323
|
/** @format 32-byte-hash */
|
|
307
324
|
id: string
|
|
@@ -1049,6 +1066,39 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1049
1066
|
...params
|
|
1050
1067
|
}).then(convertHttpResponse),
|
|
1051
1068
|
|
|
1069
|
+
/**
|
|
1070
|
+
* No description
|
|
1071
|
+
*
|
|
1072
|
+
* @tags Addresses
|
|
1073
|
+
* @name GetAddressesAddressAmountHistoryDeprecated
|
|
1074
|
+
* @request GET:/addresses/{address}/amount-history-DEPRECATED
|
|
1075
|
+
* @deprecated
|
|
1076
|
+
*/
|
|
1077
|
+
getAddressesAddressAmountHistoryDeprecated: (
|
|
1078
|
+
address: string,
|
|
1079
|
+
query: {
|
|
1080
|
+
/**
|
|
1081
|
+
* @format int64
|
|
1082
|
+
* @min 0
|
|
1083
|
+
*/
|
|
1084
|
+
fromTs: number
|
|
1085
|
+
/**
|
|
1086
|
+
* @format int64
|
|
1087
|
+
* @min 0
|
|
1088
|
+
*/
|
|
1089
|
+
toTs: number
|
|
1090
|
+
'interval-type': IntervalType
|
|
1091
|
+
},
|
|
1092
|
+
params: RequestParams = {}
|
|
1093
|
+
) =>
|
|
1094
|
+
this.request<string, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
1095
|
+
path: `/addresses/${address}/amount-history-DEPRECATED`,
|
|
1096
|
+
method: 'GET',
|
|
1097
|
+
query: query,
|
|
1098
|
+
format: 'json',
|
|
1099
|
+
...params
|
|
1100
|
+
}).then(convertHttpResponse),
|
|
1101
|
+
|
|
1052
1102
|
/**
|
|
1053
1103
|
* No description
|
|
1054
1104
|
*
|
|
@@ -1073,7 +1123,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1073
1123
|
},
|
|
1074
1124
|
params: RequestParams = {}
|
|
1075
1125
|
) =>
|
|
1076
|
-
this.request<
|
|
1126
|
+
this.request<AmountHistory, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
1077
1127
|
path: `/addresses/${address}/amount-history`,
|
|
1078
1128
|
method: 'GET',
|
|
1079
1129
|
query: query,
|
|
@@ -1635,6 +1685,53 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
1635
1685
|
...params
|
|
1636
1686
|
}).then(convertHttpResponse)
|
|
1637
1687
|
}
|
|
1688
|
+
market = {
|
|
1689
|
+
/**
|
|
1690
|
+
* No description
|
|
1691
|
+
*
|
|
1692
|
+
* @tags Market
|
|
1693
|
+
* @name PostMarketPrices
|
|
1694
|
+
* @request POST:/market/prices
|
|
1695
|
+
*/
|
|
1696
|
+
postMarketPrices: (
|
|
1697
|
+
query: {
|
|
1698
|
+
currency: string
|
|
1699
|
+
},
|
|
1700
|
+
data?: string[],
|
|
1701
|
+
params: RequestParams = {}
|
|
1702
|
+
) =>
|
|
1703
|
+
this.request<number[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
1704
|
+
path: `/market/prices`,
|
|
1705
|
+
method: 'POST',
|
|
1706
|
+
query: query,
|
|
1707
|
+
body: data,
|
|
1708
|
+
type: ContentType.Json,
|
|
1709
|
+
format: 'json',
|
|
1710
|
+
...params
|
|
1711
|
+
}).then(convertHttpResponse),
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* No description
|
|
1715
|
+
*
|
|
1716
|
+
* @tags Market
|
|
1717
|
+
* @name GetMarketPricesSymbolCharts
|
|
1718
|
+
* @request GET:/market/prices/{symbol}/charts
|
|
1719
|
+
*/
|
|
1720
|
+
getMarketPricesSymbolCharts: (
|
|
1721
|
+
symbol: string,
|
|
1722
|
+
query: {
|
|
1723
|
+
currency: string
|
|
1724
|
+
},
|
|
1725
|
+
params: RequestParams = {}
|
|
1726
|
+
) =>
|
|
1727
|
+
this.request<TimedPrices, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
1728
|
+
path: `/market/prices/${symbol}/charts`,
|
|
1729
|
+
method: 'GET',
|
|
1730
|
+
query: query,
|
|
1731
|
+
format: 'json',
|
|
1732
|
+
...params
|
|
1733
|
+
}).then(convertHttpResponse)
|
|
1734
|
+
}
|
|
1638
1735
|
utils = {
|
|
1639
1736
|
/**
|
|
1640
1737
|
* @description Perform a sanity check
|