@partisiablockchain/abi-client 6.37.0 → 6.62.0
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/package.json +3 -3
- package/target/main/deploymentclient/BlockchainClientForDeploymentImpl.d.ts +1 -1
- package/target/main/deploymentclient/BlockchainClientForDeploymentImpl.js +12 -0
- package/target/main/deploymentclient/BlockchainClientForDeploymentImpl.js.map +1 -1
- package/target/main/deploymentclient/DeploymentBuilder.d.ts +111 -50
- package/target/main/deploymentclient/DeploymentBuilder.js +409 -141
- package/target/main/deploymentclient/DeploymentBuilder.js.map +1 -1
- package/target/main/deploymentclient/DeploymentTypes.d.ts +69 -3
- package/target/main/deploymentclient/DeploymentTypes.js +8 -0
- package/target/main/deploymentclient/DeploymentTypes.js.map +1 -1
- package/target/main/deploymentclient/UpgradeBuilder.d.ts +12 -24
- package/target/main/deploymentclient/UpgradeBuilder.js +67 -73
- package/target/main/deploymentclient/UpgradeBuilder.js.map +1 -1
- package/target/main/index.d.ts +2 -1
- package/target/main/index.js +6 -1
- package/target/main/index.js.map +1 -1
- package/target/main/parser/Configuration.d.ts +6 -0
- package/target/main/parser/Configuration.js +9 -0
- package/target/main/parser/Configuration.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@partisiablockchain/abi-client",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.62.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@partisiablockchain/blockchain-api-transaction-client": "6.
|
|
8
|
-
"@partisiablockchain/sections": "6.
|
|
7
|
+
"@partisiablockchain/blockchain-api-transaction-client": "6.51.0",
|
|
8
|
+
"@partisiablockchain/sections": "6.14.0",
|
|
9
9
|
"@secata-public/bitmanipulation-ts": "3.4.0",
|
|
10
10
|
"@types/bn.js": "^5.1.6",
|
|
11
11
|
"@types/elliptic": "^6.4.18",
|
|
@@ -13,7 +13,7 @@ export declare class BlockchainClientForDeploymentImpl implements BlockchainClie
|
|
|
13
13
|
* @param transactionClient the underlying transaction client
|
|
14
14
|
* @param chainController the underlying chainController
|
|
15
15
|
*/
|
|
16
|
-
constructor(transactionClient: BlockchainTransactionClient, chainController: ChainControllerApi);
|
|
16
|
+
constructor(transactionClient: BlockchainTransactionClient | undefined, chainController: ChainControllerApi | undefined);
|
|
17
17
|
getContract(address: string): Promise<Contract>;
|
|
18
18
|
sign(transaction: Transaction, gasCost: number): Promise<SignedTransaction>;
|
|
19
19
|
send(signedTransaction: SignedTransaction): Promise<SentTransaction>;
|
|
@@ -34,15 +34,27 @@ class BlockchainClientForDeploymentImpl {
|
|
|
34
34
|
this.chainController = chainController;
|
|
35
35
|
}
|
|
36
36
|
getContract(address) {
|
|
37
|
+
if (this.chainController === undefined) {
|
|
38
|
+
throw new Error("ChainController is undefined");
|
|
39
|
+
}
|
|
37
40
|
return this.chainController.getContract({ address });
|
|
38
41
|
}
|
|
39
42
|
sign(transaction, gasCost) {
|
|
43
|
+
if (this.transactionClient === undefined) {
|
|
44
|
+
throw new Error("Transaction client is undefined");
|
|
45
|
+
}
|
|
40
46
|
return this.transactionClient.sign(transaction, gasCost);
|
|
41
47
|
}
|
|
42
48
|
send(signedTransaction) {
|
|
49
|
+
if (this.transactionClient === undefined) {
|
|
50
|
+
throw new Error("Transaction client is undefined");
|
|
51
|
+
}
|
|
43
52
|
return this.transactionClient.send(signedTransaction);
|
|
44
53
|
}
|
|
45
54
|
waitForSpawnedEvents(sentTransaction) {
|
|
55
|
+
if (this.transactionClient === undefined) {
|
|
56
|
+
throw new Error("Transaction client is undefined");
|
|
57
|
+
}
|
|
46
58
|
return this.transactionClient.waitForSpawnedEvents(sentTransaction);
|
|
47
59
|
}
|
|
48
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockchainClientForDeploymentImpl.js","sourceRoot":"","sources":["../../../src/main/deploymentclient/BlockchainClientForDeploymentImpl.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAaH;;;GAGG;AACH,MAAa,iCAAiC;IAI5C;;;;;OAKG;IACH,
|
|
1
|
+
{"version":3,"file":"BlockchainClientForDeploymentImpl.js","sourceRoot":"","sources":["../../../src/main/deploymentclient/BlockchainClientForDeploymentImpl.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAaH;;;GAGG;AACH,MAAa,iCAAiC;IAI5C;;;;;OAKG;IACH,YACE,iBAA0D,EAC1D,eAA+C;QAE/C,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED,WAAW,CAAC,OAAe;QACzB,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,CAAC,WAAwB,EAAE,OAAe;QAC5C,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,CAAC,iBAAoC;QACvC,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACxD,CAAC;IAED,oBAAoB,CAAC,eAAgC;QACnD,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC;IACtE,CAAC;CACF;AA7CD,8EA6CC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { BlockchainClientForDeployment, DeployResult, VersionInterval } from "./DeploymentTypes";
|
|
1
|
+
import { BlockchainClientForDeployment, DeployResult, InputFiles, PubState, RealState, Result, ValidationResult, ValidationSuccess, Version, VersionInterval } from "./DeploymentTypes";
|
|
2
2
|
import { PbcFile } from "@partisiablockchain/sections";
|
|
3
3
|
import { ContractAbi } from "../model/ContractAbi";
|
|
4
4
|
import { AbiVersion } from "../model/AbiVersion";
|
|
5
5
|
import { SignedTransaction, TransactionTree } from "@partisiablockchain/blockchain-api-transaction-client";
|
|
6
6
|
import { AbstractBuilder } from "../builder/AbstractBuilder";
|
|
7
|
+
import { FileAbi } from "../model/FileAbi";
|
|
7
8
|
export declare class DeploymentBuilder {
|
|
8
9
|
static readonly DEFAULT_PUB_ADDRESS: string;
|
|
9
10
|
static readonly DEFAULT_REAL_ADDRESS: string;
|
|
@@ -12,15 +13,16 @@ export declare class DeploymentBuilder {
|
|
|
12
13
|
private static readonly DEFAULT_PUB_GAS_COST;
|
|
13
14
|
private static readonly DEFAULT_REAL_GAS_COST;
|
|
14
15
|
private readonly blockchainClient;
|
|
16
|
+
private pubState;
|
|
17
|
+
private realState;
|
|
15
18
|
private isZk;
|
|
16
|
-
private
|
|
17
|
-
private abiBytes;
|
|
19
|
+
private pbcFileField;
|
|
18
20
|
private initRpcBytes;
|
|
19
21
|
private deployContractAddressField;
|
|
20
22
|
private allowedJurisdictionsField;
|
|
23
|
+
private specificNodesField;
|
|
21
24
|
private requiredStakesField;
|
|
22
25
|
private gasCostField;
|
|
23
|
-
private binderIdField;
|
|
24
26
|
constructor(blockchainClient: BlockchainClientForDeployment);
|
|
25
27
|
/**
|
|
26
28
|
* Set the abi and contract bytes to deploy through a pbc file.
|
|
@@ -31,38 +33,7 @@ export declare class DeploymentBuilder {
|
|
|
31
33
|
* @param pbcFile the pbc file to deploy
|
|
32
34
|
* @returns this builder
|
|
33
35
|
*/
|
|
34
|
-
pbcFile(pbcFile: PbcFile | Buffer): DeploymentBuilder;
|
|
35
|
-
/**
|
|
36
|
-
* Set the abi of the contract to deploy.
|
|
37
|
-
*
|
|
38
|
-
* <p>It is required to provide the abi either through this method or through {@link #pbcFile}.
|
|
39
|
-
*
|
|
40
|
-
* @param abi abi bytes to deploy
|
|
41
|
-
* @returns this builder
|
|
42
|
-
*/
|
|
43
|
-
abi(abi: Buffer): DeploymentBuilder;
|
|
44
|
-
/**
|
|
45
|
-
* Set the contract bytes of the contract to deploy. Using this function denotes that it is a zk
|
|
46
|
-
* contract you are trying to deploy.
|
|
47
|
-
*
|
|
48
|
-
* <p>It is required to provide the contract bytes either though this method, {@link wasm}, or
|
|
49
|
-
* {@link pbcFile}.
|
|
50
|
-
*
|
|
51
|
-
* @param zkwa contract bytes to deploy
|
|
52
|
-
* @returns this builder
|
|
53
|
-
*/
|
|
54
|
-
zkwa(zkwa: Buffer): DeploymentBuilder;
|
|
55
|
-
/**
|
|
56
|
-
* Set the contract bytes of the contract to deploy. Using this function denotes that it is a
|
|
57
|
-
* public contract you are trying to deploy.
|
|
58
|
-
*
|
|
59
|
-
* <p>It is required to provide the contract bytes either though this method, {@link #zkwa}, or
|
|
60
|
-
* {@link #pbcFile}.
|
|
61
|
-
*
|
|
62
|
-
* @param wasm contract bytes to deploy
|
|
63
|
-
* @returns this builder
|
|
64
|
-
*/
|
|
65
|
-
wasm(wasm: Buffer): DeploymentBuilder;
|
|
36
|
+
pbcFile(pbcFile: PbcFile | Buffer | undefined): DeploymentBuilder;
|
|
66
37
|
/**
|
|
67
38
|
* Set the initialization bytes of the contract to deploy.
|
|
68
39
|
*
|
|
@@ -110,6 +81,16 @@ export declare class DeploymentBuilder {
|
|
|
110
81
|
* @returns this builder
|
|
111
82
|
*/
|
|
112
83
|
allowedJurisdictions(allowedJurisdictions: number[][]): DeploymentBuilder;
|
|
84
|
+
/**
|
|
85
|
+
* Set the specific nodes that will be allocated to this zk contract.
|
|
86
|
+
*
|
|
87
|
+
* <p>This argument is not allowed if trying to deploy a public contract. It is not required if
|
|
88
|
+
* deploying a zk contract and nodes will by default be allocated according to the {@link #allowedJurisdictions}.
|
|
89
|
+
*
|
|
90
|
+
* @param nodes nodes to be allocated to this contract
|
|
91
|
+
* @returns this builder
|
|
92
|
+
*/
|
|
93
|
+
specificNodes(nodes: [string, string, string, string]): DeploymentBuilder;
|
|
113
94
|
/**
|
|
114
95
|
* Set the required stakes from the nodes selected for the deployed zk contract.
|
|
115
96
|
*
|
|
@@ -122,16 +103,6 @@ export declare class DeploymentBuilder {
|
|
|
122
103
|
* @returns this builder
|
|
123
104
|
*/
|
|
124
105
|
requiredStakes(requiredStakes: number): DeploymentBuilder;
|
|
125
|
-
/**
|
|
126
|
-
* Set the binder id used to determine which binder to deploy the contract with.
|
|
127
|
-
*
|
|
128
|
-
* <p>This argument is not required. By default it will read the state of the deploy contract to
|
|
129
|
-
* find a binder which supports the given contract.
|
|
130
|
-
*
|
|
131
|
-
* @param binderId binder id
|
|
132
|
-
* @returns this builder
|
|
133
|
-
*/
|
|
134
|
-
binderId(binderId: number): DeploymentBuilder;
|
|
135
106
|
/**
|
|
136
107
|
* Set the gas cost used to deploy the contract.
|
|
137
108
|
*
|
|
@@ -167,11 +138,101 @@ export declare class DeploymentBuilder {
|
|
|
167
138
|
deploy(): Promise<DeployResult>;
|
|
168
139
|
private validateRequiredParameters;
|
|
169
140
|
private validateOptionalParameters;
|
|
170
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Validate that the supplied contracts can be deployed.
|
|
143
|
+
*/
|
|
144
|
+
validateContract(): Promise<ValidationResult>;
|
|
171
145
|
private realDeployRpc;
|
|
172
|
-
private pubDeployRpc;
|
|
173
146
|
private getInitializationBytes;
|
|
147
|
+
getPubState(): Promise<PubState | undefined>;
|
|
148
|
+
getRealState(): Promise<RealState | undefined>;
|
|
149
|
+
private getContractState;
|
|
150
|
+
/**
|
|
151
|
+
* Validate that the supplied pbc file can be deployed using a deploy contract with the given
|
|
152
|
+
* state.
|
|
153
|
+
*
|
|
154
|
+
* @param pubState state of the public deploy contract
|
|
155
|
+
* @param realState state of the REAL deploy contract
|
|
156
|
+
* @param pbcFile the contract files as a pbc file
|
|
157
|
+
* @return a validation result containing either the successful validation or the error message
|
|
158
|
+
*/
|
|
159
|
+
static validateContract(pubState: PubState | undefined, realState: RealState | undefined, pbcFile: Buffer | PbcFile | undefined): ValidationResult;
|
|
160
|
+
/**
|
|
161
|
+
* Create rpc needed for a deployment of public contract from a successful validation result and
|
|
162
|
+
* the contract initialization rpc.
|
|
163
|
+
*
|
|
164
|
+
* @param pubDeployAbi abi for the public deployment contract
|
|
165
|
+
* @param validationResult the successful deployment result
|
|
166
|
+
* @param initRpc the contract's initialization rpc
|
|
167
|
+
* @return the deployment rpc
|
|
168
|
+
*/
|
|
169
|
+
static createPubDeployRpc(pubDeployAbi: ContractAbi, validationResult: ValidationSuccess, initRpc: Buffer): Buffer;
|
|
170
|
+
/**
|
|
171
|
+
* Create rpc needed for a deployment of REAL contract from a successful validation result and
|
|
172
|
+
* extra arguments.
|
|
173
|
+
*
|
|
174
|
+
* @param realDeployAbi abi for the REAL deployment contract
|
|
175
|
+
* @param validationResult the successful deployment result
|
|
176
|
+
* @param initRpc the contract's initialization rpc
|
|
177
|
+
* @param requiredStakes required stakes for the nodes to allocate towards this contract. If null
|
|
178
|
+
* a default of 2000 MPC is used.
|
|
179
|
+
* @param allowedJurisdictions the jurisdictions that the nodes can be chosen from. If null all
|
|
180
|
+
* jurisdictions are allowed.
|
|
181
|
+
* @return the deployment rpc
|
|
182
|
+
*/
|
|
183
|
+
static createRealDeployRpc(realDeployAbi: ContractAbi, validationResult: ValidationSuccess, initRpc: Buffer, requiredStakes?: number, allowedJurisdictions?: number[][]): Buffer;
|
|
184
|
+
/**
|
|
185
|
+
* Create rpc needed for a deployment of REAL contract with specific nodes from a successful
|
|
186
|
+
* validation result and extra arguments.
|
|
187
|
+
*
|
|
188
|
+
* @param realDeployAbi abi for the REAL deployment contract
|
|
189
|
+
* @param validationResult the successful deployment result
|
|
190
|
+
* @param initRpc the contract's initialization rpc
|
|
191
|
+
* @param requiredStakes required stakes for the nodes to allocate towards this contract. If null
|
|
192
|
+
* a default of 2000 MPC is used.
|
|
193
|
+
* @param specificNodes list of 4 nodes that will be allocated to this contract
|
|
194
|
+
* @return the deployment rpc
|
|
195
|
+
*/
|
|
196
|
+
static createRealDeployRpc(realDeployAbi: ContractAbi, validationResult: ValidationSuccess, initRpc: Buffer, requiredStakes: number | undefined, specificNodes: [string, string, string, string]): Buffer;
|
|
174
197
|
}
|
|
175
|
-
export declare function
|
|
176
|
-
export declare function findBinderId(binders:
|
|
198
|
+
export declare function parsePubState(abi: Buffer, serializedContract: Buffer): PubState;
|
|
199
|
+
export declare function findBinderId(binders: {
|
|
200
|
+
[binderId: number]: {
|
|
201
|
+
versionInterval: VersionInterval;
|
|
202
|
+
};
|
|
203
|
+
}, binderVersion: AbiVersion): number | undefined;
|
|
177
204
|
export declare function findFailureCause(transactionTree: TransactionTree): string | undefined;
|
|
205
|
+
export declare function parseAbi(abiBytes: Buffer): Result<FileAbi, ValidationResult>;
|
|
206
|
+
export declare function unsupportedBinderError(abi: FileAbi, binders: {
|
|
207
|
+
[binderId: number]: {
|
|
208
|
+
versionInterval: VersionInterval;
|
|
209
|
+
};
|
|
210
|
+
}): ValidationResult;
|
|
211
|
+
export declare function unsupportedBinderDetails(contractVersion: Version, supportedVersions: Version[]): string[];
|
|
212
|
+
export declare function isSupported(zkbcVersion: Version, supportedZkbcVersionMax: Version): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Parse and validate that the ABI is well-formed.
|
|
215
|
+
*
|
|
216
|
+
* @param pbcFile pbc file to validate
|
|
217
|
+
* @return result of the parsed abi of the error if it couldn't be parsed
|
|
218
|
+
*/
|
|
219
|
+
export declare function validateInputFiles(pbcFile: Buffer | PbcFile | undefined): Result<InputFiles, ValidationResult>;
|
|
220
|
+
/**
|
|
221
|
+
* Validate that the there exists a public binder that the supports the contract being deployed.
|
|
222
|
+
*
|
|
223
|
+
* @param pubState state of public deploy contract
|
|
224
|
+
* @param abi parsed abi of the contract to be deployed
|
|
225
|
+
* @param pbcFile pbc file containing the contract files
|
|
226
|
+
* @return a validation result containing either the successful validation or the error message
|
|
227
|
+
*/
|
|
228
|
+
export declare function validatePubVersions(pubState: PubState | undefined, abi: FileAbi, pbcFile: PbcFile): ValidationResult;
|
|
229
|
+
/**
|
|
230
|
+
* Validate that the there exists a REAL binder that the supports the contract being deployed.
|
|
231
|
+
*
|
|
232
|
+
* @param realState state of REAL deploy contract
|
|
233
|
+
* @param abi parsed abi of the contract to be deployed
|
|
234
|
+
* @param pbcFile pbc file containing the contract files
|
|
235
|
+
* @return a validation result containing either the successful validation or the error message
|
|
236
|
+
*/
|
|
237
|
+
export declare function validateRealVersions(realState: RealState | undefined, abi: FileAbi, pbcFile: PbcFile): ValidationResult;
|
|
238
|
+
export declare function isSpecificNodes(nodeSelection: number[][] | [string, string, string, string] | undefined): nodeSelection is [string, string, string, string];
|