@alephium/web3 0.2.0-rc.2 → 0.2.0-rc.5
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 -6
- package/contracts/greeter/greeter.ral +2 -2
- package/contracts/greeter/greeter_interface.ral +1 -0
- package/contracts/greeter_main.ral +0 -2
- package/contracts/main.ral +0 -2
- package/contracts/sub/sub.ral +1 -0
- 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/src/api/api-alephium.d.ts +25 -5
- package/dist/src/api/api-alephium.js +16 -0
- package/dist/src/contract/contract.d.ts +77 -50
- package/dist/src/contract/contract.js +306 -219
- package/dist/src/utils/utils.d.ts +2 -2
- package/dist/src/utils/utils.js +1 -1
- package/gitignore +0 -1
- package/package.json +2 -4
- package/src/api/api-alephium.ts +39 -5
- package/src/contract/contract.ts +405 -314
- package/src/contract/events.ts +2 -2
- package/src/contract/ralph.test.ts +4 -4
- package/src/transaction/status.ts +1 -1
- package/src/utils/subscription.ts +1 -1
- package/src/utils/utils.ts +3 -3
- package/templates/base/package.json +2 -2
- package/templates/react/package.json +2 -2
- package/test/contract.test.ts +48 -13
- package/test/events.test.ts +13 -8
- package/test/transaction.test.ts +6 -4
|
@@ -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
|
@@ -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-rc.
|
|
3
|
+
"version": "0.2.0-rc.5",
|
|
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,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"author": "Alephium dev <dev@alephium.org>",
|
|
29
29
|
"config": {
|
|
30
|
-
"alephium_version": "1.5.0-
|
|
30
|
+
"alephium_version": "1.5.0-rc5",
|
|
31
31
|
"explorer_backend_version": "1.7.1"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
@@ -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",
|
package/src/api/api-alephium.ts
CHANGED
|
@@ -429,12 +429,19 @@ export interface CompileContractResult {
|
|
|
429
429
|
fields: FieldsSig
|
|
430
430
|
functions: FunctionSig[]
|
|
431
431
|
events: EventSig[]
|
|
432
|
+
warnings: string[]
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export interface CompileProjectResult {
|
|
436
|
+
contracts: CompileContractResult[]
|
|
437
|
+
scripts: CompileScriptResult[]
|
|
432
438
|
}
|
|
433
439
|
|
|
434
440
|
export interface CompileScriptResult {
|
|
435
441
|
bytecodeTemplate: string
|
|
436
442
|
fields: FieldsSig
|
|
437
443
|
functions: FunctionSig[]
|
|
444
|
+
warnings: string[]
|
|
438
445
|
}
|
|
439
446
|
|
|
440
447
|
export interface Confirmed {
|
|
@@ -561,7 +568,6 @@ export type DiscoveryAction = Reachable | Unreachable
|
|
|
561
568
|
|
|
562
569
|
export interface EventSig {
|
|
563
570
|
name: string
|
|
564
|
-
signature: string
|
|
565
571
|
fieldNames: string[]
|
|
566
572
|
fieldTypes: string[]
|
|
567
573
|
}
|
|
@@ -571,9 +577,9 @@ export interface FetchResponse {
|
|
|
571
577
|
}
|
|
572
578
|
|
|
573
579
|
export interface FieldsSig {
|
|
574
|
-
signature: string
|
|
575
580
|
names: string[]
|
|
576
581
|
types: string[]
|
|
582
|
+
isMutable: boolean[]
|
|
577
583
|
}
|
|
578
584
|
|
|
579
585
|
export interface FixedAssetOutput {
|
|
@@ -599,9 +605,12 @@ export interface FixedAssetOutput {
|
|
|
599
605
|
|
|
600
606
|
export interface FunctionSig {
|
|
601
607
|
name: string
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
608
|
+
usePreapprovedAssets: boolean
|
|
609
|
+
useAssetsInContract: boolean
|
|
610
|
+
isPublic: boolean
|
|
611
|
+
paramNames: string[]
|
|
612
|
+
paramTypes: string[]
|
|
613
|
+
paramIsMutable: boolean[]
|
|
605
614
|
returnTypes: string[]
|
|
606
615
|
}
|
|
607
616
|
|
|
@@ -703,6 +712,10 @@ export interface Penalty {
|
|
|
703
712
|
type: string
|
|
704
713
|
}
|
|
705
714
|
|
|
715
|
+
export interface Project {
|
|
716
|
+
code: string
|
|
717
|
+
}
|
|
718
|
+
|
|
706
719
|
export interface Reachable {
|
|
707
720
|
peers: string[]
|
|
708
721
|
type: string
|
|
@@ -2160,6 +2173,27 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|
|
2160
2173
|
...params
|
|
2161
2174
|
}).then(convertHttpResponse),
|
|
2162
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
|
+
|
|
2163
2197
|
/**
|
|
2164
2198
|
* No description
|
|
2165
2199
|
*
|