@alephium/web3 0.2.0-rc.1 → 0.2.0-rc.12
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/.eslintignore +2 -2
- package/README.md +2 -135
- package/contracts/greeter/greeter.ral +2 -2
- package/contracts/greeter/greeter_interface.ral +1 -0
- package/contracts/greeter_main.ral +1 -3
- package/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.LICENSE.txt +0 -17
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/scripts/create-project.js +3 -2
- package/dist/src/api/api-alephium.d.ts +44 -11
- package/dist/src/api/api-alephium.js +81 -74
- package/dist/src/api/api-explorer.d.ts +16 -16
- package/dist/src/api/api-explorer.js +24 -33
- package/dist/src/api/index.d.ts +3 -2
- package/dist/src/api/index.js +22 -3
- package/dist/src/api/types.d.ts +23 -0
- package/dist/src/api/types.js +240 -0
- package/dist/src/api/utils.d.ts +6 -0
- package/{src/utils/djb2.test.ts → dist/src/api/utils.js} +11 -17
- package/dist/src/contract/contract.d.ts +104 -64
- package/dist/src/contract/contract.js +370 -426
- package/dist/src/contract/events.d.ts +4 -4
- package/dist/src/contract/index.js +5 -1
- package/dist/src/contract/ralph.d.ts +4 -4
- package/dist/src/global.d.ts +4 -0
- package/dist/src/global.js +38 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +20 -1
- package/dist/src/signer/index.d.ts +0 -1
- package/dist/src/signer/index.js +5 -2
- package/dist/src/signer/signer.d.ts +21 -11
- package/dist/src/signer/signer.js +46 -9
- package/dist/src/transaction/index.d.ts +0 -1
- package/dist/src/transaction/index.js +5 -2
- package/dist/src/transaction/status.d.ts +2 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.js +5 -2
- package/dist/src/utils/subscription.d.ts +0 -1
- package/dist/src/utils/subscription.js +2 -1
- package/dist/src/utils/utils.d.ts +5 -11
- package/dist/src/utils/utils.js +17 -25
- package/jest-config.json +11 -0
- package/package.json +8 -36
- package/scripts/create-project.ts +3 -2
- package/src/api/api-alephium.ts +54 -16
- package/src/api/api-explorer.ts +1 -11
- package/src/api/index.ts +14 -3
- package/src/api/types.ts +233 -0
- package/src/{utils/password-crypto.test.ts → api/utils.ts} +7 -9
- package/src/contract/contract.ts +537 -526
- package/src/contract/events.ts +6 -6
- package/src/contract/ralph.ts +4 -4
- package/src/{transaction/sign-verify.ts → global.ts} +14 -15
- package/src/index.ts +3 -0
- package/src/signer/index.ts +0 -1
- package/src/signer/signer.ts +70 -19
- package/src/transaction/index.ts +0 -1
- package/src/transaction/status.ts +4 -2
- package/src/utils/index.ts +0 -1
- package/src/utils/subscription.ts +3 -3
- package/src/utils/utils.ts +10 -20
- package/templates/base/package.json +2 -2
- package/templates/base/src/greeter.ts +10 -9
- package/templates/react/package.json +2 -2
- package/templates/react/src/App.tsx +2 -2
- package/.eslintrc.json +0 -21
- package/LICENSE +0 -165
- package/contracts/add/add.ral +0 -16
- package/contracts/main.ral +0 -6
- package/contracts/sub/sub.ral +0 -9
- package/dist/src/signer/node-wallet.d.ts +0 -13
- package/dist/src/signer/node-wallet.js +0 -60
- package/dist/src/test/index.d.ts +0 -7
- package/dist/src/test/index.js +0 -41
- package/dist/src/test/privatekey-wallet.d.ts +0 -12
- package/dist/src/test/privatekey-wallet.js +0 -68
- package/dist/src/transaction/sign-verify.d.ts +0 -2
- package/dist/src/transaction/sign-verify.js +0 -58
- package/dist/src/utils/password-crypto.d.ts +0 -2
- package/dist/src/utils/password-crypto.js +0 -69
- package/gitignore +0 -10
- package/src/contract/ralph.test.ts +0 -178
- package/src/fixtures/address.json +0 -36
- package/src/fixtures/balance.json +0 -9
- package/src/fixtures/self-clique.json +0 -19
- package/src/fixtures/transaction.json +0 -13
- package/src/fixtures/transactions.json +0 -179
- package/src/signer/fixtures/genesis.json +0 -26
- package/src/signer/fixtures/wallets.json +0 -26
- package/src/signer/node-wallet.ts +0 -74
- package/src/test/index.ts +0 -32
- package/src/test/privatekey-wallet.ts +0 -58
- package/src/transaction/sign-verify.test.ts +0 -50
- package/src/utils/address.test.ts +0 -47
- package/src/utils/password-crypto.ts +0 -77
- package/src/utils/utils.test.ts +0 -161
- package/test/contract.test.ts +0 -178
- package/test/events.test.ts +0 -138
- package/test/transaction.test.ts +0 -72
|
@@ -73,7 +73,7 @@ function prepareShared(packageRoot, projectRoot) {
|
|
|
73
73
|
console.log(` to ${projectRoot}`);
|
|
74
74
|
console.log('...');
|
|
75
75
|
fs_extra_1.default.copySync(path_1.default.join(packageRoot, 'templates/shared'), projectRoot);
|
|
76
|
-
copy('', ['.editorconfig', '.eslintignore', '.gitattributes'
|
|
76
|
+
copy('', ['.editorconfig', '.eslintignore', '.gitattributes']);
|
|
77
77
|
copy('dev', ['user.conf']);
|
|
78
78
|
copy('scripts', ['start-devnet.js', 'stop-devnet.js']);
|
|
79
79
|
if (fs_extra_1.default.existsSync(path_1.default.join(packageRoot, 'gitignore'))) {
|
|
@@ -86,7 +86,8 @@ function prepareShared(packageRoot, projectRoot) {
|
|
|
86
86
|
}
|
|
87
87
|
function prepareBase(packageRoot, projectRoot) {
|
|
88
88
|
prepareShared(packageRoot, projectRoot);
|
|
89
|
-
copy('contracts', ['
|
|
89
|
+
copy('contracts', ['greeter_main.ral']);
|
|
90
|
+
copy('contracts/greeter', ['greeter.ral', 'greeter_interface.ral']);
|
|
90
91
|
fs_extra_1.default.copySync(path_1.default.join(packageRoot, 'templates/base'), projectRoot);
|
|
91
92
|
}
|
|
92
93
|
function prepareReact(packageRoot, projectRoot, projectName) {
|
|
@@ -305,17 +305,33 @@ export interface ChangeActiveAddress {
|
|
|
305
305
|
address: string;
|
|
306
306
|
}
|
|
307
307
|
export interface CompileContractResult {
|
|
308
|
+
name: string;
|
|
308
309
|
bytecode: string;
|
|
309
310
|
/** @format 32-byte-hash */
|
|
310
311
|
codeHash: string;
|
|
311
312
|
fields: FieldsSig;
|
|
312
313
|
functions: FunctionSig[];
|
|
313
314
|
events: EventSig[];
|
|
315
|
+
warnings: string[];
|
|
316
|
+
}
|
|
317
|
+
export interface CompileProjectResult {
|
|
318
|
+
contracts: CompileContractResult[];
|
|
319
|
+
scripts: CompileScriptResult[];
|
|
314
320
|
}
|
|
315
321
|
export interface CompileScriptResult {
|
|
322
|
+
name: string;
|
|
316
323
|
bytecodeTemplate: string;
|
|
317
324
|
fields: FieldsSig;
|
|
318
325
|
functions: FunctionSig[];
|
|
326
|
+
warnings: string[];
|
|
327
|
+
}
|
|
328
|
+
export interface CompilerOptions {
|
|
329
|
+
ignoreUnusedConstantsWarnings?: boolean;
|
|
330
|
+
ignoreUnusedVariablesWarnings?: boolean;
|
|
331
|
+
ignoreUnusedFieldsWarnings?: boolean;
|
|
332
|
+
ignoreUnusedPrivateFunctionsWarnings?: boolean;
|
|
333
|
+
ignoreReadonlyCheckWarnings?: boolean;
|
|
334
|
+
ignoreExternalCallCheckWarnings?: boolean;
|
|
319
335
|
}
|
|
320
336
|
export interface Confirmed {
|
|
321
337
|
/** @format block-hash */
|
|
@@ -332,6 +348,7 @@ export interface Confirmed {
|
|
|
332
348
|
}
|
|
333
349
|
export interface Contract {
|
|
334
350
|
code: string;
|
|
351
|
+
compilerOptions?: CompilerOptions;
|
|
335
352
|
}
|
|
336
353
|
export interface ContractEvent {
|
|
337
354
|
/** @format block-hash */
|
|
@@ -409,7 +426,6 @@ export interface Destination {
|
|
|
409
426
|
export declare type DiscoveryAction = Reachable | Unreachable;
|
|
410
427
|
export interface EventSig {
|
|
411
428
|
name: string;
|
|
412
|
-
signature: string;
|
|
413
429
|
fieldNames: string[];
|
|
414
430
|
fieldTypes: string[];
|
|
415
431
|
}
|
|
@@ -417,9 +433,9 @@ export interface FetchResponse {
|
|
|
417
433
|
blocks: BlockEntry[][];
|
|
418
434
|
}
|
|
419
435
|
export interface FieldsSig {
|
|
420
|
-
signature: string;
|
|
421
436
|
names: string[];
|
|
422
437
|
types: string[];
|
|
438
|
+
isMutable: boolean[];
|
|
423
439
|
}
|
|
424
440
|
export interface FixedAssetOutput {
|
|
425
441
|
/** @format int32 */
|
|
@@ -438,9 +454,12 @@ export interface FixedAssetOutput {
|
|
|
438
454
|
}
|
|
439
455
|
export interface FunctionSig {
|
|
440
456
|
name: string;
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
457
|
+
usePreapprovedAssets: boolean;
|
|
458
|
+
useAssetsInContract: boolean;
|
|
459
|
+
isPublic: boolean;
|
|
460
|
+
paramNames: string[];
|
|
461
|
+
paramTypes: string[];
|
|
462
|
+
paramIsMutable: boolean[];
|
|
444
463
|
returnTypes: string[];
|
|
445
464
|
}
|
|
446
465
|
export interface Group {
|
|
@@ -522,6 +541,10 @@ export interface Penalty {
|
|
|
522
541
|
value: number;
|
|
523
542
|
type: string;
|
|
524
543
|
}
|
|
544
|
+
export interface Project {
|
|
545
|
+
code: string;
|
|
546
|
+
compilerOptions?: CompilerOptions;
|
|
547
|
+
}
|
|
525
548
|
export interface Reachable {
|
|
526
549
|
peers: string[];
|
|
527
550
|
type: string;
|
|
@@ -542,6 +565,7 @@ export interface RevealMnemonicResult {
|
|
|
542
565
|
}
|
|
543
566
|
export interface Script {
|
|
544
567
|
code: string;
|
|
568
|
+
compilerOptions?: CompilerOptions;
|
|
545
569
|
}
|
|
546
570
|
export interface SelfClique {
|
|
547
571
|
/** @format clique-id */
|
|
@@ -1013,8 +1037,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1013
1037
|
* @request POST:/wallets/{wallet_name}/derive-next-address
|
|
1014
1038
|
*/
|
|
1015
1039
|
postWalletsWalletNameDeriveNextAddress: (walletName: string, query?: {
|
|
1016
|
-
group?: number
|
|
1017
|
-
}
|
|
1040
|
+
group?: number;
|
|
1041
|
+
}, params?: RequestParams) => Promise<AddressInfo>;
|
|
1018
1042
|
/**
|
|
1019
1043
|
* @description Your wallet need to have been created with the miner flag set to true
|
|
1020
1044
|
*
|
|
@@ -1146,8 +1170,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1146
1170
|
* @request GET:/infos/current-hashrate
|
|
1147
1171
|
*/
|
|
1148
1172
|
getInfosCurrentHashrate: (query?: {
|
|
1149
|
-
timespan?: number
|
|
1150
|
-
}
|
|
1173
|
+
timespan?: number;
|
|
1174
|
+
}, params?: RequestParams) => Promise<string>;
|
|
1151
1175
|
};
|
|
1152
1176
|
blockflow: {
|
|
1153
1177
|
/**
|
|
@@ -1334,6 +1358,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1334
1358
|
* @request POST:/contracts/compile-contract
|
|
1335
1359
|
*/
|
|
1336
1360
|
postContractsCompileContract: (data: Contract, params?: RequestParams) => Promise<CompileContractResult>;
|
|
1361
|
+
/**
|
|
1362
|
+
* No description
|
|
1363
|
+
*
|
|
1364
|
+
* @tags Contracts
|
|
1365
|
+
* @name PostContractsCompileProject
|
|
1366
|
+
* @summary Compile a project
|
|
1367
|
+
* @request POST:/contracts/compile-project
|
|
1368
|
+
*/
|
|
1369
|
+
postContractsCompileProject: (data: Project, params?: RequestParams) => Promise<CompileProjectResult>;
|
|
1337
1370
|
/**
|
|
1338
1371
|
* No description
|
|
1339
1372
|
*
|
|
@@ -1485,8 +1518,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1485
1518
|
* @request GET:/events/tx-id/{txId}
|
|
1486
1519
|
*/
|
|
1487
1520
|
getEventsTxIdTxid: (txId: string, query?: {
|
|
1488
|
-
group?: number
|
|
1489
|
-
}
|
|
1521
|
+
group?: number;
|
|
1522
|
+
}, params?: RequestParams) => Promise<ContractEventsByTxId>;
|
|
1490
1523
|
};
|
|
1491
1524
|
}
|
|
1492
1525
|
export {};
|