@alephium/web3 0.2.0-test.0 → 0.2.0-test.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 +5 -8
- package/contracts/greeter/greeter.ral +3 -3
- package/contracts/greeter/greeter_interface.ral +1 -0
- package/contracts/greeter_main.ral +3 -5
- package/contracts/main.ral +0 -2
- package/contracts/sub/sub.ral +2 -1
- package/contracts/test/metadata.ral +18 -0
- package/contracts/test/warnings.ral +8 -0
- package/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/scripts/create-project.js +2 -1
- package/dist/src/api/api-alephium.d.ts +37 -7
- package/dist/src/api/api-alephium.js +19 -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.d.ts +86 -52
- package/dist/src/contract/contract.js +325 -218
- package/dist/src/global.d.ts +3 -0
- package/dist/src/global.js +38 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/signer/node-wallet.d.ts +1 -3
- package/dist/src/signer/node-wallet.js +2 -5
- package/dist/src/signer/signer.d.ts +1 -1
- package/dist/src/signer/signer.js +3 -2
- package/dist/src/test/index.d.ts +1 -2
- package/dist/src/test/index.js +4 -4
- package/dist/src/test/privatekey-wallet.d.ts +2 -3
- package/dist/src/test/privatekey-wallet.js +4 -4
- package/dist/src/utils/subscription.d.ts +0 -1
- package/dist/src/utils/subscription.js +2 -1
- package/dist/src/utils/utils.d.ts +2 -2
- package/dist/src/utils/utils.js +2 -2
- package/gitignore +0 -1
- package/package.json +3 -5
- package/scripts/create-project.ts +2 -1
- package/src/api/api-alephium.ts +57 -8
- package/src/api/api-explorer.ts +30 -0
- package/src/contract/contract.ts +430 -317
- package/src/contract/events.ts +2 -2
- package/src/contract/ralph.test.ts +4 -4
- package/src/global.ts +36 -0
- package/src/index.ts +1 -0
- package/src/signer/node-wallet.ts +2 -11
- package/src/signer/signer.ts +4 -3
- package/src/test/index.ts +2 -3
- package/src/test/privatekey-wallet.ts +4 -5
- package/src/transaction/status.ts +1 -1
- package/src/utils/subscription.ts +3 -3
- package/src/utils/utils.test.ts +1 -1
- package/src/utils/utils.ts +4 -4
- package/templates/base/package.json +2 -2
- package/templates/base/src/greeter.ts +8 -7
- package/templates/react/package.json +2 -2
- package/templates/react/src/App.tsx +2 -2
- package/test/contract.test.ts +60 -25
- package/test/events.test.ts +20 -17
- package/test/transaction.test.ts +10 -9
|
@@ -0,0 +1,38 @@
|
|
|
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.getCurrentNodeProvider = exports.setCurrentNodeProvider = void 0;
|
|
21
|
+
const api_1 = require("./api");
|
|
22
|
+
let _currentNodeProvider = undefined;
|
|
23
|
+
function setCurrentNodeProvider(provider) {
|
|
24
|
+
if (typeof provider == 'string') {
|
|
25
|
+
_currentNodeProvider = new api_1.NodeProvider(provider);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
_currentNodeProvider = provider;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.setCurrentNodeProvider = setCurrentNodeProvider;
|
|
32
|
+
function getCurrentNodeProvider() {
|
|
33
|
+
if (typeof _currentNodeProvider === 'undefined') {
|
|
34
|
+
throw Error('No node provider is set.');
|
|
35
|
+
}
|
|
36
|
+
return _currentNodeProvider;
|
|
37
|
+
}
|
|
38
|
+
exports.getCurrentNodeProvider = getCurrentNodeProvider;
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { NodeProvider } from '../api';
|
|
2
1
|
import { Account, SignerWithNodeProvider } from '../signer';
|
|
3
2
|
export declare class NodeWallet extends SignerWithNodeProvider {
|
|
4
3
|
walletName: string;
|
|
5
4
|
accounts: Account[] | undefined;
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(walletName: string, alwaysSubmitTx?: boolean);
|
|
7
6
|
getAccounts(): Promise<Account[]>;
|
|
8
7
|
private getAllAccounts;
|
|
9
|
-
static FromCliqueClient(provider: NodeProvider, walletName: string, alwaysSubmitTx?: boolean): Promise<NodeWallet>;
|
|
10
8
|
signRaw(signerAddress: string, hexString: string): Promise<string>;
|
|
11
9
|
unlock(password: string): Promise<void>;
|
|
12
10
|
lock(): Promise<void>;
|
|
@@ -20,8 +20,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.NodeWallet = void 0;
|
|
21
21
|
const signer_1 = require("../signer");
|
|
22
22
|
class NodeWallet extends signer_1.SignerWithNodeProvider {
|
|
23
|
-
constructor(
|
|
24
|
-
super(
|
|
23
|
+
constructor(walletName, alwaysSubmitTx = true) {
|
|
24
|
+
super(alwaysSubmitTx);
|
|
25
25
|
this.walletName = walletName;
|
|
26
26
|
}
|
|
27
27
|
async getAccounts() {
|
|
@@ -39,9 +39,6 @@ class NodeWallet extends signer_1.SignerWithNodeProvider {
|
|
|
39
39
|
}));
|
|
40
40
|
return accounts;
|
|
41
41
|
}
|
|
42
|
-
static async FromCliqueClient(provider, walletName, alwaysSubmitTx = true) {
|
|
43
|
-
return new NodeWallet(provider, walletName, alwaysSubmitTx);
|
|
44
|
-
}
|
|
45
42
|
async signRaw(signerAddress, hexString) {
|
|
46
43
|
const currentActiveAddressResponse = await this.provider.wallets.getWalletsWalletNameAddresses(this.walletName);
|
|
47
44
|
const { activeAddress } = currentActiveAddressResponse;
|
|
@@ -111,7 +111,7 @@ export declare abstract class SignerWithNodeProvider implements SignerProvider {
|
|
|
111
111
|
alwaysSubmitTx: boolean;
|
|
112
112
|
abstract getAccounts(): Promise<Account[]>;
|
|
113
113
|
getAccount(signerAddress: string): Promise<Account>;
|
|
114
|
-
constructor(
|
|
114
|
+
constructor(alwaysSubmitTx: boolean);
|
|
115
115
|
private defaultSignerAddress;
|
|
116
116
|
submitTransaction(unsignedTx: string, txHash: string, signerAddress?: string): Promise<SubmissionResult>;
|
|
117
117
|
private shouldSubmitTx;
|
|
@@ -44,6 +44,7 @@ const elliptic_1 = require("elliptic");
|
|
|
44
44
|
const utils = __importStar(require("../utils"));
|
|
45
45
|
const utils_1 = require("../utils");
|
|
46
46
|
const blakejs_1 = __importDefault(require("blakejs"));
|
|
47
|
+
const global_1 = require("../global");
|
|
47
48
|
const ec = new elliptic_1.ec('secp256k1');
|
|
48
49
|
(0, utils_1.assertType)();
|
|
49
50
|
(0, utils_1.assertType)();
|
|
@@ -58,8 +59,8 @@ const ec = new elliptic_1.ec('secp256k1');
|
|
|
58
59
|
(0, utils_1.assertType)();
|
|
59
60
|
(0, utils_1.assertType)();
|
|
60
61
|
class SignerWithNodeProvider {
|
|
61
|
-
constructor(
|
|
62
|
-
this.provider =
|
|
62
|
+
constructor(alwaysSubmitTx) {
|
|
63
|
+
this.provider = (0, global_1.getCurrentNodeProvider)();
|
|
63
64
|
this.alwaysSubmitTx = alwaysSubmitTx;
|
|
64
65
|
}
|
|
65
66
|
async getAccount(signerAddress) {
|
package/dist/src/test/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { NodeProvider } from '../api';
|
|
2
1
|
import { NodeWallet } from '../signer';
|
|
3
2
|
export declare const testWalletName = "alephium-web3-test-only-wallet";
|
|
4
3
|
export declare const testAddress = "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH";
|
|
5
4
|
export declare const testPassword = "alph";
|
|
6
|
-
export declare function
|
|
5
|
+
export declare function testNodeWallet(): Promise<NodeWallet>;
|
|
7
6
|
export * from './privatekey-wallet';
|
package/dist/src/test/index.js
CHANGED
|
@@ -27,15 +27,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
27
27
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.
|
|
30
|
+
exports.testNodeWallet = exports.testPassword = exports.testAddress = exports.testWalletName = void 0;
|
|
31
31
|
const signer_1 = require("../signer");
|
|
32
32
|
exports.testWalletName = 'alephium-web3-test-only-wallet';
|
|
33
33
|
exports.testAddress = '1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH';
|
|
34
34
|
exports.testPassword = 'alph';
|
|
35
|
-
async function
|
|
36
|
-
const wallet = new signer_1.NodeWallet(
|
|
35
|
+
async function testNodeWallet() {
|
|
36
|
+
const wallet = new signer_1.NodeWallet(exports.testWalletName);
|
|
37
37
|
await wallet.unlock(exports.testPassword);
|
|
38
38
|
return wallet;
|
|
39
39
|
}
|
|
40
|
-
exports.
|
|
40
|
+
exports.testNodeWallet = testNodeWallet;
|
|
41
41
|
__exportStar(require("./privatekey-wallet"), exports);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { NodeProvider } from '../api';
|
|
2
1
|
import { Account, SignerWithNodeProvider } from '../signer';
|
|
3
2
|
export declare class PrivateKeyWallet extends SignerWithNodeProvider {
|
|
4
3
|
readonly privateKey: string;
|
|
5
4
|
readonly publicKey: string;
|
|
6
5
|
readonly address: string;
|
|
7
6
|
readonly group: number;
|
|
8
|
-
constructor(
|
|
9
|
-
static Random(
|
|
7
|
+
constructor(privateKey: string, alwaysSubmitTx?: boolean);
|
|
8
|
+
static Random(alwaysSubmitTx?: boolean): PrivateKeyWallet;
|
|
10
9
|
getAccounts(): Promise<Account[]>;
|
|
11
10
|
signRaw(signerAddress: string, hexString: string): Promise<string>;
|
|
12
11
|
}
|
|
@@ -42,16 +42,16 @@ const signer_1 = require("../signer");
|
|
|
42
42
|
const utils = __importStar(require("../utils"));
|
|
43
43
|
const ec = new elliptic_1.ec('secp256k1');
|
|
44
44
|
class PrivateKeyWallet extends signer_1.SignerWithNodeProvider {
|
|
45
|
-
constructor(
|
|
46
|
-
super(
|
|
45
|
+
constructor(privateKey, alwaysSubmitTx = true) {
|
|
46
|
+
super(alwaysSubmitTx);
|
|
47
47
|
this.privateKey = privateKey;
|
|
48
48
|
this.publicKey = utils.publicKeyFromPrivateKey(privateKey);
|
|
49
49
|
this.address = utils.addressFromPublicKey(this.publicKey);
|
|
50
50
|
this.group = utils.groupOfAddress(this.address);
|
|
51
51
|
}
|
|
52
|
-
static Random(
|
|
52
|
+
static Random(alwaysSubmitTx = true) {
|
|
53
53
|
const keyPair = ec.genKeyPair();
|
|
54
|
-
return new PrivateKeyWallet(
|
|
54
|
+
return new PrivateKeyWallet(keyPair.getPrivate().toString('hex'), alwaysSubmitTx);
|
|
55
55
|
}
|
|
56
56
|
async getAccounts() {
|
|
57
57
|
return [{ address: this.address, publicKey: this.publicKey, group: this.group }];
|
|
@@ -3,7 +3,6 @@ import { NodeProvider } from '../api';
|
|
|
3
3
|
declare type MessageCallback<Message> = (message: Message) => Promise<void>;
|
|
4
4
|
declare type ErrorCallback<Message> = (error: any, subscription: Subscription<Message>) => Promise<void>;
|
|
5
5
|
export interface SubscribeOptions<Message> {
|
|
6
|
-
provider: NodeProvider;
|
|
7
6
|
pollingInterval: number;
|
|
8
7
|
messageCallback: MessageCallback<Message>;
|
|
9
8
|
errorCallback: ErrorCallback<Message>;
|
|
@@ -22,9 +22,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.Subscription = void 0;
|
|
24
24
|
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
|
25
|
+
const global_1 = require("../global");
|
|
25
26
|
class Subscription {
|
|
26
27
|
constructor(options) {
|
|
27
|
-
this.provider =
|
|
28
|
+
this.provider = (0, global_1.getCurrentNodeProvider)();
|
|
28
29
|
this.pollingInterval = options.pollingInterval;
|
|
29
30
|
this.messageCallback = options.messageCallback;
|
|
30
31
|
this.errorCallback = options.errorCallback;
|
|
@@ -20,8 +20,8 @@ export declare function addressFromContractId(contractId: string): string;
|
|
|
20
20
|
export declare function contractIdFromTx(txId: string, outputIndex: number): string;
|
|
21
21
|
export declare function subContractId(parentContractId: string, pathInHex: string): string;
|
|
22
22
|
export declare function stringToHex(str: string): string;
|
|
23
|
-
export declare function hexToString(str:
|
|
24
|
-
export declare function timeout(ms: number): Promise<
|
|
23
|
+
export declare function hexToString(str: string): string;
|
|
24
|
+
export declare function timeout(ms: number): Promise<void>;
|
|
25
25
|
declare type _Eq<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
26
26
|
export declare type Eq<X, Y> = _Eq<{
|
|
27
27
|
[P in keyof X]: X[P];
|
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;
|
|
@@ -195,7 +195,7 @@ function stringToHex(str) {
|
|
|
195
195
|
}
|
|
196
196
|
exports.stringToHex = stringToHex;
|
|
197
197
|
function hexToString(str) {
|
|
198
|
-
return buffer_1.Buffer.from(str
|
|
198
|
+
return buffer_1.Buffer.from(str, 'hex').toString();
|
|
199
199
|
}
|
|
200
200
|
exports.hexToString = hexToString;
|
|
201
201
|
function timeout(ms) {
|
package/gitignore
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alephium/web3",
|
|
3
|
-
"version": "0.2.0-test.
|
|
3
|
+
"version": "0.2.0-test.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.
|
|
31
|
-
"explorer_backend_version": "1.7.
|
|
30
|
+
"alephium_version": "1.5.0-rc6",
|
|
31
|
+
"explorer_backend_version": "1.7.1"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "rm -rf dist/* && npx tsc --build . && webpack",
|
|
@@ -88,7 +88,6 @@
|
|
|
88
88
|
"eslint-config-prettier": "^8.5.0",
|
|
89
89
|
"eslint-plugin-header": "^3.1.1",
|
|
90
90
|
"eslint-plugin-prettier": "^4.0.0",
|
|
91
|
-
"eslint-plugin-react": "^7.29.4",
|
|
92
91
|
"eslint-plugin-security": "1.4.0",
|
|
93
92
|
"html-webpack-plugin": "5.5.0",
|
|
94
93
|
"jest": "^28.1.0",
|
|
@@ -98,7 +97,6 @@
|
|
|
98
97
|
"mock-socket": "^9.0.8",
|
|
99
98
|
"prettier": "^2.3.2",
|
|
100
99
|
"process": "^0.11.10",
|
|
101
|
-
"react-app-rewired": "^2.2.1",
|
|
102
100
|
"rewire": "^6.0.0",
|
|
103
101
|
"shelljs": "^0.8.5",
|
|
104
102
|
"stream-browserify": "^3.0.0",
|
|
@@ -87,7 +87,8 @@ function prepareShared(packageRoot: string, projectRoot: string) {
|
|
|
87
87
|
|
|
88
88
|
function prepareBase(packageRoot: string, projectRoot: string) {
|
|
89
89
|
prepareShared(packageRoot, projectRoot)
|
|
90
|
-
copy('contracts', ['
|
|
90
|
+
copy('contracts', ['greeter_main.ral'])
|
|
91
|
+
copy('contracts/greeter', ['greeter.ral', 'greeter_interface.ral'])
|
|
91
92
|
fsExtra.copySync(path.join(packageRoot, 'templates/base'), projectRoot)
|
|
92
93
|
}
|
|
93
94
|
|
package/src/api/api-alephium.ts
CHANGED
|
@@ -207,6 +207,9 @@ export interface BuildDeployContractTx {
|
|
|
207
207
|
|
|
208
208
|
/** @format uint256 */
|
|
209
209
|
gasPrice?: string
|
|
210
|
+
|
|
211
|
+
/** @format block-hash */
|
|
212
|
+
targetBlockHash?: string
|
|
210
213
|
}
|
|
211
214
|
|
|
212
215
|
export interface BuildDeployContractTxResult {
|
|
@@ -246,6 +249,9 @@ export interface BuildExecuteScriptTx {
|
|
|
246
249
|
|
|
247
250
|
/** @format uint256 */
|
|
248
251
|
gasPrice?: string
|
|
252
|
+
|
|
253
|
+
/** @format block-hash */
|
|
254
|
+
targetBlockHash?: string
|
|
249
255
|
}
|
|
250
256
|
|
|
251
257
|
export interface BuildExecuteScriptTxResult {
|
|
@@ -311,6 +317,9 @@ export interface BuildSweepAddressTransactions {
|
|
|
311
317
|
|
|
312
318
|
/** @format uint256 */
|
|
313
319
|
gasPrice?: string
|
|
320
|
+
|
|
321
|
+
/** @format block-hash */
|
|
322
|
+
targetBlockHash?: string
|
|
314
323
|
}
|
|
315
324
|
|
|
316
325
|
export interface BuildSweepAddressTransactionsResult {
|
|
@@ -334,6 +343,9 @@ export interface BuildTransaction {
|
|
|
334
343
|
|
|
335
344
|
/** @format uint256 */
|
|
336
345
|
gasPrice?: string
|
|
346
|
+
|
|
347
|
+
/** @format block-hash */
|
|
348
|
+
targetBlockHash?: string
|
|
337
349
|
}
|
|
338
350
|
|
|
339
351
|
export interface BuildTransactionResult {
|
|
@@ -417,12 +429,19 @@ export interface CompileContractResult {
|
|
|
417
429
|
fields: FieldsSig
|
|
418
430
|
functions: FunctionSig[]
|
|
419
431
|
events: EventSig[]
|
|
432
|
+
warnings: string[]
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export interface CompileProjectResult {
|
|
436
|
+
contracts: CompileContractResult[]
|
|
437
|
+
scripts: CompileScriptResult[]
|
|
420
438
|
}
|
|
421
439
|
|
|
422
440
|
export interface CompileScriptResult {
|
|
423
441
|
bytecodeTemplate: string
|
|
424
442
|
fields: FieldsSig
|
|
425
443
|
functions: FunctionSig[]
|
|
444
|
+
warnings: string[]
|
|
426
445
|
}
|
|
427
446
|
|
|
428
447
|
export interface Confirmed {
|
|
@@ -549,7 +568,6 @@ export type DiscoveryAction = Reachable | Unreachable
|
|
|
549
568
|
|
|
550
569
|
export interface EventSig {
|
|
551
570
|
name: string
|
|
552
|
-
signature: string
|
|
553
571
|
fieldNames: string[]
|
|
554
572
|
fieldTypes: string[]
|
|
555
573
|
}
|
|
@@ -559,9 +577,9 @@ export interface FetchResponse {
|
|
|
559
577
|
}
|
|
560
578
|
|
|
561
579
|
export interface FieldsSig {
|
|
562
|
-
signature: string
|
|
563
580
|
names: string[]
|
|
564
581
|
types: string[]
|
|
582
|
+
isMutable: boolean[]
|
|
565
583
|
}
|
|
566
584
|
|
|
567
585
|
export interface FixedAssetOutput {
|
|
@@ -587,9 +605,12 @@ export interface FixedAssetOutput {
|
|
|
587
605
|
|
|
588
606
|
export interface FunctionSig {
|
|
589
607
|
name: string
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
608
|
+
usePreapprovedAssets: boolean
|
|
609
|
+
useAssetsInContract: boolean
|
|
610
|
+
isPublic: boolean
|
|
611
|
+
paramNames: string[]
|
|
612
|
+
paramTypes: string[]
|
|
613
|
+
paramIsMutable: boolean[]
|
|
593
614
|
returnTypes: string[]
|
|
594
615
|
}
|
|
595
616
|
|
|
@@ -691,6 +712,10 @@ export interface Penalty {
|
|
|
691
712
|
type: string
|
|
692
713
|
}
|
|
693
714
|
|
|
715
|
+
export interface Project {
|
|
716
|
+
code: string
|
|
717
|
+
}
|
|
718
|
+
|
|
694
719
|
export interface Reachable {
|
|
695
720
|
peers: string[]
|
|
696
721
|
type: string
|
|
@@ -778,6 +803,9 @@ export interface Sweep {
|
|
|
778
803
|
|
|
779
804
|
/** @format int32 */
|
|
780
805
|
utxosLimit?: number
|
|
806
|
+
|
|
807
|
+
/** @format block-hash */
|
|
808
|
+
targetBlockHash?: string
|
|
781
809
|
}
|
|
782
810
|
|
|
783
811
|
export interface SweepAddressTransaction {
|
|
@@ -1099,7 +1127,7 @@ export enum ContentType {
|
|
|
1099
1127
|
}
|
|
1100
1128
|
|
|
1101
1129
|
export class HttpClient<SecurityDataType = unknown> {
|
|
1102
|
-
public baseUrl: string = '
|
|
1130
|
+
public baseUrl: string = '../'
|
|
1103
1131
|
private securityData: SecurityDataType | null = null
|
|
1104
1132
|
private securityWorker?: ApiConfig<SecurityDataType>['securityWorker']
|
|
1105
1133
|
private abortControllers = new Map<CancelToken, AbortController>()
|
|
@@ -1264,8 +1292,8 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
1264
1292
|
|
|
1265
1293
|
/**
|
|
1266
1294
|
* @title Alephium API
|
|
1267
|
-
* @version 1.
|
|
1268
|
-
* @baseUrl
|
|
1295
|
+
* @version 1.5.0
|
|
1296
|
+
* @baseUrl ../
|
|
1269
1297
|
*/
|
|
1270
1298
|
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
1271
1299
|
wallets = {
|
|
@@ -2145,6 +2173,27 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
2145
2173
|
...params
|
|
2146
2174
|
}).then(convertHttpResponse),
|
|
2147
2175
|
|
|
2176
|
+
/**
|
|
2177
|
+
* No description
|
|
2178
|
+
*
|
|
2179
|
+
* @tags Contracts
|
|
2180
|
+
* @name PostContractsCompileProject
|
|
2181
|
+
* @summary Compile a project
|
|
2182
|
+
* @request POST:/contracts/compile-project
|
|
2183
|
+
*/
|
|
2184
|
+
postContractsCompileProject: (data: Project, params: RequestParams = {}) =>
|
|
2185
|
+
this.request<
|
|
2186
|
+
CompileProjectResult,
|
|
2187
|
+
BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
|
|
2188
|
+
>({
|
|
2189
|
+
path: `/contracts/compile-project`,
|
|
2190
|
+
method: 'POST',
|
|
2191
|
+
body: data,
|
|
2192
|
+
type: ContentType.Json,
|
|
2193
|
+
format: 'json',
|
|
2194
|
+
...params
|
|
2195
|
+
}).then(convertHttpResponse),
|
|
2196
|
+
|
|
2148
2197
|
/**
|
|
2149
2198
|
* No description
|
|
2150
2199
|
*
|
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
|
}
|