@alephium/web3 0.2.0-rc.0 → 0.2.0-rc.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/contracts/add/add.ral +1 -1
- package/contracts/greeter/greeter.ral +1 -1
- package/contracts/greeter_main.ral +2 -2
- package/contracts/sub/sub.ral +1 -1
- 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 +2 -2
- package/dist/src/api/api-alephium.js +3 -3
- package/dist/src/api/api-explorer.d.ts +16 -0
- package/dist/src/api/api-explorer.js +26 -0
- package/dist/src/contract/contract.js +1 -1
- package/dist/src/utils/utils.js +1 -1
- package/package.json +3 -3
- package/src/api/api-alephium.ts +3 -3
- package/src/api/api-explorer.ts +30 -0
- package/src/contract/contract.ts +1 -1
- package/src/utils/utils.test.ts +1 -1
- package/src/utils/utils.ts +1 -1
- package/templates/base/package.json +1 -1
- package/templates/react/package.json +1 -1
|
@@ -855,8 +855,8 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
855
855
|
}
|
|
856
856
|
/**
|
|
857
857
|
* @title Alephium API
|
|
858
|
-
* @version 1.5.0
|
|
859
|
-
* @baseUrl
|
|
858
|
+
* @version 1.5.0
|
|
859
|
+
* @baseUrl ../
|
|
860
860
|
*/
|
|
861
861
|
export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
862
862
|
wallets: {
|
|
@@ -28,7 +28,7 @@ var ContentType;
|
|
|
28
28
|
})(ContentType = exports.ContentType || (exports.ContentType = {}));
|
|
29
29
|
class HttpClient {
|
|
30
30
|
constructor(apiConfig = {}) {
|
|
31
|
-
this.baseUrl = '
|
|
31
|
+
this.baseUrl = '../';
|
|
32
32
|
this.securityData = null;
|
|
33
33
|
this.abortControllers = new Map();
|
|
34
34
|
this.customFetch = (...fetchParams) => fetch(...fetchParams);
|
|
@@ -158,8 +158,8 @@ class HttpClient {
|
|
|
158
158
|
exports.HttpClient = HttpClient;
|
|
159
159
|
/**
|
|
160
160
|
* @title Alephium API
|
|
161
|
-
* @version 1.5.0
|
|
162
|
-
* @baseUrl
|
|
161
|
+
* @version 1.5.0
|
|
162
|
+
* @baseUrl ../
|
|
163
163
|
*/
|
|
164
164
|
class Api extends HttpClient {
|
|
165
165
|
constructor() {
|
|
@@ -470,6 +470,22 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
470
470
|
* @request PUT:/utils/sanity-check
|
|
471
471
|
*/
|
|
472
472
|
putUtilsSanityCheck: (params?: RequestParams) => Promise<void>;
|
|
473
|
+
/**
|
|
474
|
+
* @description Update global log level, accepted: TRACE, DEBUG, INFO, WARN, ERROR
|
|
475
|
+
*
|
|
476
|
+
* @tags Utils
|
|
477
|
+
* @name PutUtilsUpdateGlobalLoglevel
|
|
478
|
+
* @request PUT:/utils/update-global-loglevel
|
|
479
|
+
*/
|
|
480
|
+
putUtilsUpdateGlobalLoglevel: (data: 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR', params?: RequestParams) => Promise<void>;
|
|
481
|
+
/**
|
|
482
|
+
* @description Update logging file, only logback.xml is accepted
|
|
483
|
+
*
|
|
484
|
+
* @tags Utils
|
|
485
|
+
* @name PutUtilsUpdateLogConfig
|
|
486
|
+
* @request PUT:/utils/update-log-config
|
|
487
|
+
*/
|
|
488
|
+
putUtilsUpdateLogConfig: (data: string, params?: RequestParams) => Promise<void>;
|
|
473
489
|
};
|
|
474
490
|
}
|
|
475
491
|
export {};
|
|
@@ -450,6 +450,32 @@ class Api extends HttpClient {
|
|
|
450
450
|
path: `/utils/sanity-check`,
|
|
451
451
|
method: 'PUT',
|
|
452
452
|
...params
|
|
453
|
+
}).then(convertHttpResponse),
|
|
454
|
+
/**
|
|
455
|
+
* @description Update global log level, accepted: TRACE, DEBUG, INFO, WARN, ERROR
|
|
456
|
+
*
|
|
457
|
+
* @tags Utils
|
|
458
|
+
* @name PutUtilsUpdateGlobalLoglevel
|
|
459
|
+
* @request PUT:/utils/update-global-loglevel
|
|
460
|
+
*/
|
|
461
|
+
putUtilsUpdateGlobalLoglevel: (data, params = {}) => this.request({
|
|
462
|
+
path: `/utils/update-global-loglevel`,
|
|
463
|
+
method: 'PUT',
|
|
464
|
+
body: data,
|
|
465
|
+
...params
|
|
466
|
+
}).then(convertHttpResponse),
|
|
467
|
+
/**
|
|
468
|
+
* @description Update logging file, only logback.xml is accepted
|
|
469
|
+
*
|
|
470
|
+
* @tags Utils
|
|
471
|
+
* @name PutUtilsUpdateLogConfig
|
|
472
|
+
* @request PUT:/utils/update-log-config
|
|
473
|
+
*/
|
|
474
|
+
putUtilsUpdateLogConfig: (data, params = {}) => this.request({
|
|
475
|
+
path: `/utils/update-log-config`,
|
|
476
|
+
method: 'PUT',
|
|
477
|
+
body: data,
|
|
478
|
+
...params
|
|
453
479
|
}).then(convertHttpResponse)
|
|
454
480
|
};
|
|
455
481
|
}
|
|
@@ -157,7 +157,7 @@ class Common {
|
|
|
157
157
|
}
|
|
158
158
|
exports.Common = Common;
|
|
159
159
|
Common.importRegex = new RegExp('^import "([^"/]+/(([^"]+)/)?)?[a-z][a-z_0-9]*.ral"', 'mg');
|
|
160
|
-
Common.contractRegex = new RegExp('^
|
|
160
|
+
Common.contractRegex = new RegExp('^(Abstract[ ]+)?Contract [A-Z][a-zA-Z0-9]*', 'mg');
|
|
161
161
|
Common.interfaceRegex = new RegExp('^Interface [A-Z][a-zA-Z0-9]* \\{', 'mg');
|
|
162
162
|
Common.scriptRegex = new RegExp('^TxScript [A-Z][a-zA-Z0-9]*', 'mg');
|
|
163
163
|
Common._artifactCache = new Map();
|
package/dist/src/utils/utils.js
CHANGED
|
@@ -182,7 +182,7 @@ function contractIdFromTx(txId, outputIndex) {
|
|
|
182
182
|
}
|
|
183
183
|
exports.contractIdFromTx = contractIdFromTx;
|
|
184
184
|
function subContractId(parentContractId, pathInHex) {
|
|
185
|
-
const data = buffer_1.Buffer.concat([hexToBinUnsafe(
|
|
185
|
+
const data = buffer_1.Buffer.concat([hexToBinUnsafe(parentContractId), hexToBinUnsafe(pathInHex)]);
|
|
186
186
|
return binToHex(blakejs_1.default.blake2b(blakejs_1.default.blake2b(data, undefined, 32), undefined, 32));
|
|
187
187
|
}
|
|
188
188
|
exports.subContractId = subContractId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alephium/web3",
|
|
3
|
-
"version": "0.2.0-rc.
|
|
3
|
+
"version": "0.2.0-rc.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": "1.5.0-
|
|
31
|
-
"explorer_backend_version": "1.7.
|
|
30
|
+
"alephium_version": "1.5.0-rc2",
|
|
31
|
+
"explorer_backend_version": "1.7.1"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "rm -rf dist/* && npx tsc --build . && webpack",
|
package/src/api/api-alephium.ts
CHANGED
|
@@ -1114,7 +1114,7 @@ export enum ContentType {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
1116
|
export class HttpClient<SecurityDataType = unknown> {
|
|
1117
|
-
public baseUrl: string = '
|
|
1117
|
+
public baseUrl: string = '../'
|
|
1118
1118
|
private securityData: SecurityDataType | null = null
|
|
1119
1119
|
private securityWorker?: ApiConfig<SecurityDataType>['securityWorker']
|
|
1120
1120
|
private abortControllers = new Map<CancelToken, AbortController>()
|
|
@@ -1279,8 +1279,8 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
1279
1279
|
|
|
1280
1280
|
/**
|
|
1281
1281
|
* @title Alephium API
|
|
1282
|
-
* @version 1.5.0
|
|
1283
|
-
* @baseUrl
|
|
1282
|
+
* @version 1.5.0
|
|
1283
|
+
* @baseUrl ../
|
|
1284
1284
|
*/
|
|
1285
1285
|
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
1286
1286
|
wallets = {
|
package/src/api/api-explorer.ts
CHANGED
|
@@ -847,6 +847,36 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
847
847
|
path: `/utils/sanity-check`,
|
|
848
848
|
method: 'PUT',
|
|
849
849
|
...params
|
|
850
|
+
}).then(convertHttpResponse),
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* @description Update global log level, accepted: TRACE, DEBUG, INFO, WARN, ERROR
|
|
854
|
+
*
|
|
855
|
+
* @tags Utils
|
|
856
|
+
* @name PutUtilsUpdateGlobalLoglevel
|
|
857
|
+
* @request PUT:/utils/update-global-loglevel
|
|
858
|
+
*/
|
|
859
|
+
putUtilsUpdateGlobalLoglevel: (data: 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR', params: RequestParams = {}) =>
|
|
860
|
+
this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
861
|
+
path: `/utils/update-global-loglevel`,
|
|
862
|
+
method: 'PUT',
|
|
863
|
+
body: data,
|
|
864
|
+
...params
|
|
865
|
+
}).then(convertHttpResponse),
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* @description Update logging file, only logback.xml is accepted
|
|
869
|
+
*
|
|
870
|
+
* @tags Utils
|
|
871
|
+
* @name PutUtilsUpdateLogConfig
|
|
872
|
+
* @request PUT:/utils/update-log-config
|
|
873
|
+
*/
|
|
874
|
+
putUtilsUpdateLogConfig: (data: string, params: RequestParams = {}) =>
|
|
875
|
+
this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
|
|
876
|
+
path: `/utils/update-log-config`,
|
|
877
|
+
method: 'PUT',
|
|
878
|
+
body: data,
|
|
879
|
+
...params
|
|
850
880
|
}).then(convertHttpResponse)
|
|
851
881
|
}
|
|
852
882
|
}
|
package/src/contract/contract.ts
CHANGED
|
@@ -51,7 +51,7 @@ export abstract class Common {
|
|
|
51
51
|
readonly functions: node.FunctionSig[]
|
|
52
52
|
|
|
53
53
|
static readonly importRegex = new RegExp('^import "([^"/]+/(([^"]+)/)?)?[a-z][a-z_0-9]*.ral"', 'mg')
|
|
54
|
-
static readonly contractRegex = new RegExp('^
|
|
54
|
+
static readonly contractRegex = new RegExp('^(Abstract[ ]+)?Contract [A-Z][a-zA-Z0-9]*', 'mg')
|
|
55
55
|
static readonly interfaceRegex = new RegExp('^Interface [A-Z][a-zA-Z0-9]* \\{', 'mg')
|
|
56
56
|
static readonly scriptRegex = new RegExp('^TxScript [A-Z][a-zA-Z0-9]*', 'mg')
|
|
57
57
|
|
package/src/utils/utils.test.ts
CHANGED
|
@@ -151,7 +151,7 @@ describe('utils', function () {
|
|
|
151
151
|
'0a38bc48fbb4300f1e305b201cd6129372d867122efb814d871d18c0bfe43b56',
|
|
152
152
|
'4f51cd1f0af97cf5ec9c7a3397eaeea549d55a93c216e54f2ab4a8cf29f6f865'
|
|
153
153
|
)
|
|
154
|
-
).toBe('
|
|
154
|
+
).toBe('0e28f15ca290002c31d691aa008aa56ac12356b0380efb6c88fff929b6a268a9')
|
|
155
155
|
})
|
|
156
156
|
|
|
157
157
|
it('should convert from string to hex and back', () => {
|
package/src/utils/utils.ts
CHANGED
|
@@ -190,7 +190,7 @@ export function contractIdFromTx(txId: string, outputIndex: number): string {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
export function subContractId(parentContractId: string, pathInHex: string): string {
|
|
193
|
-
const data = Buffer.concat([hexToBinUnsafe(
|
|
193
|
+
const data = Buffer.concat([hexToBinUnsafe(parentContractId), hexToBinUnsafe(pathInHex)])
|
|
194
194
|
|
|
195
195
|
return binToHex(blake.blake2b(blake.blake2b(data, undefined, 32), undefined, 32))
|
|
196
196
|
}
|