@taqueria/plugin-taquito 0.24.2 → 0.25.3-alpha
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/common.ts +20 -14
- package/fund.ts +3 -2
- package/index.js +40 -29
- package/index.js.map +1 -1
- package/instantiate_account.ts +5 -5
- package/main.ts +7 -6
- package/originate.ts +22 -11
- package/package.json +3 -3
- package/transfer.ts +12 -9
- package/tsconfig.json +3 -1
package/common.ts
CHANGED
|
@@ -3,34 +3,40 @@ import {
|
|
|
3
3
|
getDefaultSandboxAccount,
|
|
4
4
|
getNetworkConfig,
|
|
5
5
|
getSandboxConfig,
|
|
6
|
+
RequestArgs,
|
|
6
7
|
sendAsyncErr,
|
|
7
8
|
TAQ_OPERATOR_ACCOUNT,
|
|
8
9
|
} from '@taqueria/node-sdk';
|
|
9
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
Environment,
|
|
12
|
+
NetworkConfig,
|
|
13
|
+
Protocol,
|
|
14
|
+
ProxyTaskArgs,
|
|
15
|
+
SandboxAccountConfig,
|
|
16
|
+
SandboxConfig,
|
|
17
|
+
} from '@taqueria/node-sdk/types';
|
|
10
18
|
import { importKey, InMemorySigner } from '@taquito/signer';
|
|
11
19
|
import { TezosToolkit } from '@taquito/taquito';
|
|
12
20
|
|
|
13
|
-
export
|
|
21
|
+
export type OriginateOpts = ProxyTaskArgs.t & {
|
|
14
22
|
contract: string;
|
|
15
23
|
storage: string;
|
|
16
24
|
alias?: string;
|
|
17
25
|
sender?: string;
|
|
18
26
|
mutez?: string;
|
|
19
|
-
}
|
|
27
|
+
};
|
|
20
28
|
|
|
21
|
-
export
|
|
29
|
+
export type TransferOpts = ProxyTaskArgs.t & {
|
|
22
30
|
contract: string;
|
|
23
31
|
mutez?: string;
|
|
24
32
|
param?: string;
|
|
25
33
|
entrypoint?: string;
|
|
26
34
|
sender?: string;
|
|
27
|
-
}
|
|
35
|
+
};
|
|
28
36
|
|
|
29
|
-
export
|
|
30
|
-
}
|
|
37
|
+
export type InstantiateAccountOpts = ProxyTaskArgs.t;
|
|
31
38
|
|
|
32
|
-
export
|
|
33
|
-
}
|
|
39
|
+
export type FundOpts = ProxyTaskArgs.t;
|
|
34
40
|
|
|
35
41
|
// To be used for the main entrypoint of the plugin
|
|
36
42
|
export type IntersectionOpts = OriginateOpts & TransferOpts & InstantiateAccountOpts & FundOpts;
|
|
@@ -39,7 +45,7 @@ export type IntersectionOpts = OriginateOpts & TransferOpts & InstantiateAccount
|
|
|
39
45
|
type UnionOpts = OriginateOpts | TransferOpts | InstantiateAccountOpts | FundOpts;
|
|
40
46
|
|
|
41
47
|
export const getEnvTypeAndNodeConfig = (
|
|
42
|
-
parsedArgs:
|
|
48
|
+
parsedArgs: RequestArgs.t,
|
|
43
49
|
env: Environment.t,
|
|
44
50
|
): Promise<['Network', NetworkConfig.t] | ['Sandbox', SandboxConfig.t]> => {
|
|
45
51
|
const targetConstraintErrMsg = 'Each environment can only have one target, be it a network or a sandbox';
|
|
@@ -94,7 +100,7 @@ export const configureToolKitForSandbox = async (sandbox: SandboxConfig.t, sende
|
|
|
94
100
|
};
|
|
95
101
|
|
|
96
102
|
export const configureToolKitForNetwork = async (
|
|
97
|
-
parsedArgs:
|
|
103
|
+
parsedArgs: RequestArgs.t,
|
|
98
104
|
network: NetworkConfig.t,
|
|
99
105
|
sender?: string,
|
|
100
106
|
): Promise<TezosToolkit> => {
|
|
@@ -118,8 +124,8 @@ export const configureToolKitForNetwork = async (
|
|
|
118
124
|
return tezos;
|
|
119
125
|
};
|
|
120
126
|
|
|
121
|
-
export const getDeclaredAccounts = (parsedArgs:
|
|
122
|
-
Object.entries(parsedArgs.config.accounts).reduce(
|
|
127
|
+
export const getDeclaredAccounts = (parsedArgs: RequestArgs.t): Record<string, number> =>
|
|
128
|
+
Object.entries(parsedArgs.config.accounts ?? {}).reduce(
|
|
123
129
|
(acc, declaredAccount) => {
|
|
124
130
|
const alias: string = declaredAccount[0];
|
|
125
131
|
const mutez: string | number = declaredAccount[1];
|
|
@@ -166,7 +172,7 @@ export const getNetworkInstantiatedAccounts = (network: NetworkConfig.t): Record
|
|
|
166
172
|
: {};
|
|
167
173
|
|
|
168
174
|
export const generateAccountKeys = async (
|
|
169
|
-
parsedArgs:
|
|
175
|
+
parsedArgs: RequestArgs.t,
|
|
170
176
|
network: NetworkConfig.t,
|
|
171
177
|
account: string,
|
|
172
178
|
): Promise<void> => {
|
package/fund.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCurrentEnvironment,
|
|
3
3
|
getCurrentEnvironmentConfig,
|
|
4
|
+
RequestArgs,
|
|
4
5
|
sendAsyncErr,
|
|
5
6
|
sendJsonRes,
|
|
6
7
|
sendWarn,
|
|
@@ -22,7 +23,7 @@ type TableRow = {
|
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
const getAccountsInfo = (
|
|
25
|
-
parsedArgs:
|
|
26
|
+
parsedArgs: RequestArgs.t,
|
|
26
27
|
tezos: TezosToolkit,
|
|
27
28
|
instantiatedAccounts: Record<string, any>,
|
|
28
29
|
): Promise<ContractInfo[]> =>
|
|
@@ -63,7 +64,7 @@ const prepAccountsInfoForDisplay = (accountsInfo: ContractInfo[]): TableRow[] =>
|
|
|
63
64
|
};
|
|
64
65
|
});
|
|
65
66
|
|
|
66
|
-
const fund = async (parsedArgs:
|
|
67
|
+
const fund = async (parsedArgs: RequestArgs.t): Promise<void> => {
|
|
67
68
|
const env = getCurrentEnvironmentConfig(parsedArgs);
|
|
68
69
|
if (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
69
70
|
try {
|
package/index.js
CHANGED
|
@@ -62,7 +62,7 @@ const $2c87226370e1ba97$export$5a1c5b7c3009d1b0 = async (parsedArgs, network, se
|
|
|
62
62
|
await (0, $iVZbm$taquitosigner.importKey)(tezos, key);
|
|
63
63
|
return tezos;
|
|
64
64
|
};
|
|
65
|
-
const $2c87226370e1ba97$export$ac04c99a21479c39 = (parsedArgs)=>Object.entries(parsedArgs.config.accounts).reduce((acc, declaredAccount)=>{
|
|
65
|
+
const $2c87226370e1ba97$export$ac04c99a21479c39 = (parsedArgs)=>Object.entries(parsedArgs.config.accounts ?? {}).reduce((acc, declaredAccount)=>{
|
|
66
66
|
const alias = declaredAccount[0];
|
|
67
67
|
const mutez = declaredAccount[1];
|
|
68
68
|
return {
|
|
@@ -112,10 +112,11 @@ const $2c87226370e1ba97$export$eadeae1f47371140 = (err, env)=>{
|
|
|
112
112
|
const $944e64d99e99b46e$var$isContractAddress = (contract)=>contract.startsWith("tz1") || contract.startsWith("tz2") || contract.startsWith("tz3") || contract.startsWith("KT1");
|
|
113
113
|
const $944e64d99e99b46e$var$getContractInfo = async (parsedArgs, env)=>{
|
|
114
114
|
const contract = parsedArgs.contract;
|
|
115
|
+
const protocolArgs = (0, $iVZbm$taquerianodesdk.RequestArgs).create(parsedArgs);
|
|
115
116
|
return {
|
|
116
117
|
contractAlias: $944e64d99e99b46e$var$isContractAddress(contract) ? "N/A" : contract,
|
|
117
118
|
contractAddress: $944e64d99e99b46e$var$isContractAddress(contract) ? contract : await (0, $iVZbm$taquerianodesdk.getAddressOfAlias)(env, contract),
|
|
118
|
-
parameter: parsedArgs.param ? await (0, $iVZbm$taquerianodesdk.getParameter)(
|
|
119
|
+
parameter: parsedArgs.param ? await (0, $iVZbm$taquerianodesdk.getParameter)(protocolArgs, parsedArgs.param) : "Unit",
|
|
119
120
|
entrypoint: parsedArgs.entrypoint ?? "default",
|
|
120
121
|
mutezTransfer: parseInt(parsedArgs.mutez ?? "0")
|
|
121
122
|
};
|
|
@@ -149,14 +150,15 @@ const $944e64d99e99b46e$var$prepContractInfoForDisplay = (tezos, contractInfo)=>
|
|
|
149
150
|
destination: tezos.rpc.getRpcUrl()
|
|
150
151
|
};
|
|
151
152
|
};
|
|
152
|
-
const $944e64d99e99b46e$var$transfer = async (
|
|
153
|
-
const
|
|
154
|
-
|
|
153
|
+
const $944e64d99e99b46e$var$transfer = async (opts)=>{
|
|
154
|
+
const protocolArgs = (0, $iVZbm$taquerianodesdk.RequestArgs).create(opts);
|
|
155
|
+
const env = (0, $iVZbm$taquerianodesdk.getCurrentEnvironmentConfig)(protocolArgs);
|
|
156
|
+
if (!env) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`There is no environment called ${protocolArgs.env} in your config.json`);
|
|
155
157
|
try {
|
|
156
|
-
const [envType, nodeConfig] = await (0, $2c87226370e1ba97$export$e1210318d02974b)(
|
|
157
|
-
const tezos = await (envType === "Network" ? (0, $2c87226370e1ba97$export$5a1c5b7c3009d1b0)(
|
|
158
|
-
const contractInfo = await $944e64d99e99b46e$var$getContractInfo(
|
|
159
|
-
await $944e64d99e99b46e$export$e61a38557a73155d(tezos, (0, $iVZbm$taquerianodesdk.getCurrentEnvironment)(
|
|
158
|
+
const [envType, nodeConfig] = await (0, $2c87226370e1ba97$export$e1210318d02974b)(protocolArgs, env);
|
|
159
|
+
const tezos = await (envType === "Network" ? (0, $2c87226370e1ba97$export$5a1c5b7c3009d1b0)(protocolArgs, nodeConfig, opts.sender) : (0, $2c87226370e1ba97$export$cf995f4bdbe82fd9)(nodeConfig, opts.sender));
|
|
160
|
+
const contractInfo = await $944e64d99e99b46e$var$getContractInfo(opts, env);
|
|
161
|
+
await $944e64d99e99b46e$export$e61a38557a73155d(tezos, (0, $iVZbm$taquerianodesdk.getCurrentEnvironment)(protocolArgs), [
|
|
160
162
|
contractInfo
|
|
161
163
|
]);
|
|
162
164
|
const contractInfoForDisplay = $944e64d99e99b46e$var$prepContractInfoForDisplay(tezos, contractInfo);
|
|
@@ -229,8 +231,9 @@ const $ae16ebef21e504f4$var$instantiate_account = async (parsedArgs)=>{
|
|
|
229
231
|
} else (0, $iVZbm$taquerianodesdk.sendWarn)(`Note: ${declaredAccountAlias} is already instantiated in the current environment, "${parsedArgs.env}"`);
|
|
230
232
|
if (accountsInstantiated.length !== 0) return (0, $iVZbm$taquerianodesdk.sendJsonRes)(`Accounts instantiated: ${accountsInstantiated.join(", ")}.\nPlease execute "taq fund" targeting the same environment to fund these accounts`);
|
|
231
233
|
else return (0, $iVZbm$taquerianodesdk.sendJsonRes)(`No accounts were instantiated because they were all instantiated in the target environment already`);
|
|
232
|
-
} catch
|
|
233
|
-
|
|
234
|
+
} catch (err) {
|
|
235
|
+
await (0, $iVZbm$taquerianodesdk.sendAsyncErr)("No operations performed");
|
|
236
|
+
if (parsedArgs.debug) await (0, $iVZbm$taquerianodesdk.sendAsyncErr)(String(err));
|
|
234
237
|
}
|
|
235
238
|
};
|
|
236
239
|
var $ae16ebef21e504f4$export$2e2bcd8739ae039 = $ae16ebef21e504f4$var$instantiate_account;
|
|
@@ -239,7 +242,7 @@ var $ae16ebef21e504f4$export$2e2bcd8739ae039 = $ae16ebef21e504f4$var$instantiate
|
|
|
239
242
|
|
|
240
243
|
|
|
241
244
|
|
|
242
|
-
const $806c5c6032403442$var$getContractPath = (parsedArgs, contractFilename)=>(0, $iVZbm$path.join)(parsedArgs
|
|
245
|
+
const $806c5c6032403442$var$getContractPath = (parsedArgs, contractFilename)=>(0, $iVZbm$path.join)((0, $iVZbm$taquerianodesdk.getArtifactsDir)(parsedArgs), /\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);
|
|
243
246
|
const $806c5c6032403442$var$getDefaultStorageFilename = (contractName)=>{
|
|
244
247
|
const baseFilename = (0, $iVZbm$path.basename)(contractName, (0, $iVZbm$path.extname)(contractName));
|
|
245
248
|
const extFilename = (0, $iVZbm$path.extname)(contractName);
|
|
@@ -248,11 +251,12 @@ const $806c5c6032403442$var$getDefaultStorageFilename = (contractName)=>{
|
|
|
248
251
|
};
|
|
249
252
|
const $806c5c6032403442$var$getContractInfo = async (parsedArgs)=>{
|
|
250
253
|
const contract = parsedArgs.contract;
|
|
254
|
+
const protocolArgs = (0, $iVZbm$taquerianodesdk.RequestArgs).create(parsedArgs);
|
|
251
255
|
const contractWithTzExtension = (0, $iVZbm$taquerianodesdk.addTzExtensionIfMissing)(contract);
|
|
252
|
-
const contractCode = await (0, $iVZbm$taquerianodesdk.getContractContent)(
|
|
256
|
+
const contractCode = await (0, $iVZbm$taquerianodesdk.getContractContent)(protocolArgs, contractWithTzExtension);
|
|
253
257
|
if (contractCode === undefined) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`Please generate ${contractWithTzExtension} with one of the compilers (LIGO, SmartPy, Archetype) or write it manually and put it under /${parsedArgs.config.artifactsDir}\n`);
|
|
254
258
|
const storageFilename = parsedArgs.storage ?? $806c5c6032403442$var$getDefaultStorageFilename(contractWithTzExtension);
|
|
255
|
-
const contractInitStorage = await (0, $iVZbm$taquerianodesdk.getContractContent)(
|
|
259
|
+
const contractInitStorage = await (0, $iVZbm$taquerianodesdk.getContractContent)(protocolArgs, storageFilename);
|
|
256
260
|
if (contractInitStorage === undefined) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`❌ No initial storage file was found for ${contractWithTzExtension}\nStorage must be specified in a file as a Michelson expression and will automatically be linked to this contract if specified with the name "${$806c5c6032403442$var$getDefaultStorageFilename(contractWithTzExtension)}" in the artifacts directory\nYou can also manually pass a storage file to the originate task using the --storage STORAGE_FILE_NAME option\n`);
|
|
257
261
|
return {
|
|
258
262
|
contract: contract,
|
|
@@ -278,29 +282,35 @@ const $806c5c6032403442$export$4737da0e626ec8c7 = async (tezos, env, contractsIn
|
|
|
278
282
|
}
|
|
279
283
|
};
|
|
280
284
|
const $806c5c6032403442$var$prepContractInfoForDisplay = async (parsedArgs, tezos, contractInfo, op)=>{
|
|
285
|
+
const protocolArgs = (0, $iVZbm$taquerianodesdk.RequestArgs).create(parsedArgs);
|
|
281
286
|
const operationResults = await op.operationResults();
|
|
282
287
|
const originationResults = operationResults.filter((result)=>result.kind === "origination").map((result)=>result);
|
|
283
288
|
// Length should be 1 since we are batching originate operations into one
|
|
284
|
-
const
|
|
285
|
-
const address =
|
|
289
|
+
const result = originationResults.length === 1 ? originationResults[0] : undefined;
|
|
290
|
+
const address = result?.metadata?.operation_result?.originated_contracts?.join(",");
|
|
286
291
|
const alias = parsedArgs.alias ?? (0, $iVZbm$path.basename)(contractInfo.contract, (0, $iVZbm$path.extname)(contractInfo.contract));
|
|
287
|
-
|
|
292
|
+
const displayableAddress = address ?? "Something went wrong during origination";
|
|
293
|
+
if (address) {
|
|
294
|
+
const validatedAddress = (0, $iVZbm$taquerianodesdk.NonEmptyString).create(address);
|
|
295
|
+
await (0, $iVZbm$taquerianodesdk.updateAddressAlias)(protocolArgs, alias, validatedAddress);
|
|
296
|
+
}
|
|
288
297
|
return {
|
|
289
298
|
contract: contractInfo.contract,
|
|
290
|
-
address:
|
|
299
|
+
address: displayableAddress,
|
|
291
300
|
alias: address ? alias : "N/A",
|
|
292
301
|
balanceInMutez: contractInfo.mutezTransfer.toString(),
|
|
293
302
|
destination: tezos.rpc.getRpcUrl()
|
|
294
303
|
};
|
|
295
304
|
};
|
|
296
305
|
const $806c5c6032403442$var$originate = async (parsedArgs)=>{
|
|
297
|
-
const
|
|
306
|
+
const protocolArgs = (0, $iVZbm$taquerianodesdk.RequestArgs).create(parsedArgs);
|
|
307
|
+
const env = (0, $iVZbm$taquerianodesdk.getCurrentEnvironmentConfig)(protocolArgs);
|
|
298
308
|
if (!env) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
299
309
|
try {
|
|
300
|
-
const [envType, nodeConfig] = await (0, $2c87226370e1ba97$export$e1210318d02974b)(
|
|
301
|
-
const tezos = await (envType === "Network" ? (0, $2c87226370e1ba97$export$5a1c5b7c3009d1b0)(
|
|
310
|
+
const [envType, nodeConfig] = await (0, $2c87226370e1ba97$export$e1210318d02974b)(protocolArgs, env);
|
|
311
|
+
const tezos = await (envType === "Network" ? (0, $2c87226370e1ba97$export$5a1c5b7c3009d1b0)(protocolArgs, nodeConfig, parsedArgs.sender) : (0, $2c87226370e1ba97$export$cf995f4bdbe82fd9)(nodeConfig, parsedArgs.sender));
|
|
302
312
|
const contractInfo = await $806c5c6032403442$var$getContractInfo(parsedArgs);
|
|
303
|
-
const op = await $806c5c6032403442$export$4737da0e626ec8c7(tezos, (0, $iVZbm$taquerianodesdk.getCurrentEnvironment)(
|
|
313
|
+
const op = await $806c5c6032403442$export$4737da0e626ec8c7(tezos, (0, $iVZbm$taquerianodesdk.getCurrentEnvironment)(protocolArgs), [
|
|
304
314
|
contractInfo
|
|
305
315
|
]);
|
|
306
316
|
const contractInfoForDisplay = await $806c5c6032403442$var$prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);
|
|
@@ -316,17 +326,18 @@ var $806c5c6032403442$export$2e2bcd8739ae039 = $806c5c6032403442$var$originate;
|
|
|
316
326
|
|
|
317
327
|
|
|
318
328
|
const $0b2a174572c7ba1b$export$f22da7240b7add18 = (parsedArgs)=>{
|
|
319
|
-
|
|
329
|
+
const unsafeArgs = parsedArgs;
|
|
330
|
+
switch(unsafeArgs.task){
|
|
320
331
|
case "deploy":
|
|
321
|
-
return (0, $806c5c6032403442$export$2e2bcd8739ae039)(
|
|
332
|
+
return (0, $806c5c6032403442$export$2e2bcd8739ae039)(unsafeArgs);
|
|
322
333
|
case "transfer":
|
|
323
|
-
return (0, $944e64d99e99b46e$export$2e2bcd8739ae039)(
|
|
334
|
+
return (0, $944e64d99e99b46e$export$2e2bcd8739ae039)(unsafeArgs);
|
|
324
335
|
case "instantiate-account":
|
|
325
336
|
return (0, $ae16ebef21e504f4$export$2e2bcd8739ae039)(parsedArgs);
|
|
326
337
|
case "fund":
|
|
327
338
|
return (0, $1e142599cb4e04fd$export$2e2bcd8739ae039)(parsedArgs);
|
|
328
339
|
default:
|
|
329
|
-
return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`${
|
|
340
|
+
return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`${unsafeArgs} is not an understood task by the Taquito plugin`);
|
|
330
341
|
}
|
|
331
342
|
};
|
|
332
343
|
var $0b2a174572c7ba1b$export$2e2bcd8739ae039 = $0b2a174572c7ba1b$export$f22da7240b7add18;
|
|
@@ -361,7 +372,7 @@ var $0b2a174572c7ba1b$export$2e2bcd8739ae039 = $0b2a174572c7ba1b$export$f22da724
|
|
|
361
372
|
flag: "mutez",
|
|
362
373
|
description: "Amount of Mutez to transfer",
|
|
363
374
|
required: false
|
|
364
|
-
})
|
|
375
|
+
})
|
|
365
376
|
],
|
|
366
377
|
aliases: [
|
|
367
378
|
"originate"
|
|
@@ -393,7 +404,7 @@ var $0b2a174572c7ba1b$export$2e2bcd8739ae039 = $0b2a174572c7ba1b$export$f22da724
|
|
|
393
404
|
flag: "sender",
|
|
394
405
|
description: "Name of an instantiated account to use as the sender of the transfer operation",
|
|
395
406
|
required: false
|
|
396
|
-
})
|
|
407
|
+
})
|
|
397
408
|
],
|
|
398
409
|
aliases: [
|
|
399
410
|
"call"
|
|
@@ -414,7 +425,7 @@ var $0b2a174572c7ba1b$export$2e2bcd8739ae039 = $0b2a174572c7ba1b$export$f22da724
|
|
|
414
425
|
description: 'Instantiate all accounts declared in the "accounts" field at the root level of the config file to a target environment',
|
|
415
426
|
handler: "proxy",
|
|
416
427
|
encoding: "application/json"
|
|
417
|
-
})
|
|
428
|
+
})
|
|
418
429
|
],
|
|
419
430
|
proxy: (0, $0b2a174572c7ba1b$export$2e2bcd8739ae039)
|
|
420
431
|
}), process.argv);
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;ACAA;ACAA;ACAA;;;AAwCO,MAAM,wCAAuB,GAAG,CACtC,UAAqB,EACrB,GAAkB,GACwD;IAC1E,MAAM,sBAAsB,GAAG,yEAAyE,AAAC;IACzG,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,CAAC,EAAE,OAAO,CAAA,GAAA,mCAAY,CAAA,CAAC,sBAAsB,C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AAE,kBAAkB;aAC5B,CAAC;YACF,CAAA,GAAA,2BAAI,CAAA,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,qBAAqB;gBAC3B,OAAO,EAAE,qBAAqB;gBAC9B,WAAW,EACV,wHAAwH;gBACzH,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,kBAAkB;aAC5B,CAAC;SACF;QACD,KAAK,EAAE,CAAA,GAAA,wCAAI,CAAA;KACX,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-taquito/index.ts","taqueria-plugin-taquito/main.ts","taqueria-plugin-taquito/fund.ts","taqueria-plugin-taquito/common.ts","taqueria-plugin-taquito/transfer.ts","taqueria-plugin-taquito/instantiate_account.ts","taqueria-plugin-taquito/originate.ts"],"sourcesContent":["import { Option, Plugin, Task } from '@taqueria/node-sdk';\nimport main from './main';\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\t\tOption.create({\n\t\t\t\t\tflag: 'alias',\n\t\t\t\t\tdescription: \"Alias used to refer to the deployed contract's address\",\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'storage',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Name of the storage file that contains the storage value as a Michelson expression, in the artifacts directory, used for originating a contract',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'sender',\n\t\t\t\t\tdescription: 'Name of an instantiated account to use as the sender of the originate operation',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'mutez',\n\t\t\t\t\tdescription: 'Amount of Mutez to transfer',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t],\n\t\t\taliases: ['originate'],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'transfer',\n\t\t\tcommand: 'transfer <contract>',\n\t\t\tdescription:\n\t\t\t\t'Transfer/call an implicit account or a smart contract (specified via its alias or address) deployed to a particular environment',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'mutez',\n\t\t\t\t\tdescription: 'Amount of Mutez to transfer',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'param',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Name of the parameter file that contains the parameter value as a Michelson expression, in the artifacts directory, used for invoking a deployed contract',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'entrypoint',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'You may explicitly specify an entrypoint to make the parameter value shorter, without having to specify a chain of (Left (Right ... 14 ...))',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'sender',\n\t\t\t\t\tdescription: 'Name of an instantiated account to use as the sender of the transfer operation',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t],\n\t\t\taliases: ['call'],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'fund',\n\t\t\tcommand: 'fund',\n\t\t\tdescription: 'Fund all the instantiated accounts up to the desired/declared amount in a target environment',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'instantiate-account',\n\t\t\tcommand: 'instantiate-account',\n\t\t\tdescription:\n\t\t\t\t'Instantiate all accounts declared in the \"accounts\" field at the root level of the config file to a target environment',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t],\n\tproxy: main,\n}), process.argv);\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { IntersectionOpts as Opts } from './common';\nimport fund from './fund';\nimport instantiate_account from './instantiate_account';\nimport originate from './originate';\nimport transfer from './transfer';\n\nexport const main = (parsedArgs: Opts): Promise<void> => {\n\tswitch (parsedArgs.task) {\n\t\tcase 'deploy':\n\t\t\treturn originate(parsedArgs);\n\t\tcase 'transfer':\n\t\t\treturn transfer(parsedArgs);\n\t\tcase 'instantiate-account':\n\t\t\treturn instantiate_account(parsedArgs);\n\t\tcase 'fund':\n\t\t\treturn fund(parsedArgs);\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${parsedArgs.task} is not an understood task by the Taquito plugin`);\n\t}\n};\n\nexport default main;\n","import {\n\tgetCurrentEnvironment,\n\tgetCurrentEnvironmentConfig,\n\tsendAsyncErr,\n\tsendJsonRes,\n\tsendWarn,\n} from '@taqueria/node-sdk';\nimport { TezosToolkit } from '@taquito/taquito';\nimport {\n\tconfigureToolKitForNetwork,\n\tFundOpts as Opts,\n\tgetDeclaredAccounts,\n\tgetEnvTypeAndNodeConfig,\n\tgetNetworkInstantiatedAccounts,\n} from './common';\nimport { ContractInfo, performTransferOps } from './transfer';\n\ntype TableRow = {\n\taccountAlias: string;\n\taccountAddress: string;\n\tmutezFunded: string;\n};\n\nconst getAccountsInfo = (\n\tparsedArgs: Opts,\n\ttezos: TezosToolkit,\n\tinstantiatedAccounts: Record<string, any>,\n): Promise<ContractInfo[]> =>\n\tPromise.all(\n\t\tObject.entries(instantiatedAccounts)\n\t\t\t.map(async (instantiatedAccount: [string, any]) => {\n\t\t\t\tconst alias = instantiatedAccount[0];\n\t\t\t\tconst aliasInfo = instantiatedAccount[1];\n\n\t\t\t\tconst declaredMutez: number | undefined = getDeclaredAccounts(parsedArgs)[alias];\n\t\t\t\tconst currentBalanceInMutez = (await tezos.tz.getBalance(aliasInfo.publicKeyHash)).toNumber();\n\t\t\t\tconst amountToFillInMutez = declaredMutez ? Math.max(declaredMutez - currentBalanceInMutez, 0) : 0;\n\n\t\t\t\tif (!declaredMutez) {\n\t\t\t\t\tsendWarn(\n\t\t\t\t\t\t`Warning: ${alias} is instantiated in the target environment but not declared in the root level \"accounts\" field of ./.taq/config.json so ${alias} will not be funded as you don't have a declared tez amount set there for ${alias}\\n`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tcontractAlias: alias,\n\t\t\t\t\tcontractAddress: aliasInfo.publicKeyHash,\n\t\t\t\t\tparameter: 'Unit',\n\t\t\t\t\tentrypoint: 'default',\n\t\t\t\t\tmutezTransfer: parseInt(amountToFillInMutez.toString()),\n\t\t\t\t};\n\t\t\t}),\n\t)\n\t\t.then(accountsInfo => accountsInfo.filter(accountInfo => accountInfo.mutezTransfer !== 0))\n\t\t.catch(err => sendAsyncErr(`Something went wrong while extracting account information - ${err}`));\n\nconst prepAccountsInfoForDisplay = (accountsInfo: ContractInfo[]): TableRow[] =>\n\taccountsInfo.map(accountInfo => {\n\t\treturn {\n\t\t\taccountAlias: accountInfo.contractAlias,\n\t\t\taccountAddress: accountInfo.contractAddress,\n\t\t\tmutezFunded: accountInfo.mutezTransfer.toString(),\n\t\t};\n\t});\n\nconst fund = async (parsedArgs: Opts): Promise<void> => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\tif (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);\n\ttry {\n\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);\n\t\tif (envType !== 'Network') return sendAsyncErr('taq fund can only be executed in a network environment');\n\t\tconst tezos = await configureToolKitForNetwork(parsedArgs, nodeConfig);\n\n\t\tconst instantiatedAccounts = getNetworkInstantiatedAccounts(nodeConfig);\n\n\t\tconst accountsInfo = await getAccountsInfo(parsedArgs, tezos, instantiatedAccounts);\n\t\tif (accountsInfo.length === 0) {\n\t\t\treturn sendJsonRes(\n\t\t\t\t`All instantiated accounts in the current environment, \"${parsedArgs.env}\", are funded up to or beyond the declared amount`,\n\t\t\t);\n\t\t}\n\n\t\tawait performTransferOps(tezos, getCurrentEnvironment(parsedArgs), accountsInfo);\n\n\t\tconst accountsInfoForDisplay = prepAccountsInfoForDisplay(accountsInfo);\n\t\treturn sendJsonRes(accountsInfoForDisplay);\n\t} catch {\n\t\treturn sendAsyncErr('No operations performed');\n\t}\n};\n\nexport default fund;\n","import {\n\tgetAccountPrivateKey,\n\tgetDefaultSandboxAccount,\n\tgetNetworkConfig,\n\tgetSandboxConfig,\n\tsendAsyncErr,\n\tTAQ_OPERATOR_ACCOUNT,\n} from '@taqueria/node-sdk';\nimport { Environment, NetworkConfig, RequestArgs, SandboxAccountConfig, SandboxConfig } from '@taqueria/node-sdk/types';\nimport { importKey, InMemorySigner } from '@taquito/signer';\nimport { TezosToolkit } from '@taquito/taquito';\n\nexport interface OriginateOpts extends RequestArgs.ProxyRequestArgs {\n\tcontract: string;\n\tstorage: string;\n\talias?: string;\n\tsender?: string;\n\tmutez?: string;\n}\n\nexport interface TransferOpts extends RequestArgs.ProxyRequestArgs {\n\tcontract: string;\n\tmutez?: string;\n\tparam?: string;\n\tentrypoint?: string;\n\tsender?: string;\n}\n\nexport interface InstantiateAccountOpts extends RequestArgs.ProxyRequestArgs {\n}\n\nexport interface FundOpts extends RequestArgs.ProxyRequestArgs {\n}\n\n// To be used for the main entrypoint of the plugin\nexport type IntersectionOpts = OriginateOpts & TransferOpts & InstantiateAccountOpts & FundOpts;\n\n// To be used for common functions in this file\ntype UnionOpts = OriginateOpts | TransferOpts | InstantiateAccountOpts | FundOpts;\n\nexport const getEnvTypeAndNodeConfig = (\n\tparsedArgs: UnionOpts,\n\tenv: Environment.t,\n): Promise<['Network', NetworkConfig.t] | ['Sandbox', SandboxConfig.t]> => {\n\tconst targetConstraintErrMsg = 'Each environment can only have one target, be it a network or a sandbox';\n\tif (env.networks?.length === 1 && env.sandboxes?.length === 1) return sendAsyncErr(targetConstraintErrMsg);\n\tif (env.networks?.length === 1) {\n\t\tconst networkName = env.networks[0];\n\t\tconst network = getNetworkConfig(parsedArgs)(networkName);\n\t\tif (!network) {\n\t\t\treturn sendAsyncErr(\n\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);\n\t\t}\n\t\treturn Promise.resolve(['Network', network]);\n\t}\n\tif (env.sandboxes?.length === 1) {\n\t\tconst sandboxName = env.sandboxes[0];\n\t\tconst sandbox = getSandboxConfig(parsedArgs)(sandboxName);\n\t\tif (!sandbox) {\n\t\t\treturn sendAsyncErr(\n\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);\n\t\t}\n\t\treturn Promise.resolve(['Sandbox', sandbox]);\n\t}\n\treturn sendAsyncErr(targetConstraintErrMsg);\n};\n\nexport const configureToolKitForSandbox = async (sandbox: SandboxConfig.t, sender?: string): Promise<TezosToolkit> => {\n\tlet accountKey: string;\n\tif (sender && sender !== 'default') {\n\t\tconst accounts = getSandboxInstantiatedAccounts(sandbox);\n\t\tif (accounts.hasOwnProperty(sender)) {\n\t\t\taccountKey = accounts[sender].secretKey;\n\t\t} else {\n\t\t\treturn sendAsyncErr(\n\t\t\t\t`${sender} is not an account instantiated in the current environment. Check .taq/config.json`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\tconst defaultAccount = getDefaultSandboxAccount(sandbox);\n\t\tif (!defaultAccount) {\n\t\t\treturn sendAsyncErr(\n\t\t\t\t`No default account is specified in the sandbox to perform the operation. Please use the --sender flag to explicitly specify the account to use as the sender of the operation`,\n\t\t\t);\n\t\t}\n\t\taccountKey = defaultAccount.secretKey;\n\t}\n\n\tconst tezos = new TezosToolkit(sandbox.rpcUrl as string);\n\ttezos.setProvider({ signer: new InMemorySigner(accountKey.replace(/^unencrypted:/, '')) });\n\treturn tezos;\n};\n\nexport const configureToolKitForNetwork = async (\n\tparsedArgs: UnionOpts,\n\tnetwork: NetworkConfig.t,\n\tsender?: string,\n): Promise<TezosToolkit> => {\n\tlet account: string;\n\tif (sender && sender !== TAQ_OPERATOR_ACCOUNT) {\n\t\tconst accounts = getNetworkInstantiatedAccounts(network);\n\t\tif (accounts.hasOwnProperty(sender)) {\n\t\t\taccount = sender;\n\t\t} else {\n\t\t\treturn sendAsyncErr(\n\t\t\t\t`${sender} is not an account instantiated in the current environment. Check .taq/config.json`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\taccount = TAQ_OPERATOR_ACCOUNT;\n\t}\n\n\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\tconst key = await getAccountPrivateKey(parsedArgs, network, account);\n\tawait importKey(tezos, key);\n\treturn tezos;\n};\n\nexport const getDeclaredAccounts = (parsedArgs: UnionOpts): Record<string, number> =>\n\tObject.entries(parsedArgs.config.accounts).reduce(\n\t\t(acc, declaredAccount) => {\n\t\t\tconst alias: string = declaredAccount[0];\n\t\t\tconst mutez: string | number = declaredAccount[1];\n\t\t\treturn {\n\t\t\t\t...acc,\n\t\t\t\t[alias]: typeof mutez === 'string' ? parseFloat(mutez) : mutez,\n\t\t\t};\n\t\t},\n\t\t{} as Record<string, number>,\n\t);\n\nexport const getSandboxInstantiatedAccounts = (sandbox: SandboxConfig.t): Record<string, SandboxAccountConfig.t> =>\n\t(sandbox?.accounts)\n\t\t? Object.entries(sandbox.accounts).reduce(\n\t\t\t(acc, instantiatedAccount) => {\n\t\t\t\tconst alias: string = instantiatedAccount[0];\n\t\t\t\tconst keys = instantiatedAccount[1];\n\t\t\t\treturn alias !== 'default'\n\t\t\t\t\t? {\n\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t[alias]: keys,\n\t\t\t\t\t}\n\t\t\t\t\t: acc;\n\t\t\t},\n\t\t\t{},\n\t\t)\n\t\t: {};\n\nexport const getNetworkInstantiatedAccounts = (network: NetworkConfig.t): Record<string, any> =>\n\tnetwork.accounts\n\t\t? Object.entries(network.accounts).reduce(\n\t\t\t(acc, instantiatedAccount) => {\n\t\t\t\tconst alias: string = instantiatedAccount[0];\n\t\t\t\tconst keys = instantiatedAccount[1];\n\t\t\t\treturn alias !== TAQ_OPERATOR_ACCOUNT\n\t\t\t\t\t? {\n\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t[alias]: keys,\n\t\t\t\t\t}\n\t\t\t\t\t: acc;\n\t\t\t},\n\t\t\t{},\n\t\t)\n\t\t: {};\n\nexport const generateAccountKeys = async (\n\tparsedArgs: UnionOpts,\n\tnetwork: NetworkConfig.t,\n\taccount: string,\n): Promise<void> => {\n\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\tconst key = await getAccountPrivateKey(parsedArgs, network, account);\n\tawait importKey(tezos, key);\n};\n\nexport const handleOpsError = (err: unknown, env: string): Promise<never> => {\n\tif (err instanceof Error) {\n\t\tconst msg = err.message;\n\t\tif (/ENOTFOUND/.test(msg)) return sendAsyncErr('The RPC URL may be invalid. Check ./.taq/config.json');\n\t\tif (/ECONNREFUSED/.test(msg)) return sendAsyncErr('The RPC URL may be down or the sandbox is not running');\n\t\tif (/empty_implicit_contract/.test(msg)) {\n\t\t\tconst result = msg.match(/(?<=\"implicit\":\")tz[^\"]+(?=\")/);\n\t\t\tconst publicKeyHash = result ? result[0] : undefined;\n\t\t\tif (publicKeyHash) {\n\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t`The account ${publicKeyHash} for the target environment, \"${env}\", may not be funded\\nTo fund this account:\\n1. Go to https://teztnets.xyz and click \"Faucet\" of the target testnet\\n2. Copy and paste the above key into the wallet address field\\n3. Request some Tez (Note that you might need to wait for a few seconds for the network to register the funds)`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn sendAsyncErr(`Error while performing operation:\\n${err} ${JSON.stringify(err, null, 2)}`);\n};\n","import {\n\tgetAddressOfAlias,\n\tgetCurrentEnvironment,\n\tgetCurrentEnvironmentConfig,\n\tgetParameter,\n\tsendAsyncErr,\n\tsendJsonRes,\n} from '@taqueria/node-sdk';\nimport { Environment } from '@taqueria/node-sdk/types';\nimport { Expr, Parser } from '@taquito/michel-codec';\nimport { TezosToolkit, WalletOperationBatch } from '@taquito/taquito';\nimport { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';\nimport {\n\tconfigureToolKitForNetwork,\n\tconfigureToolKitForSandbox,\n\tgetEnvTypeAndNodeConfig,\n\thandleOpsError,\n\tTransferOpts as Opts,\n} from './common';\n\nexport type ContractInfo = {\n\tcontractAlias: string;\n\tcontractAddress: string;\n\tparameter: string;\n\tentrypoint: string;\n\tmutezTransfer: number;\n};\n\ntype TableRow = {\n\tcontractAlias: string;\n\tcontractAddress: string;\n\tparameter: string;\n\tentrypoint: string;\n\tmutezTransfer: string;\n\tdestination: string;\n};\n\nconst isContractAddress = (contract: string): boolean =>\n\tcontract.startsWith('tz1') || contract.startsWith('tz2') || contract.startsWith('tz3') || contract.startsWith('KT1');\n\nconst getContractInfo = async (parsedArgs: Opts, env: Environment.t): Promise<ContractInfo> => {\n\tconst contract = parsedArgs.contract;\n\treturn {\n\t\tcontractAlias: isContractAddress(contract) ? 'N/A' : contract,\n\t\tcontractAddress: isContractAddress(contract) ? contract : await getAddressOfAlias(env, contract),\n\t\tparameter: parsedArgs.param ? await getParameter(parsedArgs, parsedArgs.param) : 'Unit',\n\t\tentrypoint: parsedArgs.entrypoint ?? 'default',\n\t\tmutezTransfer: parseInt(parsedArgs.mutez ?? '0'),\n\t};\n};\n\nconst createBatchForTransfer = (tezos: TezosToolkit, contractsInfo: ContractInfo[]): WalletOperationBatch =>\n\tcontractsInfo.reduce((acc, contractInfo) =>\n\t\tacc.withTransfer({\n\t\t\tto: contractInfo.contractAddress,\n\t\t\tamount: contractInfo.mutezTransfer,\n\t\t\tparameter: {\n\t\t\t\tentrypoint: contractInfo.entrypoint,\n\t\t\t\tvalue: new Parser().parseMichelineExpression(contractInfo.parameter) as Expr,\n\t\t\t},\n\t\t\tmutez: true,\n\t\t}), tezos.wallet.batch());\n\nexport const performTransferOps = async (\n\ttezos: TezosToolkit,\n\tenv: string,\n\tcontractsInfo: ContractInfo[],\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForTransfer(tezos, contractsInfo);\n\ttry {\n\t\tconst op = await batch.send();\n\t\tawait op.confirmation();\n\t\treturn op;\n\t} catch (err) {\n\t\treturn handleOpsError(err, env);\n\t}\n};\n\nconst prepContractInfoForDisplay = (tezos: TezosToolkit, contractInfo: ContractInfo): TableRow => {\n\treturn {\n\t\tcontractAlias: contractInfo.contractAlias,\n\t\tcontractAddress: contractInfo.contractAddress,\n\t\tparameter: contractInfo.parameter,\n\t\tentrypoint: contractInfo.entrypoint,\n\t\tmutezTransfer: contractInfo.mutezTransfer.toString(),\n\t\tdestination: tezos.rpc.getRpcUrl(),\n\t};\n};\n\nconst transfer = async (parsedArgs: Opts): Promise<void> => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\tif (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);\n\ttry {\n\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);\n\t\tconst tezos = await (envType === 'Network'\n\t\t\t? configureToolKitForNetwork(parsedArgs, nodeConfig, parsedArgs.sender)\n\t\t\t: configureToolKitForSandbox(nodeConfig, parsedArgs.sender));\n\n\t\tconst contractInfo = await getContractInfo(parsedArgs, env);\n\n\t\tawait performTransferOps(tezos, getCurrentEnvironment(parsedArgs), [contractInfo]);\n\n\t\tconst contractInfoForDisplay = prepContractInfoForDisplay(tezos, contractInfo);\n\t\treturn sendJsonRes([contractInfoForDisplay]);\n\t} catch {\n\t\treturn sendAsyncErr('No operations performed');\n\t}\n};\n\nexport default transfer;\n","import { getCurrentEnvironmentConfig, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport {\n\tgenerateAccountKeys,\n\tgetDeclaredAccounts,\n\tgetEnvTypeAndNodeConfig,\n\tgetNetworkInstantiatedAccounts,\n\tInstantiateAccountOpts as Opts,\n} from './common';\n\nconst instantiate_account = async (parsedArgs: Opts): Promise<void> => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\tif (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);\n\ttry {\n\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);\n\t\tif (envType !== 'Network') {\n\t\t\treturn sendAsyncErr('taq instantiate-account can only be executed in a network environment');\n\t\t}\n\n\t\tconst declaredAccountAliases = Object.keys(getDeclaredAccounts(parsedArgs));\n\t\tconst instantiatedAccounts = getNetworkInstantiatedAccounts(nodeConfig);\n\n\t\tlet accountsInstantiated = [];\n\t\tfor (const declaredAccountAlias of declaredAccountAliases) {\n\t\t\tif (!instantiatedAccounts.hasOwnProperty(declaredAccountAlias)) {\n\t\t\t\tawait generateAccountKeys(parsedArgs, nodeConfig, declaredAccountAlias);\n\t\t\t\taccountsInstantiated.push(declaredAccountAlias);\n\t\t\t} else {\n\t\t\t\tsendWarn(\n\t\t\t\t\t`Note: ${declaredAccountAlias} is already instantiated in the current environment, \"${parsedArgs.env}\"`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (accountsInstantiated.length !== 0) {\n\t\t\treturn sendJsonRes(\n\t\t\t\t`Accounts instantiated: ${\n\t\t\t\t\taccountsInstantiated.join(', ')\n\t\t\t\t}.\\nPlease execute \"taq fund\" targeting the same environment to fund these accounts`,\n\t\t\t);\n\t\t} else {\n\t\t\treturn sendJsonRes(\n\t\t\t\t`No accounts were instantiated because they were all instantiated in the target environment already`,\n\t\t\t);\n\t\t}\n\t} catch {\n\t\treturn sendAsyncErr('No operations performed');\n\t}\n};\n\nexport default instantiate_account;\n","import {\n\taddTzExtensionIfMissing,\n\tgetContractContent,\n\tgetCurrentEnvironment,\n\tgetCurrentEnvironmentConfig,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n\tupdateAddressAlias,\n} from '@taqueria/node-sdk';\nimport { OperationContentsAndResultOrigination } from '@taquito/rpc';\nimport { TezosToolkit, WalletOperationBatch } from '@taquito/taquito';\nimport { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';\nimport { readFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport {\n\tconfigureToolKitForNetwork,\n\tconfigureToolKitForSandbox,\n\tgetEnvTypeAndNodeConfig,\n\thandleOpsError,\n\tOriginateOpts as Opts,\n} from './common';\n\ntype ContractInfo = {\n\tcontract: string;\n\tcode: string;\n\tinitStorage: string;\n\tmutezTransfer: number;\n};\n\ntype TableRow = {\n\tcontract: string;\n\taddress: string;\n\talias: string;\n\tbalanceInMutez: string;\n\tdestination: string;\n};\n\nconst getContractPath = (parsedArgs: Opts, contractFilename: string) =>\n\tjoin(parsedArgs.config.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);\n\nconst getDefaultStorageFilename = (contractName: string): string => {\n\tconst baseFilename = basename(contractName, extname(contractName));\n\tconst extFilename = extname(contractName);\n\tconst defaultStorage = `${baseFilename}.default_storage${extFilename}`;\n\treturn defaultStorage;\n};\n\nconst getContractInfo = async (parsedArgs: Opts): Promise<ContractInfo> => {\n\tconst contract = parsedArgs.contract;\n\tconst contractWithTzExtension = addTzExtensionIfMissing(contract);\n\tconst contractCode = await getContractContent(parsedArgs, contractWithTzExtension);\n\tif (contractCode === undefined) {\n\t\treturn sendAsyncErr(\n\t\t\t`Please generate ${contractWithTzExtension} with one of the compilers (LIGO, SmartPy, Archetype) or write it manually and put it under /${parsedArgs.config.artifactsDir}\\n`,\n\t\t);\n\t}\n\n\tconst storageFilename = parsedArgs.storage ?? getDefaultStorageFilename(contractWithTzExtension);\n\tconst contractInitStorage = await getContractContent(parsedArgs, storageFilename);\n\tif (contractInitStorage === undefined) {\n\t\treturn sendAsyncErr(\n\t\t\t`❌ No initial storage file was found for ${contractWithTzExtension}\\nStorage must be specified in a file as a Michelson expression and will automatically be linked to this contract if specified with the name \"${\n\t\t\t\tgetDefaultStorageFilename(contractWithTzExtension)\n\t\t\t}\" in the artifacts directory\\nYou can also manually pass a storage file to the originate task using the --storage STORAGE_FILE_NAME option\\n`,\n\t\t);\n\t}\n\n\treturn {\n\t\tcontract,\n\t\tcode: contractCode,\n\t\tinitStorage: contractInitStorage,\n\t\tmutezTransfer: parseInt(parsedArgs.mutez ?? '0'),\n\t};\n};\n\nconst createBatchForOriginate = (tezos: TezosToolkit, contractsInfo: ContractInfo[]): WalletOperationBatch =>\n\tcontractsInfo.reduce((acc, contractInfo) =>\n\t\tacc.withOrigination({\n\t\t\tcode: contractInfo.code,\n\t\t\tinit: contractInfo.initStorage,\n\t\t\tbalance: contractInfo.mutezTransfer.toString(),\n\t\t\tmutez: true,\n\t\t}), tezos.wallet.batch());\n\nexport const performOriginateOps = async (\n\ttezos: TezosToolkit,\n\tenv: string,\n\tcontractsInfo: ContractInfo[],\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForOriginate(tezos, contractsInfo);\n\ttry {\n\t\tconst op = await batch.send();\n\t\tawait op.confirmation();\n\t\treturn op;\n\t} catch (err) {\n\t\treturn handleOpsError(err, env);\n\t}\n};\n\nconst prepContractInfoForDisplay = async (\n\tparsedArgs: Opts,\n\ttezos: TezosToolkit,\n\tcontractInfo: ContractInfo,\n\top: BatchWalletOperation,\n): Promise<TableRow> => {\n\tconst operationResults = await op.operationResults();\n\tconst originationResults = operationResults\n\t\t.filter(result => result.kind === 'origination')\n\t\t.map(result => result as OperationContentsAndResultOrigination);\n\n\t// Length should be 1 since we are batching originate operations into one\n\tconst result = originationResults.length === 1 ? originationResults[0] : undefined;\n\tconst address = result?.metadata?.operation_result?.originated_contracts?.join(',');\n\n\tconst alias = parsedArgs.alias ?? basename(contractInfo.contract, extname(contractInfo.contract));\n\tif (address) await updateAddressAlias(parsedArgs, alias, address);\n\n\treturn {\n\t\tcontract: contractInfo.contract,\n\t\taddress: address ?? 'Something went wrong during origination',\n\t\talias: address ? alias : 'N/A',\n\t\tbalanceInMutez: contractInfo.mutezTransfer.toString(),\n\t\tdestination: tezos.rpc.getRpcUrl(),\n\t};\n};\n\nconst originate = async (parsedArgs: Opts): Promise<void> => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\tif (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);\n\ttry {\n\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);\n\t\tconst tezos = await (envType === 'Network'\n\t\t\t? configureToolKitForNetwork(parsedArgs, nodeConfig, parsedArgs.sender)\n\t\t\t: configureToolKitForSandbox(nodeConfig, parsedArgs.sender));\n\n\t\tconst contractInfo = await getContractInfo(parsedArgs);\n\n\t\tconst op = await performOriginateOps(tezos, getCurrentEnvironment(parsedArgs), [contractInfo]);\n\n\t\tconst contractInfoForDisplay = await prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);\n\t\treturn sendJsonRes([contractInfoForDisplay]);\n\t} catch {\n\t\treturn sendAsyncErr('No operations performed');\n\t}\n};\n\nexport default originate;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
|
|
1
|
+
{"mappings":";;;;;;AAAA;ACAA;ACAA;ACAA;;;AA8CO,MAAM,2CAA0B,CACtC,YACA,MAC0E;IAC1E,MAAM,yBAAyB;IAC/B,IAAI,IAAI,QAAQ,EAAE,WAAW,KAAK,IAAI,SAAS,EAAE,WAAW,GAAG,OAAO,CAAA,GAAA,mCAAW,EAAE;IACnF,IAAI,IAAI,QAAQ,EAAE,WAAW,GAAG;QAC/B,MAAM,cAAc,IAAI,QAAQ,CAAC,EAAE;QACnC,MAAM,UAAU,CAAA,GAAA,uCAAe,EAAE,YAAY;QAC7C,IAAI,CAAC,SACJ,OAAO,CAAA,GAAA,mCAAW,EACjB,CAAC,+DAA+D,EAAE,YAAY,2EAA2E,CAAC;QAG5J,OAAO,QAAQ,OAAO,CAAC;YAA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index.ts","taqueria-plugin-taquito/main.ts","taqueria-plugin-taquito/fund.ts","taqueria-plugin-taquito/common.ts","taqueria-plugin-taquito/transfer.ts","taqueria-plugin-taquito/instantiate_account.ts","taqueria-plugin-taquito/originate.ts"],"sourcesContent":["import { Option, Plugin, Task } from '@taqueria/node-sdk';\nimport main from './main';\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\t\tOption.create({\n\t\t\t\t\tflag: 'alias',\n\t\t\t\t\tdescription: \"Alias used to refer to the deployed contract's address\",\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'storage',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Name of the storage file that contains the storage value as a Michelson expression, in the artifacts directory, used for originating a contract',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'sender',\n\t\t\t\t\tdescription: 'Name of an instantiated account to use as the sender of the originate operation',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'mutez',\n\t\t\t\t\tdescription: 'Amount of Mutez to transfer',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t],\n\t\t\taliases: ['originate'],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'transfer',\n\t\t\tcommand: 'transfer <contract>',\n\t\t\tdescription:\n\t\t\t\t'Transfer/call an implicit account or a smart contract (specified via its alias or address) deployed to a particular environment',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'mutez',\n\t\t\t\t\tdescription: 'Amount of Mutez to transfer',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'param',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Name of the parameter file that contains the parameter value as a Michelson expression, in the artifacts directory, used for invoking a deployed contract',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'entrypoint',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'You may explicitly specify an entrypoint to make the parameter value shorter, without having to specify a chain of (Left (Right ... 14 ...))',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'sender',\n\t\t\t\t\tdescription: 'Name of an instantiated account to use as the sender of the transfer operation',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t],\n\t\t\taliases: ['call'],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'fund',\n\t\t\tcommand: 'fund',\n\t\t\tdescription: 'Fund all the instantiated accounts up to the desired/declared amount in a target environment',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'instantiate-account',\n\t\t\tcommand: 'instantiate-account',\n\t\t\tdescription:\n\t\t\t\t'Instantiate all accounts declared in the \"accounts\" field at the root level of the config file to a target environment',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t],\n\tproxy: main,\n}), process.argv);\n","import { RequestArgs, sendAsyncErr } from '@taqueria/node-sdk';\nimport { IntersectionOpts as Opts } from './common';\nimport fund from './fund';\nimport instantiate_account from './instantiate_account';\nimport originate from './originate';\nimport transfer from './transfer';\n\nexport const main = (parsedArgs: RequestArgs.t): Promise<void> => {\n\tconst unsafeArgs = parsedArgs as unknown as Opts;\n\tswitch (unsafeArgs.task) {\n\t\tcase 'deploy':\n\t\t\treturn originate(unsafeArgs);\n\t\tcase 'transfer':\n\t\t\treturn transfer(unsafeArgs);\n\t\tcase 'instantiate-account':\n\t\t\treturn instantiate_account(parsedArgs);\n\t\tcase 'fund':\n\t\t\treturn fund(parsedArgs);\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${unsafeArgs} is not an understood task by the Taquito plugin`);\n\t}\n};\n\nexport default main;\n","import {\n\tgetCurrentEnvironment,\n\tgetCurrentEnvironmentConfig,\n\tRequestArgs,\n\tsendAsyncErr,\n\tsendJsonRes,\n\tsendWarn,\n} from '@taqueria/node-sdk';\nimport { TezosToolkit } from '@taquito/taquito';\nimport {\n\tconfigureToolKitForNetwork,\n\tFundOpts as Opts,\n\tgetDeclaredAccounts,\n\tgetEnvTypeAndNodeConfig,\n\tgetNetworkInstantiatedAccounts,\n} from './common';\nimport { ContractInfo, performTransferOps } from './transfer';\n\ntype TableRow = {\n\taccountAlias: string;\n\taccountAddress: string;\n\tmutezFunded: string;\n};\n\nconst getAccountsInfo = (\n\tparsedArgs: RequestArgs.t,\n\ttezos: TezosToolkit,\n\tinstantiatedAccounts: Record<string, any>,\n): Promise<ContractInfo[]> =>\n\tPromise.all(\n\t\tObject.entries(instantiatedAccounts)\n\t\t\t.map(async (instantiatedAccount: [string, any]) => {\n\t\t\t\tconst alias = instantiatedAccount[0];\n\t\t\t\tconst aliasInfo = instantiatedAccount[1];\n\n\t\t\t\tconst declaredMutez: number | undefined = getDeclaredAccounts(parsedArgs)[alias];\n\t\t\t\tconst currentBalanceInMutez = (await tezos.tz.getBalance(aliasInfo.publicKeyHash)).toNumber();\n\t\t\t\tconst amountToFillInMutez = declaredMutez ? Math.max(declaredMutez - currentBalanceInMutez, 0) : 0;\n\n\t\t\t\tif (!declaredMutez) {\n\t\t\t\t\tsendWarn(\n\t\t\t\t\t\t`Warning: ${alias} is instantiated in the target environment but not declared in the root level \"accounts\" field of ./.taq/config.json so ${alias} will not be funded as you don't have a declared tez amount set there for ${alias}\\n`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tcontractAlias: alias,\n\t\t\t\t\tcontractAddress: aliasInfo.publicKeyHash,\n\t\t\t\t\tparameter: 'Unit',\n\t\t\t\t\tentrypoint: 'default',\n\t\t\t\t\tmutezTransfer: parseInt(amountToFillInMutez.toString()),\n\t\t\t\t};\n\t\t\t}),\n\t)\n\t\t.then(accountsInfo => accountsInfo.filter(accountInfo => accountInfo.mutezTransfer !== 0))\n\t\t.catch(err => sendAsyncErr(`Something went wrong while extracting account information - ${err}`));\n\nconst prepAccountsInfoForDisplay = (accountsInfo: ContractInfo[]): TableRow[] =>\n\taccountsInfo.map(accountInfo => {\n\t\treturn {\n\t\t\taccountAlias: accountInfo.contractAlias,\n\t\t\taccountAddress: accountInfo.contractAddress,\n\t\t\tmutezFunded: accountInfo.mutezTransfer.toString(),\n\t\t};\n\t});\n\nconst fund = async (parsedArgs: RequestArgs.t): Promise<void> => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\tif (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);\n\ttry {\n\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);\n\t\tif (envType !== 'Network') return sendAsyncErr('taq fund can only be executed in a network environment');\n\t\tconst tezos = await configureToolKitForNetwork(parsedArgs, nodeConfig);\n\n\t\tconst instantiatedAccounts = getNetworkInstantiatedAccounts(nodeConfig);\n\n\t\tconst accountsInfo = await getAccountsInfo(parsedArgs, tezos, instantiatedAccounts);\n\t\tif (accountsInfo.length === 0) {\n\t\t\treturn sendJsonRes(\n\t\t\t\t`All instantiated accounts in the current environment, \"${parsedArgs.env}\", are funded up to or beyond the declared amount`,\n\t\t\t);\n\t\t}\n\n\t\tawait performTransferOps(tezos, getCurrentEnvironment(parsedArgs), accountsInfo);\n\n\t\tconst accountsInfoForDisplay = prepAccountsInfoForDisplay(accountsInfo);\n\t\treturn sendJsonRes(accountsInfoForDisplay);\n\t} catch {\n\t\treturn sendAsyncErr('No operations performed');\n\t}\n};\n\nexport default fund;\n","import {\n\tgetAccountPrivateKey,\n\tgetDefaultSandboxAccount,\n\tgetNetworkConfig,\n\tgetSandboxConfig,\n\tRequestArgs,\n\tsendAsyncErr,\n\tTAQ_OPERATOR_ACCOUNT,\n} from '@taqueria/node-sdk';\nimport {\n\tEnvironment,\n\tNetworkConfig,\n\tProtocol,\n\tProxyTaskArgs,\n\tSandboxAccountConfig,\n\tSandboxConfig,\n} from '@taqueria/node-sdk/types';\nimport { importKey, InMemorySigner } from '@taquito/signer';\nimport { TezosToolkit } from '@taquito/taquito';\n\nexport type OriginateOpts = ProxyTaskArgs.t & {\n\tcontract: string;\n\tstorage: string;\n\talias?: string;\n\tsender?: string;\n\tmutez?: string;\n};\n\nexport type TransferOpts = ProxyTaskArgs.t & {\n\tcontract: string;\n\tmutez?: string;\n\tparam?: string;\n\tentrypoint?: string;\n\tsender?: string;\n};\n\nexport type InstantiateAccountOpts = ProxyTaskArgs.t;\n\nexport type FundOpts = ProxyTaskArgs.t;\n\n// To be used for the main entrypoint of the plugin\nexport type IntersectionOpts = OriginateOpts & TransferOpts & InstantiateAccountOpts & FundOpts;\n\n// To be used for common functions in this file\ntype UnionOpts = OriginateOpts | TransferOpts | InstantiateAccountOpts | FundOpts;\n\nexport const getEnvTypeAndNodeConfig = (\n\tparsedArgs: RequestArgs.t,\n\tenv: Environment.t,\n): Promise<['Network', NetworkConfig.t] | ['Sandbox', SandboxConfig.t]> => {\n\tconst targetConstraintErrMsg = 'Each environment can only have one target, be it a network or a sandbox';\n\tif (env.networks?.length === 1 && env.sandboxes?.length === 1) return sendAsyncErr(targetConstraintErrMsg);\n\tif (env.networks?.length === 1) {\n\t\tconst networkName = env.networks[0];\n\t\tconst network = getNetworkConfig(parsedArgs)(networkName);\n\t\tif (!network) {\n\t\t\treturn sendAsyncErr(\n\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);\n\t\t}\n\t\treturn Promise.resolve(['Network', network]);\n\t}\n\tif (env.sandboxes?.length === 1) {\n\t\tconst sandboxName = env.sandboxes[0];\n\t\tconst sandbox = getSandboxConfig(parsedArgs)(sandboxName);\n\t\tif (!sandbox) {\n\t\t\treturn sendAsyncErr(\n\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);\n\t\t}\n\t\treturn Promise.resolve(['Sandbox', sandbox]);\n\t}\n\treturn sendAsyncErr(targetConstraintErrMsg);\n};\n\nexport const configureToolKitForSandbox = async (sandbox: SandboxConfig.t, sender?: string): Promise<TezosToolkit> => {\n\tlet accountKey: string;\n\tif (sender && sender !== 'default') {\n\t\tconst accounts = getSandboxInstantiatedAccounts(sandbox);\n\t\tif (accounts.hasOwnProperty(sender)) {\n\t\t\taccountKey = accounts[sender].secretKey;\n\t\t} else {\n\t\t\treturn sendAsyncErr(\n\t\t\t\t`${sender} is not an account instantiated in the current environment. Check .taq/config.json`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\tconst defaultAccount = getDefaultSandboxAccount(sandbox);\n\t\tif (!defaultAccount) {\n\t\t\treturn sendAsyncErr(\n\t\t\t\t`No default account is specified in the sandbox to perform the operation. Please use the --sender flag to explicitly specify the account to use as the sender of the operation`,\n\t\t\t);\n\t\t}\n\t\taccountKey = defaultAccount.secretKey;\n\t}\n\n\tconst tezos = new TezosToolkit(sandbox.rpcUrl as string);\n\ttezos.setProvider({ signer: new InMemorySigner(accountKey.replace(/^unencrypted:/, '')) });\n\treturn tezos;\n};\n\nexport const configureToolKitForNetwork = async (\n\tparsedArgs: RequestArgs.t,\n\tnetwork: NetworkConfig.t,\n\tsender?: string,\n): Promise<TezosToolkit> => {\n\tlet account: string;\n\tif (sender && sender !== TAQ_OPERATOR_ACCOUNT) {\n\t\tconst accounts = getNetworkInstantiatedAccounts(network);\n\t\tif (accounts.hasOwnProperty(sender)) {\n\t\t\taccount = sender;\n\t\t} else {\n\t\t\treturn sendAsyncErr(\n\t\t\t\t`${sender} is not an account instantiated in the current environment. Check .taq/config.json`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\taccount = TAQ_OPERATOR_ACCOUNT;\n\t}\n\n\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\tconst key = await getAccountPrivateKey(parsedArgs, network, account);\n\tawait importKey(tezos, key);\n\treturn tezos;\n};\n\nexport const getDeclaredAccounts = (parsedArgs: RequestArgs.t): Record<string, number> =>\n\tObject.entries(parsedArgs.config.accounts ?? {}).reduce(\n\t\t(acc, declaredAccount) => {\n\t\t\tconst alias: string = declaredAccount[0];\n\t\t\tconst mutez: string | number = declaredAccount[1];\n\t\t\treturn {\n\t\t\t\t...acc,\n\t\t\t\t[alias]: typeof mutez === 'string' ? parseFloat(mutez) : mutez,\n\t\t\t};\n\t\t},\n\t\t{} as Record<string, number>,\n\t);\n\nexport const getSandboxInstantiatedAccounts = (sandbox: SandboxConfig.t): Record<string, SandboxAccountConfig.t> =>\n\t(sandbox?.accounts)\n\t\t? Object.entries(sandbox.accounts).reduce(\n\t\t\t(acc, instantiatedAccount) => {\n\t\t\t\tconst alias: string = instantiatedAccount[0];\n\t\t\t\tconst keys = instantiatedAccount[1];\n\t\t\t\treturn alias !== 'default'\n\t\t\t\t\t? {\n\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t[alias]: keys,\n\t\t\t\t\t}\n\t\t\t\t\t: acc;\n\t\t\t},\n\t\t\t{},\n\t\t)\n\t\t: {};\n\nexport const getNetworkInstantiatedAccounts = (network: NetworkConfig.t): Record<string, any> =>\n\tnetwork.accounts\n\t\t? Object.entries(network.accounts).reduce(\n\t\t\t(acc, instantiatedAccount) => {\n\t\t\t\tconst alias: string = instantiatedAccount[0];\n\t\t\t\tconst keys = instantiatedAccount[1];\n\t\t\t\treturn alias !== TAQ_OPERATOR_ACCOUNT\n\t\t\t\t\t? {\n\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t[alias]: keys,\n\t\t\t\t\t}\n\t\t\t\t\t: acc;\n\t\t\t},\n\t\t\t{},\n\t\t)\n\t\t: {};\n\nexport const generateAccountKeys = async (\n\tparsedArgs: RequestArgs.t,\n\tnetwork: NetworkConfig.t,\n\taccount: string,\n): Promise<void> => {\n\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\tconst key = await getAccountPrivateKey(parsedArgs, network, account);\n\tawait importKey(tezos, key);\n};\n\nexport const handleOpsError = (err: unknown, env: string): Promise<never> => {\n\tif (err instanceof Error) {\n\t\tconst msg = err.message;\n\t\tif (/ENOTFOUND/.test(msg)) return sendAsyncErr('The RPC URL may be invalid. Check ./.taq/config.json');\n\t\tif (/ECONNREFUSED/.test(msg)) return sendAsyncErr('The RPC URL may be down or the sandbox is not running');\n\t\tif (/empty_implicit_contract/.test(msg)) {\n\t\t\tconst result = msg.match(/(?<=\"implicit\":\")tz[^\"]+(?=\")/);\n\t\t\tconst publicKeyHash = result ? result[0] : undefined;\n\t\t\tif (publicKeyHash) {\n\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t`The account ${publicKeyHash} for the target environment, \"${env}\", may not be funded\\nTo fund this account:\\n1. Go to https://teztnets.xyz and click \"Faucet\" of the target testnet\\n2. Copy and paste the above key into the wallet address field\\n3. Request some Tez (Note that you might need to wait for a few seconds for the network to register the funds)`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn sendAsyncErr(`Error while performing operation:\\n${err} ${JSON.stringify(err, null, 2)}`);\n};\n","import {\n\tgetAddressOfAlias,\n\tgetCurrentEnvironment,\n\tgetCurrentEnvironmentConfig,\n\tgetParameter,\n\tRequestArgs,\n\tsendAsyncErr,\n\tsendJsonRes,\n} from '@taqueria/node-sdk';\nimport { Environment } from '@taqueria/node-sdk/types';\nimport { Expr, Parser } from '@taquito/michel-codec';\nimport { TezosToolkit, WalletOperationBatch } from '@taquito/taquito';\nimport { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';\nimport {\n\tconfigureToolKitForNetwork,\n\tconfigureToolKitForSandbox,\n\tgetEnvTypeAndNodeConfig,\n\thandleOpsError,\n\tTransferOpts as Opts,\n} from './common';\n\nexport type ContractInfo = {\n\tcontractAlias: string;\n\tcontractAddress: string;\n\tparameter: string;\n\tentrypoint: string;\n\tmutezTransfer: number;\n};\n\ntype TableRow = {\n\tcontractAlias: string;\n\tcontractAddress: string;\n\tparameter: string;\n\tentrypoint: string;\n\tmutezTransfer: string;\n\tdestination: string;\n};\n\nconst isContractAddress = (contract: string): boolean =>\n\tcontract.startsWith('tz1') || contract.startsWith('tz2') || contract.startsWith('tz3') || contract.startsWith('KT1');\n\nconst getContractInfo = async (parsedArgs: Opts, env: Environment.t): Promise<ContractInfo> => {\n\tconst contract = parsedArgs.contract;\n\tconst protocolArgs = RequestArgs.create(parsedArgs);\n\treturn {\n\t\tcontractAlias: isContractAddress(contract) ? 'N/A' : contract,\n\t\tcontractAddress: isContractAddress(contract) ? contract : await getAddressOfAlias(env, contract),\n\t\tparameter: parsedArgs.param ? await getParameter(protocolArgs, parsedArgs.param) : 'Unit',\n\t\tentrypoint: parsedArgs.entrypoint ?? 'default',\n\t\tmutezTransfer: parseInt(parsedArgs.mutez ?? '0'),\n\t};\n};\n\nconst createBatchForTransfer = (tezos: TezosToolkit, contractsInfo: ContractInfo[]): WalletOperationBatch =>\n\tcontractsInfo.reduce((acc, contractInfo) =>\n\t\tacc.withTransfer({\n\t\t\tto: contractInfo.contractAddress,\n\t\t\tamount: contractInfo.mutezTransfer,\n\t\t\tparameter: {\n\t\t\t\tentrypoint: contractInfo.entrypoint,\n\t\t\t\tvalue: new Parser().parseMichelineExpression(contractInfo.parameter) as Expr,\n\t\t\t},\n\t\t\tmutez: true,\n\t\t}), tezos.wallet.batch());\n\nexport const performTransferOps = async (\n\ttezos: TezosToolkit,\n\tenv: string,\n\tcontractsInfo: ContractInfo[],\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForTransfer(tezos, contractsInfo);\n\ttry {\n\t\tconst op = await batch.send();\n\t\tawait op.confirmation();\n\t\treturn op;\n\t} catch (err) {\n\t\treturn handleOpsError(err, env);\n\t}\n};\n\nconst prepContractInfoForDisplay = (tezos: TezosToolkit, contractInfo: ContractInfo): TableRow => {\n\treturn {\n\t\tcontractAlias: contractInfo.contractAlias,\n\t\tcontractAddress: contractInfo.contractAddress,\n\t\tparameter: contractInfo.parameter,\n\t\tentrypoint: contractInfo.entrypoint,\n\t\tmutezTransfer: contractInfo.mutezTransfer.toString(),\n\t\tdestination: tezos.rpc.getRpcUrl(),\n\t};\n};\n\nconst transfer = async (opts: Opts): Promise<void> => {\n\tconst protocolArgs = RequestArgs.create(opts);\n\tconst env = getCurrentEnvironmentConfig(protocolArgs);\n\tif (!env) return sendAsyncErr(`There is no environment called ${protocolArgs.env} in your config.json`);\n\ttry {\n\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);\n\t\tconst tezos = await (envType === 'Network'\n\t\t\t? configureToolKitForNetwork(protocolArgs, nodeConfig, opts.sender)\n\t\t\t: configureToolKitForSandbox(nodeConfig, opts.sender));\n\n\t\tconst contractInfo = await getContractInfo(opts, env);\n\n\t\tawait performTransferOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo]);\n\n\t\tconst contractInfoForDisplay = prepContractInfoForDisplay(tezos, contractInfo);\n\t\treturn sendJsonRes([contractInfoForDisplay]);\n\t} catch {\n\t\treturn sendAsyncErr('No operations performed');\n\t}\n};\n\nexport default transfer;\n","import { getCurrentEnvironmentConfig, RequestArgs, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport {\n\tgenerateAccountKeys,\n\tgetDeclaredAccounts,\n\tgetEnvTypeAndNodeConfig,\n\tgetNetworkInstantiatedAccounts,\n} from './common';\n\nconst instantiate_account = async (parsedArgs: RequestArgs.t): Promise<void> => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\tif (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);\n\ttry {\n\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);\n\t\tif (envType !== 'Network') {\n\t\t\treturn sendAsyncErr('taq instantiate-account can only be executed in a network environment');\n\t\t}\n\n\t\tconst declaredAccountAliases = Object.keys(getDeclaredAccounts(parsedArgs));\n\t\tconst instantiatedAccounts = getNetworkInstantiatedAccounts(nodeConfig);\n\n\t\tlet accountsInstantiated = [];\n\t\tfor (const declaredAccountAlias of declaredAccountAliases) {\n\t\t\tif (!instantiatedAccounts.hasOwnProperty(declaredAccountAlias)) {\n\t\t\t\tawait generateAccountKeys(parsedArgs, nodeConfig, declaredAccountAlias);\n\t\t\t\taccountsInstantiated.push(declaredAccountAlias);\n\t\t\t} else {\n\t\t\t\tsendWarn(\n\t\t\t\t\t`Note: ${declaredAccountAlias} is already instantiated in the current environment, \"${parsedArgs.env}\"`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (accountsInstantiated.length !== 0) {\n\t\t\treturn sendJsonRes(\n\t\t\t\t`Accounts instantiated: ${\n\t\t\t\t\taccountsInstantiated.join(', ')\n\t\t\t\t}.\\nPlease execute \"taq fund\" targeting the same environment to fund these accounts`,\n\t\t\t);\n\t\t} else {\n\t\t\treturn sendJsonRes(\n\t\t\t\t`No accounts were instantiated because they were all instantiated in the target environment already`,\n\t\t\t);\n\t\t}\n\t} catch (err) {\n\t\tawait sendAsyncErr('No operations performed');\n\t\tif (parsedArgs.debug) await sendAsyncErr(String(err));\n\t}\n};\n\nexport default instantiate_account;\n","import {\n\taddTzExtensionIfMissing,\n\tgetArtifactsDir,\n\tgetContractContent,\n\tgetCurrentEnvironment,\n\tgetCurrentEnvironmentConfig,\n\tNonEmptyString,\n\tRequestArgs,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n\tupdateAddressAlias,\n} from '@taqueria/node-sdk';\nimport { OperationContentsAndResultOrigination } from '@taquito/rpc';\nimport { TezosToolkit, WalletOperationBatch } from '@taquito/taquito';\nimport { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';\nimport { readFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport {\n\tconfigureToolKitForNetwork,\n\tconfigureToolKitForSandbox,\n\tgetEnvTypeAndNodeConfig,\n\thandleOpsError,\n\tOriginateOpts as Opts,\n} from './common';\n\ntype ContractInfo = {\n\tcontract: string;\n\tcode: string;\n\tinitStorage: string;\n\tmutezTransfer: number;\n};\n\ntype TableRow = {\n\tcontract: string;\n\taddress: string;\n\talias: string;\n\tbalanceInMutez: string;\n\tdestination: string;\n};\n\nconst getContractPath = (parsedArgs: RequestArgs.t, contractFilename: string) =>\n\tjoin(getArtifactsDir(parsedArgs), /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);\n\nconst getDefaultStorageFilename = (contractName: string): string => {\n\tconst baseFilename = basename(contractName, extname(contractName));\n\tconst extFilename = extname(contractName);\n\tconst defaultStorage = `${baseFilename}.default_storage${extFilename}`;\n\treturn defaultStorage;\n};\n\nconst getContractInfo = async (parsedArgs: Opts): Promise<ContractInfo> => {\n\tconst contract = parsedArgs.contract;\n\tconst protocolArgs = RequestArgs.create(parsedArgs);\n\tconst contractWithTzExtension = addTzExtensionIfMissing(contract);\n\tconst contractCode = await getContractContent(protocolArgs, contractWithTzExtension);\n\tif (contractCode === undefined) {\n\t\treturn sendAsyncErr(\n\t\t\t`Please generate ${contractWithTzExtension} with one of the compilers (LIGO, SmartPy, Archetype) or write it manually and put it under /${parsedArgs.config.artifactsDir}\\n`,\n\t\t);\n\t}\n\n\tconst storageFilename = parsedArgs.storage ?? getDefaultStorageFilename(contractWithTzExtension);\n\tconst contractInitStorage = await getContractContent(protocolArgs, storageFilename);\n\tif (contractInitStorage === undefined) {\n\t\treturn sendAsyncErr(\n\t\t\t`❌ No initial storage file was found for ${contractWithTzExtension}\\nStorage must be specified in a file as a Michelson expression and will automatically be linked to this contract if specified with the name \"${\n\t\t\t\tgetDefaultStorageFilename(contractWithTzExtension)\n\t\t\t}\" in the artifacts directory\\nYou can also manually pass a storage file to the originate task using the --storage STORAGE_FILE_NAME option\\n`,\n\t\t);\n\t}\n\n\treturn {\n\t\tcontract,\n\t\tcode: contractCode,\n\t\tinitStorage: contractInitStorage,\n\t\tmutezTransfer: parseInt(parsedArgs.mutez ?? '0'),\n\t};\n};\n\nconst createBatchForOriginate = (tezos: TezosToolkit, contractsInfo: ContractInfo[]): WalletOperationBatch =>\n\tcontractsInfo.reduce((acc, contractInfo) =>\n\t\tacc.withOrigination({\n\t\t\tcode: contractInfo.code,\n\t\t\tinit: contractInfo.initStorage,\n\t\t\tbalance: contractInfo.mutezTransfer.toString(),\n\t\t\tmutez: true,\n\t\t}), tezos.wallet.batch());\n\nexport const performOriginateOps = async (\n\ttezos: TezosToolkit,\n\tenv: string,\n\tcontractsInfo: ContractInfo[],\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForOriginate(tezos, contractsInfo);\n\ttry {\n\t\tconst op = await batch.send();\n\t\tawait op.confirmation();\n\t\treturn op;\n\t} catch (err) {\n\t\treturn handleOpsError(err, env);\n\t}\n};\n\nconst prepContractInfoForDisplay = async (\n\tparsedArgs: Opts,\n\ttezos: TezosToolkit,\n\tcontractInfo: ContractInfo,\n\top: BatchWalletOperation,\n): Promise<TableRow> => {\n\tconst protocolArgs = RequestArgs.create(parsedArgs);\n\tconst operationResults = await op.operationResults();\n\tconst originationResults = operationResults\n\t\t.filter(result => result.kind === 'origination')\n\t\t.map(result => result as OperationContentsAndResultOrigination);\n\n\t// Length should be 1 since we are batching originate operations into one\n\tconst result = originationResults.length === 1 ? originationResults[0] : undefined;\n\tconst address = result?.metadata?.operation_result?.originated_contracts?.join(',');\n\tconst alias = parsedArgs.alias ?? basename(contractInfo.contract, extname(contractInfo.contract));\n\n\tconst displayableAddress = address ?? 'Something went wrong during origination';\n\n\tif (address) {\n\t\tconst validatedAddress = NonEmptyString.create(address);\n\t\tawait updateAddressAlias(protocolArgs, alias, validatedAddress);\n\t}\n\n\treturn {\n\t\tcontract: contractInfo.contract,\n\t\taddress: displayableAddress,\n\t\talias: address ? alias : 'N/A',\n\t\tbalanceInMutez: contractInfo.mutezTransfer.toString(),\n\t\tdestination: tezos.rpc.getRpcUrl(),\n\t};\n};\n\nconst originate = async (parsedArgs: Opts): Promise<void> => {\n\tconst protocolArgs = RequestArgs.create(parsedArgs);\n\tconst env = getCurrentEnvironmentConfig(protocolArgs);\n\tif (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);\n\ttry {\n\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);\n\t\tconst tezos = await (envType === 'Network'\n\t\t\t? configureToolKitForNetwork(protocolArgs, nodeConfig, parsedArgs.sender)\n\t\t\t: configureToolKitForSandbox(nodeConfig, parsedArgs.sender));\n\n\t\tconst contractInfo = await getContractInfo(parsedArgs);\n\n\t\tconst op = await performOriginateOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo]);\n\n\t\tconst contractInfoForDisplay = await prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);\n\t\treturn sendJsonRes([contractInfoForDisplay]);\n\t} catch {\n\t\treturn sendAsyncErr('No operations performed');\n\t}\n};\n\nexport default originate;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
|
package/instantiate_account.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { getCurrentEnvironmentConfig, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
|
|
1
|
+
import { getCurrentEnvironmentConfig, RequestArgs, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
|
|
2
2
|
import {
|
|
3
3
|
generateAccountKeys,
|
|
4
4
|
getDeclaredAccounts,
|
|
5
5
|
getEnvTypeAndNodeConfig,
|
|
6
6
|
getNetworkInstantiatedAccounts,
|
|
7
|
-
InstantiateAccountOpts as Opts,
|
|
8
7
|
} from './common';
|
|
9
8
|
|
|
10
|
-
const instantiate_account = async (parsedArgs:
|
|
9
|
+
const instantiate_account = async (parsedArgs: RequestArgs.t): Promise<void> => {
|
|
11
10
|
const env = getCurrentEnvironmentConfig(parsedArgs);
|
|
12
11
|
if (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
13
12
|
try {
|
|
@@ -42,8 +41,9 @@ const instantiate_account = async (parsedArgs: Opts): Promise<void> => {
|
|
|
42
41
|
`No accounts were instantiated because they were all instantiated in the target environment already`,
|
|
43
42
|
);
|
|
44
43
|
}
|
|
45
|
-
} catch {
|
|
46
|
-
|
|
44
|
+
} catch (err) {
|
|
45
|
+
await sendAsyncErr('No operations performed');
|
|
46
|
+
if (parsedArgs.debug) await sendAsyncErr(String(err));
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
|
package/main.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { sendAsyncErr } from '@taqueria/node-sdk';
|
|
1
|
+
import { RequestArgs, sendAsyncErr } from '@taqueria/node-sdk';
|
|
2
2
|
import { IntersectionOpts as Opts } from './common';
|
|
3
3
|
import fund from './fund';
|
|
4
4
|
import instantiate_account from './instantiate_account';
|
|
5
5
|
import originate from './originate';
|
|
6
6
|
import transfer from './transfer';
|
|
7
7
|
|
|
8
|
-
export const main = (parsedArgs:
|
|
9
|
-
|
|
8
|
+
export const main = (parsedArgs: RequestArgs.t): Promise<void> => {
|
|
9
|
+
const unsafeArgs = parsedArgs as unknown as Opts;
|
|
10
|
+
switch (unsafeArgs.task) {
|
|
10
11
|
case 'deploy':
|
|
11
|
-
return originate(
|
|
12
|
+
return originate(unsafeArgs);
|
|
12
13
|
case 'transfer':
|
|
13
|
-
return transfer(
|
|
14
|
+
return transfer(unsafeArgs);
|
|
14
15
|
case 'instantiate-account':
|
|
15
16
|
return instantiate_account(parsedArgs);
|
|
16
17
|
case 'fund':
|
|
17
18
|
return fund(parsedArgs);
|
|
18
19
|
default:
|
|
19
|
-
return sendAsyncErr(`${
|
|
20
|
+
return sendAsyncErr(`${unsafeArgs} is not an understood task by the Taquito plugin`);
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
|
package/originate.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addTzExtensionIfMissing,
|
|
3
|
+
getArtifactsDir,
|
|
3
4
|
getContractContent,
|
|
4
5
|
getCurrentEnvironment,
|
|
5
6
|
getCurrentEnvironmentConfig,
|
|
7
|
+
NonEmptyString,
|
|
8
|
+
RequestArgs,
|
|
6
9
|
sendAsyncErr,
|
|
7
10
|
sendErr,
|
|
8
11
|
sendJsonRes,
|
|
@@ -36,8 +39,8 @@ type TableRow = {
|
|
|
36
39
|
destination: string;
|
|
37
40
|
};
|
|
38
41
|
|
|
39
|
-
const getContractPath = (parsedArgs:
|
|
40
|
-
join(parsedArgs
|
|
42
|
+
const getContractPath = (parsedArgs: RequestArgs.t, contractFilename: string) =>
|
|
43
|
+
join(getArtifactsDir(parsedArgs), /\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);
|
|
41
44
|
|
|
42
45
|
const getDefaultStorageFilename = (contractName: string): string => {
|
|
43
46
|
const baseFilename = basename(contractName, extname(contractName));
|
|
@@ -48,8 +51,9 @@ const getDefaultStorageFilename = (contractName: string): string => {
|
|
|
48
51
|
|
|
49
52
|
const getContractInfo = async (parsedArgs: Opts): Promise<ContractInfo> => {
|
|
50
53
|
const contract = parsedArgs.contract;
|
|
54
|
+
const protocolArgs = RequestArgs.create(parsedArgs);
|
|
51
55
|
const contractWithTzExtension = addTzExtensionIfMissing(contract);
|
|
52
|
-
const contractCode = await getContractContent(
|
|
56
|
+
const contractCode = await getContractContent(protocolArgs, contractWithTzExtension);
|
|
53
57
|
if (contractCode === undefined) {
|
|
54
58
|
return sendAsyncErr(
|
|
55
59
|
`Please generate ${contractWithTzExtension} with one of the compilers (LIGO, SmartPy, Archetype) or write it manually and put it under /${parsedArgs.config.artifactsDir}\n`,
|
|
@@ -57,7 +61,7 @@ const getContractInfo = async (parsedArgs: Opts): Promise<ContractInfo> => {
|
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
const storageFilename = parsedArgs.storage ?? getDefaultStorageFilename(contractWithTzExtension);
|
|
60
|
-
const contractInitStorage = await getContractContent(
|
|
64
|
+
const contractInitStorage = await getContractContent(protocolArgs, storageFilename);
|
|
61
65
|
if (contractInitStorage === undefined) {
|
|
62
66
|
return sendAsyncErr(
|
|
63
67
|
`❌ No initial storage file was found for ${contractWithTzExtension}\nStorage must be specified in a file as a Michelson expression and will automatically be linked to this contract if specified with the name "${
|
|
@@ -104,6 +108,7 @@ const prepContractInfoForDisplay = async (
|
|
|
104
108
|
contractInfo: ContractInfo,
|
|
105
109
|
op: BatchWalletOperation,
|
|
106
110
|
): Promise<TableRow> => {
|
|
111
|
+
const protocolArgs = RequestArgs.create(parsedArgs);
|
|
107
112
|
const operationResults = await op.operationResults();
|
|
108
113
|
const originationResults = operationResults
|
|
109
114
|
.filter(result => result.kind === 'origination')
|
|
@@ -112,13 +117,18 @@ const prepContractInfoForDisplay = async (
|
|
|
112
117
|
// Length should be 1 since we are batching originate operations into one
|
|
113
118
|
const result = originationResults.length === 1 ? originationResults[0] : undefined;
|
|
114
119
|
const address = result?.metadata?.operation_result?.originated_contracts?.join(',');
|
|
115
|
-
|
|
116
120
|
const alias = parsedArgs.alias ?? basename(contractInfo.contract, extname(contractInfo.contract));
|
|
117
|
-
|
|
121
|
+
|
|
122
|
+
const displayableAddress = address ?? 'Something went wrong during origination';
|
|
123
|
+
|
|
124
|
+
if (address) {
|
|
125
|
+
const validatedAddress = NonEmptyString.create(address);
|
|
126
|
+
await updateAddressAlias(protocolArgs, alias, validatedAddress);
|
|
127
|
+
}
|
|
118
128
|
|
|
119
129
|
return {
|
|
120
130
|
contract: contractInfo.contract,
|
|
121
|
-
address:
|
|
131
|
+
address: displayableAddress,
|
|
122
132
|
alias: address ? alias : 'N/A',
|
|
123
133
|
balanceInMutez: contractInfo.mutezTransfer.toString(),
|
|
124
134
|
destination: tezos.rpc.getRpcUrl(),
|
|
@@ -126,17 +136,18 @@ const prepContractInfoForDisplay = async (
|
|
|
126
136
|
};
|
|
127
137
|
|
|
128
138
|
const originate = async (parsedArgs: Opts): Promise<void> => {
|
|
129
|
-
const
|
|
139
|
+
const protocolArgs = RequestArgs.create(parsedArgs);
|
|
140
|
+
const env = getCurrentEnvironmentConfig(protocolArgs);
|
|
130
141
|
if (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
131
142
|
try {
|
|
132
|
-
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(
|
|
143
|
+
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
|
|
133
144
|
const tezos = await (envType === 'Network'
|
|
134
|
-
? configureToolKitForNetwork(
|
|
145
|
+
? configureToolKitForNetwork(protocolArgs, nodeConfig, parsedArgs.sender)
|
|
135
146
|
: configureToolKitForSandbox(nodeConfig, parsedArgs.sender));
|
|
136
147
|
|
|
137
148
|
const contractInfo = await getContractInfo(parsedArgs);
|
|
138
149
|
|
|
139
|
-
const op = await performOriginateOps(tezos, getCurrentEnvironment(
|
|
150
|
+
const op = await performOriginateOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo]);
|
|
140
151
|
|
|
141
152
|
const contractInfoForDisplay = await prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);
|
|
142
153
|
return sendJsonRes([contractInfoForDisplay]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-taquito",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.3-alpha",
|
|
4
4
|
"description": "A taqueria plugin for originating smart contracts using Taquito",
|
|
5
5
|
"targets": {
|
|
6
6
|
"default": {
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/ecadlabs/taqueria#readme",
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"parcel": "2.
|
|
45
|
+
"parcel": "^2.8.0",
|
|
46
46
|
"typescript": "^4.7.2"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@taqueria/node-sdk": "^0.
|
|
49
|
+
"@taqueria/node-sdk": "^0.25.3-alpha",
|
|
50
50
|
"@taquito/michel-codec": "^13.0.1",
|
|
51
51
|
"@taquito/signer": "^13.0.1",
|
|
52
52
|
"@taquito/taquito": "^13.0.1",
|
package/transfer.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
getCurrentEnvironment,
|
|
4
4
|
getCurrentEnvironmentConfig,
|
|
5
5
|
getParameter,
|
|
6
|
+
RequestArgs,
|
|
6
7
|
sendAsyncErr,
|
|
7
8
|
sendJsonRes,
|
|
8
9
|
} from '@taqueria/node-sdk';
|
|
@@ -40,10 +41,11 @@ const isContractAddress = (contract: string): boolean =>
|
|
|
40
41
|
|
|
41
42
|
const getContractInfo = async (parsedArgs: Opts, env: Environment.t): Promise<ContractInfo> => {
|
|
42
43
|
const contract = parsedArgs.contract;
|
|
44
|
+
const protocolArgs = RequestArgs.create(parsedArgs);
|
|
43
45
|
return {
|
|
44
46
|
contractAlias: isContractAddress(contract) ? 'N/A' : contract,
|
|
45
47
|
contractAddress: isContractAddress(contract) ? contract : await getAddressOfAlias(env, contract),
|
|
46
|
-
parameter: parsedArgs.param ? await getParameter(
|
|
48
|
+
parameter: parsedArgs.param ? await getParameter(protocolArgs, parsedArgs.param) : 'Unit',
|
|
47
49
|
entrypoint: parsedArgs.entrypoint ?? 'default',
|
|
48
50
|
mutezTransfer: parseInt(parsedArgs.mutez ?? '0'),
|
|
49
51
|
};
|
|
@@ -87,18 +89,19 @@ const prepContractInfoForDisplay = (tezos: TezosToolkit, contractInfo: ContractI
|
|
|
87
89
|
};
|
|
88
90
|
};
|
|
89
91
|
|
|
90
|
-
const transfer = async (
|
|
91
|
-
const
|
|
92
|
-
|
|
92
|
+
const transfer = async (opts: Opts): Promise<void> => {
|
|
93
|
+
const protocolArgs = RequestArgs.create(opts);
|
|
94
|
+
const env = getCurrentEnvironmentConfig(protocolArgs);
|
|
95
|
+
if (!env) return sendAsyncErr(`There is no environment called ${protocolArgs.env} in your config.json`);
|
|
93
96
|
try {
|
|
94
|
-
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(
|
|
97
|
+
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
|
|
95
98
|
const tezos = await (envType === 'Network'
|
|
96
|
-
? configureToolKitForNetwork(
|
|
97
|
-
: configureToolKitForSandbox(nodeConfig,
|
|
99
|
+
? configureToolKitForNetwork(protocolArgs, nodeConfig, opts.sender)
|
|
100
|
+
: configureToolKitForSandbox(nodeConfig, opts.sender));
|
|
98
101
|
|
|
99
|
-
const contractInfo = await getContractInfo(
|
|
102
|
+
const contractInfo = await getContractInfo(opts, env);
|
|
100
103
|
|
|
101
|
-
await performTransferOps(tezos, getCurrentEnvironment(
|
|
104
|
+
await performTransferOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo]);
|
|
102
105
|
|
|
103
106
|
const contractInfoForDisplay = prepContractInfoForDisplay(tezos, contractInfo);
|
|
104
107
|
return sendJsonRes([contractInfoForDisplay]);
|
package/tsconfig.json
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
/* Language and Environment */
|
|
14
14
|
"target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
-
|
|
15
|
+
"lib": [
|
|
16
|
+
"ES2021.String"
|
|
17
|
+
], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
18
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
19
|
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
20
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|