@taqueria/plugin-taquito 0.3.0 → 0.4.0-rc2
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/README.md +26 -18
- package/_readme.eta +44 -0
- package/index.js +76 -66
- package/index.js.map +1 -1
- package/index.ts +19 -21
- package/originate.ts +221 -177
- package/package.json +52 -52
- package/tsconfig.json +91 -91
package/README.md
CHANGED
|
@@ -1,34 +1,42 @@
|
|
|
1
1
|
# Taqueria Taquito Plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Taquito plugin provides a task to originate a smart contract to a Tezos network
|
|
4
4
|
|
|
5
|
+
## Requirements
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
The Taquito plugin has no additional requirements
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
## Installation
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
To install the Taquito plugin on a Taqueria project, navigate to the project folder and run:
|
|
12
|
+
```shell
|
|
13
|
+
taq install @taqueria/plugin-taquito
|
|
14
|
+
```
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
- `originate`
|
|
16
|
+
## Configuration
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
***Coming soon***
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
- Node.js v16 or later
|
|
19
|
-
- Docker v0.8.4 or later
|
|
20
|
+
## Usage
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
The Taquito plugin exposes an `originate` task in Taqueria which will originate the specified Michelson contract to the configured network
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
### Originating a Michelson Contract
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
***Coming soon***
|
|
27
|
+
|
|
28
|
+
### Examples
|
|
29
|
+
|
|
30
|
+
***Coming soon***
|
|
29
31
|
|
|
30
32
|
## Plugin Architecture
|
|
31
33
|
|
|
32
|
-
This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK
|
|
34
|
+
This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK
|
|
35
|
+
|
|
36
|
+
The plugin provides a single task `originate`, used for originating Michelson contracts to a Tezos network:
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
| attribute | value |
|
|
39
|
+
|------------|:-------------------------|
|
|
40
|
+
| task | 'deploy' |
|
|
41
|
+
| command | 'deploy [contract]` |
|
|
42
|
+
| aliases | ['originate'] |
|
package/_readme.eta
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<% if (it.output == "github") { %>
|
|
2
|
+
# Taqueria Taquito Plugin
|
|
3
|
+
<% } %>
|
|
4
|
+
|
|
5
|
+
The Taquito plugin provides a task to originate a smart contract to a Tezos network
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
The Taquito plugin has no additional requirements
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
To install the Taquito plugin on a Taqueria project, navigate to the project folder and run:
|
|
14
|
+
```shell
|
|
15
|
+
taq install @taqueria/plugin-taquito
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Configuration
|
|
19
|
+
|
|
20
|
+
***Coming soon***
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
The Taquito plugin exposes an `originate` task in Taqueria which will originate the specified Michelson contract to the configured network
|
|
25
|
+
|
|
26
|
+
### Originating a Michelson Contract
|
|
27
|
+
|
|
28
|
+
***Coming soon***
|
|
29
|
+
|
|
30
|
+
### Examples
|
|
31
|
+
|
|
32
|
+
***Coming soon***
|
|
33
|
+
|
|
34
|
+
## Plugin Architecture
|
|
35
|
+
|
|
36
|
+
This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK
|
|
37
|
+
|
|
38
|
+
The plugin provides a single task `originate`, used for originating Michelson contracts to a Tezos network:
|
|
39
|
+
|
|
40
|
+
| attribute | value |
|
|
41
|
+
|------------|:-------------------------|
|
|
42
|
+
| task | 'deploy' |
|
|
43
|
+
| command | 'deploy [contract]` |
|
|
44
|
+
| aliases | ['originate'] |
|
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var $iVZbm$taquerianodesdk = require("@taqueria/node-sdk");
|
|
2
|
-
var $iVZbm$
|
|
3
|
-
var $iVZbm$path = require("path");
|
|
2
|
+
var $iVZbm$taquitosigner = require("@taquito/signer");
|
|
4
3
|
var $iVZbm$taquitotaquito = require("@taquito/taquito");
|
|
4
|
+
var $iVZbm$fastglob = require("fast-glob");
|
|
5
5
|
var $iVZbm$fspromises = require("fs/promises");
|
|
6
|
-
var $iVZbm$
|
|
6
|
+
var $iVZbm$path = require("path");
|
|
7
7
|
|
|
8
8
|
function $parcel$interopDefault(a) {
|
|
9
9
|
return a && a.__esModule ? a.default : a;
|
|
@@ -15,26 +15,28 @@ function $parcel$interopDefault(a) {
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
const $806c5c6032403442$var$
|
|
19
|
-
;
|
|
18
|
+
const $806c5c6032403442$var$getFirstAccountAlias = (sandboxName, opts)=>{
|
|
19
|
+
const aliases = (0, $iVZbm$taquerianodesdk.getSandboxAccountNames)(opts)(sandboxName);
|
|
20
|
+
return aliases.shift();
|
|
21
|
+
};
|
|
22
|
+
const $806c5c6032403442$var$getContractAbspath = (contractFilename, parsedArgs)=>(0, $iVZbm$path.join)(parsedArgs.config.artifactsDir, /\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);
|
|
20
23
|
const $806c5c6032403442$var$addOrigination = (parsedArgs, batch)=>async (mapping)=>{
|
|
21
24
|
const contractAbspath = $806c5c6032403442$var$getContractAbspath(mapping.filename, parsedArgs);
|
|
22
|
-
const contractData = await $iVZbm$fspromises.readFile(contractAbspath, "utf-8");
|
|
25
|
+
const contractData = await (0, $iVZbm$fspromises.readFile)(contractAbspath, "utf-8");
|
|
23
26
|
return (await batch).withOrigination({
|
|
24
27
|
code: contractData,
|
|
25
28
|
storage: mapping.storage
|
|
26
29
|
});
|
|
27
|
-
}
|
|
28
|
-
;
|
|
30
|
+
};
|
|
29
31
|
const $806c5c6032403442$var$getValidContracts = async (parsedArgs)=>{
|
|
30
32
|
const contracts = parsedArgs.contract ? [
|
|
31
33
|
parsedArgs.contract
|
|
32
|
-
] : await ($parcel$interopDefault($iVZbm$fastglob))("**/*.tz", {
|
|
33
|
-
cwd: parsedArgs.artifactsDir
|
|
34
|
+
] : await (0, ($parcel$interopDefault($iVZbm$fastglob)))("**/*.tz", {
|
|
35
|
+
cwd: parsedArgs.config.artifactsDir
|
|
34
36
|
});
|
|
35
37
|
return contracts.reduce((retval, filename)=>{
|
|
36
|
-
const storage = $iVZbm$taquerianodesdk.getInitialStorage(parsedArgs)(filename);
|
|
37
|
-
if (
|
|
38
|
+
const storage = (0, $iVZbm$taquerianodesdk.getInitialStorage)(parsedArgs)(filename);
|
|
39
|
+
if (storage === undefined || storage === null) throw `No initial storage provided for ${filename}`;
|
|
38
40
|
return [
|
|
39
41
|
...retval,
|
|
40
42
|
{
|
|
@@ -45,21 +47,23 @@ const $806c5c6032403442$var$getValidContracts = async (parsedArgs)=>{
|
|
|
45
47
|
}, []);
|
|
46
48
|
};
|
|
47
49
|
const $806c5c6032403442$var$mapOpToContract = async (contracts, op, destination)=>{
|
|
48
|
-
debugger;
|
|
49
50
|
const results = await op.operationResults();
|
|
50
51
|
return contracts.reduce((retval, contract)=>{
|
|
51
52
|
// If initial storage was provided for the contract
|
|
52
53
|
// then we submitted an operation to originate that contract
|
|
53
54
|
if (contract.storage) {
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
// WARNING - using side effect here.
|
|
56
|
+
// For each iteration of reduce, results array is being modified-in-place.
|
|
57
|
+
// TODO: Adjust to use recursion to avoid side-effect.
|
|
58
|
+
const result = results.shift();
|
|
59
|
+
const address = result && result.metadata.operation_result.originated_contracts ? result.metadata.operation_result.originated_contracts.join(",") : "Error";
|
|
56
60
|
return [
|
|
57
61
|
...retval,
|
|
58
62
|
{
|
|
59
63
|
contract: contract.filename,
|
|
60
64
|
address: address,
|
|
61
65
|
destination: destination
|
|
62
|
-
}
|
|
66
|
+
},
|
|
63
67
|
];
|
|
64
68
|
}
|
|
65
69
|
return [
|
|
@@ -68,88 +72,95 @@ const $806c5c6032403442$var$mapOpToContract = async (contracts, op, destination)
|
|
|
68
72
|
contract: contract.filename,
|
|
69
73
|
address: "Error",
|
|
70
74
|
destination: destination
|
|
71
|
-
}
|
|
75
|
+
},
|
|
72
76
|
];
|
|
73
77
|
}, []);
|
|
74
78
|
};
|
|
75
79
|
const $806c5c6032403442$var$createBatch = async (parsedArgs, tezos, destination)=>{
|
|
76
80
|
const contracts = await $806c5c6032403442$var$getValidContracts(parsedArgs);
|
|
77
|
-
const batch1 = await contracts.reduce((batch, contractMapping)=>contractMapping.storage ? $806c5c6032403442$var$addOrigination(parsedArgs, batch)(contractMapping) : batch
|
|
78
|
-
, Promise.resolve(tezos.wallet.batch()));
|
|
81
|
+
const batch1 = await contracts.reduce((batch, contractMapping)=>contractMapping.storage ? $806c5c6032403442$var$addOrigination(parsedArgs, batch)(contractMapping) : batch, Promise.resolve(tezos.wallet.batch()));
|
|
79
82
|
try {
|
|
80
83
|
const op = await batch1.send();
|
|
81
84
|
const confirmed = await op.confirmation();
|
|
82
85
|
return await $806c5c6032403442$var$mapOpToContract(contracts, op, destination);
|
|
83
86
|
} catch (err) {
|
|
84
87
|
const error = err;
|
|
85
|
-
if (error.message) $iVZbm$taquerianodesdk.sendErr(error.message);
|
|
88
|
+
if (error.message) (0, $iVZbm$taquerianodesdk.sendErr)(error.message);
|
|
86
89
|
return undefined;
|
|
87
90
|
}
|
|
88
91
|
};
|
|
89
92
|
const $806c5c6032403442$var$originateToNetworks = (parsedArgs, currentEnv)=>currentEnv.networks ? currentEnv.networks.reduce((retval, networkName)=>{
|
|
90
|
-
const network = $iVZbm$taquerianodesdk.getNetworkConfig(parsedArgs)(networkName);
|
|
91
|
-
if (network
|
|
92
|
-
if (network.
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
const network = (0, $iVZbm$taquerianodesdk.getNetworkConfig)(parsedArgs)(networkName);
|
|
94
|
+
if (network) {
|
|
95
|
+
if (network.rpcUrl) {
|
|
96
|
+
if (network.faucet) {
|
|
97
|
+
const result = (async ()=>{
|
|
98
|
+
const tezos = new (0, $iVZbm$taquitotaquito.TezosToolkit)(network.rpcUrl);
|
|
99
|
+
await (0, $iVZbm$taquitosigner.importKey)(tezos, network.faucet.email, network.faucet.password, network.faucet.mnemonic.join(" "), network.faucet.activation_code);
|
|
100
|
+
return await $806c5c6032403442$var$createBatch(parsedArgs, tezos, networkName);
|
|
101
|
+
})();
|
|
102
|
+
return [
|
|
103
|
+
...retval,
|
|
104
|
+
result
|
|
105
|
+
];
|
|
106
|
+
} else (0, $iVZbm$taquerianodesdk.sendErr)(`Network ${networkName} requires a valid faucet in config.json.`);
|
|
107
|
+
} else (0, $iVZbm$taquerianodesdk.sendErr)(`Network "${networkName} is missing an RPC url in config.json."`);
|
|
108
|
+
} else (0, $iVZbm$taquerianodesdk.sendErr)(`The current environment is configured to use a network called '${networkName}'; however, no network of this name has been configured in .taq/config.json.`);
|
|
104
109
|
return retval;
|
|
105
|
-
}, []) : []
|
|
106
|
-
;
|
|
110
|
+
}, []) : [];
|
|
107
111
|
const $806c5c6032403442$var$originateToSandboxes = (parsedArgs, currentEnv)=>currentEnv.sandboxes ? currentEnv.sandboxes.reduce((retval, sandboxName)=>{
|
|
108
|
-
const sandbox = $iVZbm$taquerianodesdk.getSandboxConfig(parsedArgs)(sandboxName);
|
|
109
|
-
if (sandbox
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
result
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
const sandbox = (0, $iVZbm$taquerianodesdk.getSandboxConfig)(parsedArgs)(sandboxName);
|
|
113
|
+
if (sandbox) {
|
|
114
|
+
if (sandbox.rpcUrl) {
|
|
115
|
+
let defaultAccount = (0, $iVZbm$taquerianodesdk.getDefaultAccount)(parsedArgs)(sandboxName);
|
|
116
|
+
if (!defaultAccount) {
|
|
117
|
+
const first = $806c5c6032403442$var$getFirstAccountAlias(sandboxName, parsedArgs);
|
|
118
|
+
if (first) {
|
|
119
|
+
defaultAccount = (0, $iVZbm$taquerianodesdk.getSandboxAccountConfig)(parsedArgs)(sandboxName)(first);
|
|
120
|
+
(0, $iVZbm$taquerianodesdk.sendErr)(`No default account has been configured for the sandbox called ${sandboxName}. Using the account called ${first} for origination.`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (defaultAccount) {
|
|
124
|
+
const secretKey = defaultAccount.secretKey;
|
|
125
|
+
const result = (async ()=>{
|
|
126
|
+
const tezos = new (0, $iVZbm$taquitotaquito.TezosToolkit)(sandbox.rpcUrl);
|
|
127
|
+
tezos.setProvider({
|
|
128
|
+
signer: new (0, $iVZbm$taquitosigner.InMemorySigner)(secretKey.replace(/^unencrypted:/, ""))
|
|
129
|
+
});
|
|
130
|
+
return await $806c5c6032403442$var$createBatch(parsedArgs, tezos, sandboxName);
|
|
131
|
+
})();
|
|
132
|
+
return [
|
|
133
|
+
...retval,
|
|
134
|
+
result
|
|
135
|
+
];
|
|
136
|
+
} else (0, $iVZbm$taquerianodesdk.sendErr)(`No accounts are available for the sandbox called ${sandboxName} to perform origination.`);
|
|
137
|
+
} else (0, $iVZbm$taquerianodesdk.sendErr)(`Sandbox "${sandboxName} is missing an RPC url in config.json."`);
|
|
138
|
+
} else (0, $iVZbm$taquerianodesdk.sendErr)(`The current environment is configured to use a sandbox called '${sandboxName}'; however, no sandbox of this name has been configured in .taq/config.json.`);
|
|
125
139
|
return retval;
|
|
126
|
-
}, []) : []
|
|
127
|
-
;
|
|
140
|
+
}, []) : [];
|
|
128
141
|
const $806c5c6032403442$export$acf571c34911f824 = (parsedArgs)=>{
|
|
129
|
-
const env = $iVZbm$taquerianodesdk.getCurrentEnvironmentConfig(parsedArgs);
|
|
130
|
-
if (!env) return $iVZbm$taquerianodesdk.sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);
|
|
142
|
+
const env = (0, $iVZbm$taquerianodesdk.getCurrentEnvironmentConfig)(parsedArgs);
|
|
143
|
+
if (!env) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`There is no environment called ${parsedArgs.env} in your config.json.`);
|
|
131
144
|
const jobs1 = [
|
|
132
145
|
...$806c5c6032403442$var$originateToNetworks(parsedArgs, env),
|
|
133
|
-
...$806c5c6032403442$var$originateToSandboxes(parsedArgs, env)
|
|
146
|
+
...$806c5c6032403442$var$originateToSandboxes(parsedArgs, env),
|
|
134
147
|
];
|
|
135
148
|
return Promise.all(jobs1).then((jobs)=>jobs.reduce((retval, originations)=>{
|
|
136
149
|
return originations ? [
|
|
137
150
|
...retval,
|
|
138
151
|
...originations
|
|
139
152
|
] : retval;
|
|
140
|
-
}, [])
|
|
141
|
-
).then((results)=>results && results.length > 0 ? $iVZbm$taquerianodesdk.sendJsonRes(results) : $iVZbm$taquerianodesdk.sendErr(`No contracts originated.`)
|
|
142
|
-
);
|
|
153
|
+
}, [])).then((results)=>results && results.length > 0 ? (0, $iVZbm$taquerianodesdk.sendJsonRes)(results) : (0, $iVZbm$taquerianodesdk.sendErr)(`No contracts originated.`));
|
|
143
154
|
};
|
|
144
155
|
var $806c5c6032403442$export$2e2bcd8739ae039 = $806c5c6032403442$export$acf571c34911f824;
|
|
145
156
|
|
|
146
157
|
|
|
147
|
-
$iVZbm$taquerianodesdk.Plugin.create((
|
|
158
|
+
(0, $iVZbm$taquerianodesdk.Plugin).create((_i18n)=>({
|
|
148
159
|
alias: "taquito",
|
|
149
160
|
schema: "1.0",
|
|
150
161
|
version: "0.1",
|
|
151
162
|
tasks: [
|
|
152
|
-
$iVZbm$taquerianodesdk.Task.create({
|
|
163
|
+
(0, $iVZbm$taquerianodesdk.Task).create({
|
|
153
164
|
task: "deploy",
|
|
154
165
|
command: "deploy [contract]",
|
|
155
166
|
description: "Deploy a smart contract to a particular environment",
|
|
@@ -161,9 +172,8 @@ $iVZbm$taquerianodesdk.Plugin.create((i18n)=>({
|
|
|
161
172
|
encoding: "application/json"
|
|
162
173
|
}),
|
|
163
174
|
],
|
|
164
|
-
proxy: $806c5c6032403442$export$2e2bcd8739ae039
|
|
165
|
-
})
|
|
166
|
-
, process.argv);
|
|
175
|
+
proxy: (0, $806c5c6032403442$export$2e2bcd8739ae039)
|
|
176
|
+
}), process.argv);
|
|
167
177
|
|
|
168
178
|
|
|
169
179
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;ACAA;;;;;;AAuBA,MAAM,wCAAkB,GAAG,CAAC,gBAAwB,EAAE,UAAgB,GAClE,gBAAI,CAAC,UAAU,CAAC,YAAY,EAAE,QAAQ,IAAI,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAAA;AAE/G,MAAM,oCAAc,GAAG,CAAC,UAAgB,EAAE,KAAoC,GAAK,OAAO,OAA+B,GAAK;QAC1H,MAAM,eAAe,GAAG,wCAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC;QACxE,MAAM,YAAY,GAAG,MAAM,0BAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;QAC7D,OAAO,AAAC,CAAA,MAAM,KAAK,CAAA,CAAE,eAAe,CAAC;YACjC,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,OAAO,CAAC,OAAO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AC3B,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACH,2BAAI,CAAC,MAAM,CAAC;gBACR,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,mBAAmB;gBAC5B,WAAW,EAAE,qDAAqD;gBAClE,OAAO,EAAE,EACR;gBACD,OAAO,EAAE;oBAAC,WAAW;iBAAC;gBACtB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,kBAAkB;aAC/B,CAAC;SACL;QACD,KAAK,EAAE,wCAAS;KACnB,CAAA;AAAC,EAAE,OAAO,CAAC,IAAI,CAAC","sources":["taqueria-plugin-taquito/index.ts","taqueria-plugin-taquito/originate.ts"],"sourcesContent":["import {Plugin, Task} from '@taqueria/node-sdk'\nimport type { i18n} from '@taqueria/node-sdk/types'\nimport originate from './originate'\n\nPlugin.create((i18n: i18n) => ({\n alias: \"taquito\",\n schema: \"1.0\",\n version: \"0.1\",\n tasks: [\n Task.create({\n task: \"deploy\",\n command: \"deploy [contract]\",\n description: \"Deploy a smart contract to a particular environment\",\n options: [\n ],\n aliases: [\"originate\"],\n handler: \"proxy\",\n encoding: \"application/json\"\n }),\n ],\n proxy: originate\n}), process.argv)\n","import { SanitizedArgs, PluginResponse, AccountDetails, Failure, LikeAPromise, Config, NetworkConfig, SandboxConfig, EnvironmentConfig} from \"@taqueria/node-sdk/types\";\nimport glob from 'fast-glob'\nimport {join} from 'path'\nimport { TezosToolkit, OriginateParams, WalletOperationBatch } from '@taquito/taquito';\nimport {readFile} from 'fs/promises'\nimport { InMemorySigner, importKey } from '@taquito/signer';\nimport { sendAsyncJsonRes, getCurrentEnvironmentConfig, getNetworkConfig, getSandboxAccountConfig, getInitialStorage, sendErr, getSandboxConfig, getDefaultAccount, sendJsonRes, sendAsyncErr } from \"@taqueria/node-sdk\";\nimport { BatchWalletOperation } from \"@taquito/taquito/dist/types/wallet/batch-operation\";\nimport { OperationContentsAndResultOrigination } from \"@taquito/rpc\";\n\ntype Opts = SanitizedArgs & Record<string, unknown>\n\ninterface ContractStorageMapping {\n filename: string,\n storage?: unknown\n}\n\ninterface OriginationResult {\n contract: string\n address: string\n destination: string\n}\n\nconst getContractAbspath = (contractFilename: string, parsedArgs: Opts) => \n join(parsedArgs.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`)\n\nconst addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) => async (mapping: ContractStorageMapping) => {\n const contractAbspath = getContractAbspath(mapping.filename, parsedArgs)\n const contractData = await readFile(contractAbspath, \"utf-8\")\n return (await batch).withOrigination({\n code: contractData,\n storage: mapping.storage,\n \n })\n}\n\nconst getValidContracts = async (parsedArgs: Opts) => {\n const contracts = parsedArgs.contract\n ? [parsedArgs.contract as string]\n : (await glob(\"**/*.tz\", {cwd: parsedArgs.artifactsDir})) as string[] \n\n return contracts.reduce(\n (retval, filename) => {\n const storage = getInitialStorage(parsedArgs) (filename)\n if (!storage) throw(`No initial storage provided for ${filename}`)\n return [...retval, {filename, storage}]\n },\n [] as ContractStorageMapping[]\n ) \n}\n\nconst mapOpToContract = async (contracts: ContractStorageMapping[], op: BatchWalletOperation, destination: string) => {\n debugger\n const results = await op.operationResults()\n\n return contracts.reduce(\n (retval, contract) => {\n\n // If initial storage was provided for the contract\n // then we submitted an operation to originate that contract\n if (contract.storage) {\n const result = results.pop() as OperationContentsAndResultOrigination\n const address = result && result.metadata.operation_result.originated_contracts\n ? result.metadata.operation_result.originated_contracts.join(',')\n : 'Error'\n\n return [\n ...retval, {\n contract: contract.filename,\n address,\n destination\n }\n ]\n }\n\n return [\n ...retval, {\n contract: contract.filename,\n address: \"Error\",\n destination\n }\n ]\n },\n [] as OriginationResult[]\n )\n}\n\n\nconst createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: string) => {\n const contracts = await getValidContracts (parsedArgs) \n \n const batch = await contracts.reduce(\n (batch, contractMapping) => \n contractMapping.storage\n ? addOrigination(parsedArgs, batch) (contractMapping)\n : batch,\n Promise.resolve(tezos.wallet.batch())\n )\n \n try {\n const op = await batch.send()\n const confirmed = await op.confirmation()\n return await mapOpToContract(contracts, op, destination)\n }\n catch (err) {\n const error = (err as {message: string})\n if (error.message) sendErr(error.message)\n return undefined\n }\n}\n\nconst originateToNetworks = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>\n currentEnv.networks\n ? currentEnv.networks.reduce(\n (retval, networkName) => {\n const network = getNetworkConfig (parsedArgs) (networkName)\n if (network.rpcUrl) {\n if (network.faucet) {\n const result = (async () => {\n const tezos = new TezosToolkit(network.rpcUrl as string)\n await importKey(tezos, network.faucet.email, network.faucet.password, network.faucet.mnemonic.join(' '), network.faucet.activation_code)\n return await createBatch(parsedArgs, tezos, networkName)\n })()\n\n return [...retval, result]\n }\n else sendErr(`Network ${networkName} requires a valid faucet in config.json.`)\n }\n else sendErr(`Network \"${networkName} is missing an RPC url in config.json.\"`)\n return retval\n },\n [] as Promise<OriginationResult[]|undefined>[]\n )\n : []\n\nconst originateToSandboxes = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>\n currentEnv.sandboxes\n ? currentEnv.sandboxes.reduce(\n (retval, sandboxName) => {\n const sandbox = getSandboxConfig (parsedArgs) (sandboxName)\n if (sandbox.rpcUrl) {\n const secretKey = getDefaultAccount(parsedArgs) (sandboxName) ?.keys?.secretKey\n if (secretKey) {\n const result = (async () => {\n const tezos = new TezosToolkit(sandbox.rpcUrl as string)\n tezos.setProvider({\n signer: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),\n });\n return await createBatch(parsedArgs, tezos, sandboxName)\n })()\n \n return [...retval, result]\n }\n else sendErr(`Sandbox ${sandboxName}'s default account is missing keys in config.json.`)\n }\n else sendErr(`Sandbox \"${sandboxName} is missing an RPC url in config.json.\"`)\n\n return retval\n },\n [] as Promise<OriginationResult[]|undefined>[]\n )\n : []\n \n \n\nexport const originate = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\n const env = getCurrentEnvironmentConfig(parsedArgs)\n\n if (!env) {\n return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`)\n }\n\n const jobs = [\n ...originateToNetworks(parsedArgs, env),\n ...originateToSandboxes(parsedArgs, env)\n ]\n\n return Promise.all(jobs)\n .then(jobs => jobs.reduce(\n (retval, originations) => {\n return originations\n ? [...retval as OriginationResult[], ...originations]\n : retval\n },\n []\n ))\n .then(results => results && results.length > 0 ? sendJsonRes(results): sendErr(`No contracts originated.`))\n}\n\nexport default originate\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;ACAA;;;;;;AAoCA,MAAM,0CAAoB,GAAG,CAAC,WAAmB,EAAE,IAAU,GAAK;IACjE,MAAM,OAAO,GAAG,CAAA,GAAA,6CAAsB,CAAA,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,AAAC;IAC1D,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;CACvB,AAAC;AAEF,MAAM,wCAAkB,GAAG,CAAC,gBAAwB,EAAE,UAAgB,GACrE,CAAA,GAAA,gBAAI,CAAA,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,IAAI,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,AAAC;AAEpH,MAAM,oCAAc,GAAG,CAAC,UAAgB,EAAE,KAAoC,GAC7E,OAAO,OAA+B,GAAK;QAC1C,MAAM,eAAe,GAAG,wCAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,AAAC;QACzE,MAAM,YAAY,GAAG,MAAM,CAAA,GAAA,0BAAQ,CAAA,CAAC,eAAe,EAAE,OAAO,CAAC,AAAC;QAC9D,OAAO,AAAC,CAAA,MAAM,KAAK,CAAA,CAAE,eAAe,CAAC;YACpC,IAAI,EAAE,YAAY;YAClB,OAA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K,EAAE,SAAS;QAChB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACN,CAAA,GAAA,2BAAI,CAAA,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,mBAAmB;gBAC5B,WAAW,EAAE,qDAAqD;gBAClE,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE;oBAAC,WAAW;iBAAC;gBACtB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,kBAAkB;aAC5B,CAAC;SACF;QACD,KAAK,EAAE,CAAA,GAAA,wCAAS,CAAA;KAChB,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-taquito/index.ts","taqueria-plugin-taquito/originate.ts"],"sourcesContent":["import { Plugin, Task } from '@taqueria/node-sdk';\nimport originate from './originate';\n\nPlugin.create(_i18n => ({\n\talias: 'taquito',\n\tschema: '1.0',\n\tversion: '0.1',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'deploy',\n\t\t\tcommand: 'deploy [contract]',\n\t\t\tdescription: 'Deploy a smart contract to a particular environment',\n\t\t\toptions: [],\n\t\t\taliases: ['originate'],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t],\n\tproxy: originate,\n}), process.argv);\n","import {\n\tgetCurrentEnvironmentConfig,\n\tgetDefaultAccount,\n\tgetInitialStorage,\n\tgetNetworkConfig,\n\tgetSandboxAccountConfig,\n\tgetSandboxAccountNames,\n\tgetSandboxConfig,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n} from '@taqueria/node-sdk';\nimport { LikeAPromise, PluginResponse, Protocol, RequestArgs, TaqError } from '@taqueria/node-sdk/types';\nimport { OperationContentsAndResultOrigination } from '@taquito/rpc';\nimport { importKey, InMemorySigner } from '@taquito/signer';\nimport { TezosToolkit, WalletOperationBatch } from '@taquito/taquito';\nimport { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';\nimport glob from 'fast-glob';\nimport { readFile } from 'fs/promises';\nimport { join } from 'path';\n\ninterface Opts extends RequestArgs.t {\n\tcontract?: string;\n}\n\ninterface ContractStorageMapping {\n\tfilename: string;\n\tstorage?: unknown;\n}\n\ninterface OriginationResult {\n\tcontract: string;\n\taddress: string;\n\tdestination: string;\n}\n\nconst getFirstAccountAlias = (sandboxName: string, opts: Opts) => {\n\tconst aliases = getSandboxAccountNames(opts)(sandboxName);\n\treturn aliases.shift();\n};\n\nconst getContractAbspath = (contractFilename: string, parsedArgs: Opts) =>\n\tjoin(parsedArgs.config.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);\n\nconst addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) =>\n\tasync (mapping: ContractStorageMapping) => {\n\t\tconst contractAbspath = getContractAbspath(mapping.filename, parsedArgs);\n\t\tconst contractData = await readFile(contractAbspath, 'utf-8');\n\t\treturn (await batch).withOrigination({\n\t\t\tcode: contractData,\n\t\t\tstorage: mapping.storage,\n\t\t});\n\t};\n\nconst getValidContracts = async (parsedArgs: Opts) => {\n\tconst contracts = parsedArgs.contract\n\t\t? [parsedArgs.contract]\n\t\t: (await glob('**/*.tz', { cwd: parsedArgs.config.artifactsDir })) as string[];\n\n\treturn contracts.reduce(\n\t\t(retval, filename) => {\n\t\t\tconst storage = getInitialStorage(parsedArgs)(filename);\n\t\t\tif (storage === undefined || storage === null) throw (`No initial storage provided for ${filename}`);\n\t\t\treturn [...retval, { filename, storage }];\n\t\t},\n\t\t[] as ContractStorageMapping[],\n\t);\n};\n\nconst mapOpToContract = async (contracts: ContractStorageMapping[], op: BatchWalletOperation, destination: string) => {\n\tconst results = await op.operationResults();\n\n\treturn contracts.reduce(\n\t\t(retval, contract) => {\n\t\t\t// If initial storage was provided for the contract\n\t\t\t// then we submitted an operation to originate that contract\n\t\t\tif (contract.storage) {\n\t\t\t\t// WARNING - using side effect here.\n\t\t\t\t// For each iteration of reduce, results array is being modified-in-place.\n\t\t\t\t// TODO: Adjust to use recursion to avoid side-effect.\n\t\t\t\tconst result = results.shift() as OperationContentsAndResultOrigination;\n\t\t\t\tconst address = result && result.metadata.operation_result.originated_contracts\n\t\t\t\t\t? result.metadata.operation_result.originated_contracts.join(',')\n\t\t\t\t\t: 'Error';\n\n\t\t\t\treturn [\n\t\t\t\t\t...retval,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontract: contract.filename,\n\t\t\t\t\t\taddress,\n\t\t\t\t\t\tdestination,\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t...retval,\n\t\t\t\t{\n\t\t\t\t\tcontract: contract.filename,\n\t\t\t\t\taddress: 'Error',\n\t\t\t\t\tdestination,\n\t\t\t\t},\n\t\t\t];\n\t\t},\n\t\t[] as OriginationResult[],\n\t);\n};\n\nconst createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: string) => {\n\tconst contracts = await getValidContracts(parsedArgs);\n\n\tconst batch = await contracts.reduce(\n\t\t(batch, contractMapping) =>\n\t\t\tcontractMapping.storage\n\t\t\t\t? addOrigination(parsedArgs, batch)(contractMapping)\n\t\t\t\t: batch,\n\t\tPromise.resolve(tezos.wallet.batch()),\n\t);\n\n\ttry {\n\t\tconst op = await batch.send();\n\t\tconst confirmed = await op.confirmation();\n\t\treturn await mapOpToContract(contracts, op, destination);\n\t} catch (err) {\n\t\tconst error = (err as { message: string });\n\t\tif (error.message) sendErr(error.message);\n\t\treturn undefined;\n\t}\n};\n\nconst originateToNetworks = (parsedArgs: Opts, currentEnv: Protocol.Environment.t) =>\n\tcurrentEnv.networks\n\t\t? currentEnv.networks.reduce(\n\t\t\t(retval, networkName) => {\n\t\t\t\tconst network = getNetworkConfig(parsedArgs)(networkName);\n\t\t\t\tif (network) {\n\t\t\t\t\tif (network.rpcUrl) {\n\t\t\t\t\t\tif (network.faucet) {\n\t\t\t\t\t\t\tconst result = (async () => {\n\t\t\t\t\t\t\t\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\t\t\t\t\t\t\t\tawait importKey(\n\t\t\t\t\t\t\t\t\ttezos,\n\t\t\t\t\t\t\t\t\tnetwork.faucet.email,\n\t\t\t\t\t\t\t\t\tnetwork.faucet.password,\n\t\t\t\t\t\t\t\t\tnetwork.faucet.mnemonic.join(' '),\n\t\t\t\t\t\t\t\t\tnetwork.faucet.activation_code,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn await createBatch(parsedArgs, tezos, networkName);\n\t\t\t\t\t\t\t})();\n\n\t\t\t\t\t\t\treturn [...retval, result];\n\t\t\t\t\t\t} else sendErr(`Network ${networkName} requires a valid faucet in config.json.`);\n\t\t\t\t\t} else sendErr(`Network \"${networkName} is missing an RPC url in config.json.\"`);\n\t\t\t\t} else {\n\t\t\t\t\tsendErr(\n\t\t\t\t\t\t`The current environment is configured to use a network called '${networkName}'; however, no network of this name has been configured in .taq/config.json.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn retval;\n\t\t\t},\n\t\t\t[] as Promise<OriginationResult[] | undefined>[],\n\t\t)\n\t\t: [];\n\nconst originateToSandboxes = (parsedArgs: Opts, currentEnv: Protocol.Environment.t) =>\n\tcurrentEnv.sandboxes\n\t\t? currentEnv.sandboxes.reduce(\n\t\t\t(retval, sandboxName) => {\n\t\t\t\tconst sandbox = getSandboxConfig(parsedArgs)(sandboxName);\n\t\t\t\tif (sandbox) {\n\t\t\t\t\tif (sandbox.rpcUrl) {\n\t\t\t\t\t\tlet defaultAccount = getDefaultAccount(parsedArgs)(sandboxName);\n\t\t\t\t\t\tif (!defaultAccount) {\n\t\t\t\t\t\t\tconst first = getFirstAccountAlias(sandboxName, parsedArgs);\n\t\t\t\t\t\t\tif (first) {\n\t\t\t\t\t\t\t\tdefaultAccount = getSandboxAccountConfig(parsedArgs)(sandboxName)(first);\n\t\t\t\t\t\t\t\tsendErr(\n\t\t\t\t\t\t\t\t\t`No default account has been configured for the sandbox called ${sandboxName}. Using the account called ${first} for origination.`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (defaultAccount) {\n\t\t\t\t\t\t\tconst secretKey = defaultAccount.secretKey;\n\t\t\t\t\t\t\tconst result = (async () => {\n\t\t\t\t\t\t\t\tconst tezos = new TezosToolkit(sandbox.rpcUrl as string);\n\t\t\t\t\t\t\t\ttezos.setProvider({\n\t\t\t\t\t\t\t\t\tsigner: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn await createBatch(parsedArgs, tezos, sandboxName);\n\t\t\t\t\t\t\t})();\n\n\t\t\t\t\t\t\treturn [...retval, result];\n\t\t\t\t\t\t} else sendErr(`No accounts are available for the sandbox called ${sandboxName} to perform origination.`);\n\t\t\t\t\t} else sendErr(`Sandbox \"${sandboxName} is missing an RPC url in config.json.\"`);\n\t\t\t\t} else {\n\t\t\t\t\tsendErr(\n\t\t\t\t\t\t`The current environment is configured to use a sandbox called '${sandboxName}'; however, no sandbox of this name has been configured in .taq/config.json.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn retval;\n\t\t\t},\n\t\t\t[] as Promise<OriginationResult[] | undefined>[],\n\t\t)\n\t\t: [];\n\nexport const originate = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, TaqError.t> => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\n\tif (!env) {\n\t\treturn sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);\n\t}\n\n\tconst jobs = [\n\t\t...originateToNetworks(parsedArgs, env),\n\t\t...originateToSandboxes(parsedArgs, env),\n\t];\n\n\treturn Promise.all(jobs)\n\t\t.then(jobs =>\n\t\t\tjobs.reduce(\n\t\t\t\t(retval, originations) => {\n\t\t\t\t\treturn originations\n\t\t\t\t\t\t? [...retval as OriginationResult[], ...originations]\n\t\t\t\t\t\t: retval;\n\t\t\t\t},\n\t\t\t\t[],\n\t\t\t)\n\t\t)\n\t\t.then(results => results && results.length > 0 ? sendJsonRes(results) : sendErr(`No contracts originated.`));\n};\n\nexport default originate;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
|
package/index.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import {Plugin, Task} from '@taqueria/node-sdk'
|
|
2
|
-
import
|
|
3
|
-
import originate from './originate'
|
|
1
|
+
import { Plugin, Task } from '@taqueria/node-sdk';
|
|
2
|
+
import originate from './originate';
|
|
4
3
|
|
|
5
|
-
Plugin.create(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}), process.argv)
|
|
4
|
+
Plugin.create(_i18n => ({
|
|
5
|
+
alias: 'taquito',
|
|
6
|
+
schema: '1.0',
|
|
7
|
+
version: '0.1',
|
|
8
|
+
tasks: [
|
|
9
|
+
Task.create({
|
|
10
|
+
task: 'deploy',
|
|
11
|
+
command: 'deploy [contract]',
|
|
12
|
+
description: 'Deploy a smart contract to a particular environment',
|
|
13
|
+
options: [],
|
|
14
|
+
aliases: ['originate'],
|
|
15
|
+
handler: 'proxy',
|
|
16
|
+
encoding: 'application/json',
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
proxy: originate,
|
|
20
|
+
}), process.argv);
|
package/originate.ts
CHANGED
|
@@ -1,190 +1,234 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import {
|
|
2
|
+
getCurrentEnvironmentConfig,
|
|
3
|
+
getDefaultAccount,
|
|
4
|
+
getInitialStorage,
|
|
5
|
+
getNetworkConfig,
|
|
6
|
+
getSandboxAccountConfig,
|
|
7
|
+
getSandboxAccountNames,
|
|
8
|
+
getSandboxConfig,
|
|
9
|
+
sendAsyncErr,
|
|
10
|
+
sendErr,
|
|
11
|
+
sendJsonRes,
|
|
12
|
+
} from '@taqueria/node-sdk';
|
|
13
|
+
import { LikeAPromise, PluginResponse, Protocol, RequestArgs, TaqError } from '@taqueria/node-sdk/types';
|
|
14
|
+
import { OperationContentsAndResultOrigination } from '@taquito/rpc';
|
|
15
|
+
import { importKey, InMemorySigner } from '@taquito/signer';
|
|
16
|
+
import { TezosToolkit, WalletOperationBatch } from '@taquito/taquito';
|
|
17
|
+
import { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';
|
|
18
|
+
import glob from 'fast-glob';
|
|
19
|
+
import { readFile } from 'fs/promises';
|
|
20
|
+
import { join } from 'path';
|
|
21
|
+
|
|
22
|
+
interface Opts extends RequestArgs.t {
|
|
23
|
+
contract?: string;
|
|
24
|
+
}
|
|
12
25
|
|
|
13
26
|
interface ContractStorageMapping {
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
filename: string;
|
|
28
|
+
storage?: unknown;
|
|
16
29
|
}
|
|
17
30
|
|
|
18
31
|
interface OriginationResult {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
contract: string;
|
|
33
|
+
address: string;
|
|
34
|
+
destination: string;
|
|
22
35
|
}
|
|
23
36
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
const getFirstAccountAlias = (sandboxName: string, opts: Opts) => {
|
|
38
|
+
const aliases = getSandboxAccountNames(opts)(sandboxName);
|
|
39
|
+
return aliases.shift();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const getContractAbspath = (contractFilename: string, parsedArgs: Opts) =>
|
|
43
|
+
join(parsedArgs.config.artifactsDir, /\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);
|
|
44
|
+
|
|
45
|
+
const addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) =>
|
|
46
|
+
async (mapping: ContractStorageMapping) => {
|
|
47
|
+
const contractAbspath = getContractAbspath(mapping.filename, parsedArgs);
|
|
48
|
+
const contractData = await readFile(contractAbspath, 'utf-8');
|
|
49
|
+
return (await batch).withOrigination({
|
|
50
|
+
code: contractData,
|
|
51
|
+
storage: mapping.storage,
|
|
52
|
+
});
|
|
53
|
+
};
|
|
36
54
|
|
|
37
55
|
const getValidContracts = async (parsedArgs: Opts) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
56
|
+
const contracts = parsedArgs.contract
|
|
57
|
+
? [parsedArgs.contract]
|
|
58
|
+
: (await glob('**/*.tz', { cwd: parsedArgs.config.artifactsDir })) as string[];
|
|
59
|
+
|
|
60
|
+
return contracts.reduce(
|
|
61
|
+
(retval, filename) => {
|
|
62
|
+
const storage = getInitialStorage(parsedArgs)(filename);
|
|
63
|
+
if (storage === undefined || storage === null) throw (`No initial storage provided for ${filename}`);
|
|
64
|
+
return [...retval, { filename, storage }];
|
|
65
|
+
},
|
|
66
|
+
[] as ContractStorageMapping[],
|
|
67
|
+
);
|
|
68
|
+
};
|
|
51
69
|
|
|
52
70
|
const mapOpToContract = async (contracts: ContractStorageMapping[], op: BatchWalletOperation, destination: string) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
71
|
+
const results = await op.operationResults();
|
|
72
|
+
|
|
73
|
+
return contracts.reduce(
|
|
74
|
+
(retval, contract) => {
|
|
75
|
+
// If initial storage was provided for the contract
|
|
76
|
+
// then we submitted an operation to originate that contract
|
|
77
|
+
if (contract.storage) {
|
|
78
|
+
// WARNING - using side effect here.
|
|
79
|
+
// For each iteration of reduce, results array is being modified-in-place.
|
|
80
|
+
// TODO: Adjust to use recursion to avoid side-effect.
|
|
81
|
+
const result = results.shift() as OperationContentsAndResultOrigination;
|
|
82
|
+
const address = result && result.metadata.operation_result.originated_contracts
|
|
83
|
+
? result.metadata.operation_result.originated_contracts.join(',')
|
|
84
|
+
: 'Error';
|
|
85
|
+
|
|
86
|
+
return [
|
|
87
|
+
...retval,
|
|
88
|
+
{
|
|
89
|
+
contract: contract.filename,
|
|
90
|
+
address,
|
|
91
|
+
destination,
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return [
|
|
97
|
+
...retval,
|
|
98
|
+
{
|
|
99
|
+
contract: contract.filename,
|
|
100
|
+
address: 'Error',
|
|
101
|
+
destination,
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
},
|
|
105
|
+
[] as OriginationResult[],
|
|
106
|
+
);
|
|
107
|
+
};
|
|
88
108
|
|
|
89
109
|
const createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: string) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
110
|
+
const contracts = await getValidContracts(parsedArgs);
|
|
111
|
+
|
|
112
|
+
const batch = await contracts.reduce(
|
|
113
|
+
(batch, contractMapping) =>
|
|
114
|
+
contractMapping.storage
|
|
115
|
+
? addOrigination(parsedArgs, batch)(contractMapping)
|
|
116
|
+
: batch,
|
|
117
|
+
Promise.resolve(tezos.wallet.batch()),
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
const op = await batch.send();
|
|
122
|
+
const confirmed = await op.confirmation();
|
|
123
|
+
return await mapOpToContract(contracts, op, destination);
|
|
124
|
+
} catch (err) {
|
|
125
|
+
const error = (err as { message: string });
|
|
126
|
+
if (error.message) sendErr(error.message);
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const originateToNetworks = (parsedArgs: Opts, currentEnv: Protocol.Environment.t) =>
|
|
132
|
+
currentEnv.networks
|
|
133
|
+
? currentEnv.networks.reduce(
|
|
134
|
+
(retval, networkName) => {
|
|
135
|
+
const network = getNetworkConfig(parsedArgs)(networkName);
|
|
136
|
+
if (network) {
|
|
137
|
+
if (network.rpcUrl) {
|
|
138
|
+
if (network.faucet) {
|
|
139
|
+
const result = (async () => {
|
|
140
|
+
const tezos = new TezosToolkit(network.rpcUrl as string);
|
|
141
|
+
await importKey(
|
|
142
|
+
tezos,
|
|
143
|
+
network.faucet.email,
|
|
144
|
+
network.faucet.password,
|
|
145
|
+
network.faucet.mnemonic.join(' '),
|
|
146
|
+
network.faucet.activation_code,
|
|
147
|
+
);
|
|
148
|
+
return await createBatch(parsedArgs, tezos, networkName);
|
|
149
|
+
})();
|
|
150
|
+
|
|
151
|
+
return [...retval, result];
|
|
152
|
+
} else sendErr(`Network ${networkName} requires a valid faucet in config.json.`);
|
|
153
|
+
} else sendErr(`Network "${networkName} is missing an RPC url in config.json."`);
|
|
154
|
+
} else {
|
|
155
|
+
sendErr(
|
|
156
|
+
`The current environment is configured to use a network called '${networkName}'; however, no network of this name has been configured in .taq/config.json.`,
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return retval;
|
|
161
|
+
},
|
|
162
|
+
[] as Promise<OriginationResult[] | undefined>[],
|
|
163
|
+
)
|
|
164
|
+
: [];
|
|
165
|
+
|
|
166
|
+
const originateToSandboxes = (parsedArgs: Opts, currentEnv: Protocol.Environment.t) =>
|
|
167
|
+
currentEnv.sandboxes
|
|
168
|
+
? currentEnv.sandboxes.reduce(
|
|
169
|
+
(retval, sandboxName) => {
|
|
170
|
+
const sandbox = getSandboxConfig(parsedArgs)(sandboxName);
|
|
171
|
+
if (sandbox) {
|
|
172
|
+
if (sandbox.rpcUrl) {
|
|
173
|
+
let defaultAccount = getDefaultAccount(parsedArgs)(sandboxName);
|
|
174
|
+
if (!defaultAccount) {
|
|
175
|
+
const first = getFirstAccountAlias(sandboxName, parsedArgs);
|
|
176
|
+
if (first) {
|
|
177
|
+
defaultAccount = getSandboxAccountConfig(parsedArgs)(sandboxName)(first);
|
|
178
|
+
sendErr(
|
|
179
|
+
`No default account has been configured for the sandbox called ${sandboxName}. Using the account called ${first} for origination.`,
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (defaultAccount) {
|
|
184
|
+
const secretKey = defaultAccount.secretKey;
|
|
185
|
+
const result = (async () => {
|
|
186
|
+
const tezos = new TezosToolkit(sandbox.rpcUrl as string);
|
|
187
|
+
tezos.setProvider({
|
|
188
|
+
signer: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),
|
|
189
|
+
});
|
|
190
|
+
return await createBatch(parsedArgs, tezos, sandboxName);
|
|
191
|
+
})();
|
|
192
|
+
|
|
193
|
+
return [...retval, result];
|
|
194
|
+
} else sendErr(`No accounts are available for the sandbox called ${sandboxName} to perform origination.`);
|
|
195
|
+
} else sendErr(`Sandbox "${sandboxName} is missing an RPC url in config.json."`);
|
|
196
|
+
} else {
|
|
197
|
+
sendErr(
|
|
198
|
+
`The current environment is configured to use a sandbox called '${sandboxName}'; however, no sandbox of this name has been configured in .taq/config.json.`,
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return retval;
|
|
203
|
+
},
|
|
204
|
+
[] as Promise<OriginationResult[] | undefined>[],
|
|
205
|
+
)
|
|
206
|
+
: [];
|
|
207
|
+
|
|
208
|
+
export const originate = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, TaqError.t> => {
|
|
209
|
+
const env = getCurrentEnvironmentConfig(parsedArgs);
|
|
210
|
+
|
|
211
|
+
if (!env) {
|
|
212
|
+
return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const jobs = [
|
|
216
|
+
...originateToNetworks(parsedArgs, env),
|
|
217
|
+
...originateToSandboxes(parsedArgs, env),
|
|
218
|
+
];
|
|
219
|
+
|
|
220
|
+
return Promise.all(jobs)
|
|
221
|
+
.then(jobs =>
|
|
222
|
+
jobs.reduce(
|
|
223
|
+
(retval, originations) => {
|
|
224
|
+
return originations
|
|
225
|
+
? [...retval as OriginationResult[], ...originations]
|
|
226
|
+
: retval;
|
|
227
|
+
},
|
|
228
|
+
[],
|
|
229
|
+
)
|
|
230
|
+
)
|
|
231
|
+
.then(results => results && results.length > 0 ? sendJsonRes(results) : sendErr(`No contracts originated.`));
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export default originate;
|
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
2
|
+
"name": "@taqueria/plugin-taquito",
|
|
3
|
+
"version": "0.4.0-rc2",
|
|
4
|
+
"description": "A taqueria plugin for originating smart contracts using Taquito",
|
|
5
|
+
"targets": {
|
|
6
|
+
"default": {
|
|
7
|
+
"source": "./index.ts",
|
|
8
|
+
"distDir": "./",
|
|
9
|
+
"context": "node",
|
|
10
|
+
"isLibrary": true
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
15
|
+
"pluginInfo": "npx ts-node index.ts --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}",
|
|
16
|
+
"build": "npx tsc -noEmit && npx parcel build --no-cache 2>&1",
|
|
17
|
+
"debugPluginInfo": "node --inspect-brk index.js --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"taqueria",
|
|
21
|
+
"tezos",
|
|
22
|
+
"originate",
|
|
23
|
+
"deploy",
|
|
24
|
+
"ecad",
|
|
25
|
+
"ecadlabs",
|
|
26
|
+
"plugin",
|
|
27
|
+
"taquito",
|
|
28
|
+
"smart contract"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=16"
|
|
32
|
+
},
|
|
33
|
+
"author": "ECAD Labs",
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/ecadlabs/taqueria.git",
|
|
38
|
+
"directory": "taqueria-plugin-taquito"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/ecadlabs/taqueria/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/ecadlabs/taqueria#readme",
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"parcel": "^2.6.0",
|
|
46
|
+
"typescript": "^4.7.2"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@taqueria/node-sdk": "^0.4.0",
|
|
50
|
+
"@taquito/signer": "^12.1.1",
|
|
51
|
+
"@taquito/taquito": "^12.1.1",
|
|
52
|
+
"fast-glob": "^3.2.11"
|
|
53
|
+
}
|
|
54
54
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
/* Modules */
|
|
27
|
+
"module": "CommonJS", /* Specify what module code is generated. */
|
|
28
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
29
|
+
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
30
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
31
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
32
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
33
|
+
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
|
34
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
35
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
36
|
+
// "resolveJsonModule": true, /* Enable importing .json files */
|
|
37
|
+
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
/* JavaScript Support */
|
|
40
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
|
41
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
42
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
44
|
+
/* Emit */
|
|
45
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
46
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
47
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
48
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
49
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
|
50
|
+
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
51
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
52
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
53
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
54
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
|
55
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
56
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
57
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
58
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
60
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
61
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
62
|
+
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
|
63
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
|
64
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
65
|
+
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
|
66
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
67
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
/* Interop Constraints */
|
|
70
|
+
"isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
71
|
+
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
72
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
|
73
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
74
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
76
|
+
/* Type Checking */
|
|
77
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
78
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
|
79
|
+
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
|
80
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
81
|
+
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
|
82
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
83
|
+
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
|
84
|
+
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
|
85
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
86
|
+
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
|
87
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
|
88
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
89
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
90
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
91
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
92
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
93
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
|
94
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
95
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
/* Completeness */
|
|
98
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
|
+
}
|
|
101
101
|
}
|