@taqueria/plugin-taquito 0.25.6-alpha → 0.25.11-rc
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 +14 -20
- package/fund.ts +2 -3
- package/index.js +29 -40
- package/index.js.map +1 -1
- package/instantiate_account.ts +5 -5
- package/main.ts +6 -7
- package/originate.ts +11 -22
- package/package.json +3 -3
- package/transfer.ts +9 -12
- package/tsconfig.json +1 -3
package/common.ts
CHANGED
|
@@ -3,40 +3,34 @@ import {
|
|
|
3
3
|
getDefaultSandboxAccount,
|
|
4
4
|
getNetworkConfig,
|
|
5
5
|
getSandboxConfig,
|
|
6
|
-
RequestArgs,
|
|
7
6
|
sendAsyncErr,
|
|
8
7
|
TAQ_OPERATOR_ACCOUNT,
|
|
9
8
|
} from '@taqueria/node-sdk';
|
|
10
|
-
import {
|
|
11
|
-
Environment,
|
|
12
|
-
NetworkConfig,
|
|
13
|
-
Protocol,
|
|
14
|
-
ProxyTaskArgs,
|
|
15
|
-
SandboxAccountConfig,
|
|
16
|
-
SandboxConfig,
|
|
17
|
-
} from '@taqueria/node-sdk/types';
|
|
9
|
+
import { Environment, NetworkConfig, RequestArgs, SandboxAccountConfig, SandboxConfig } from '@taqueria/node-sdk/types';
|
|
18
10
|
import { importKey, InMemorySigner } from '@taquito/signer';
|
|
19
11
|
import { TezosToolkit } from '@taquito/taquito';
|
|
20
12
|
|
|
21
|
-
export
|
|
13
|
+
export interface OriginateOpts extends RequestArgs.ProxyRequestArgs {
|
|
22
14
|
contract: string;
|
|
23
15
|
storage: string;
|
|
24
16
|
alias?: string;
|
|
25
17
|
sender?: string;
|
|
26
18
|
mutez?: string;
|
|
27
|
-
}
|
|
19
|
+
}
|
|
28
20
|
|
|
29
|
-
export
|
|
21
|
+
export interface TransferOpts extends RequestArgs.ProxyRequestArgs {
|
|
30
22
|
contract: string;
|
|
31
23
|
mutez?: string;
|
|
32
24
|
param?: string;
|
|
33
25
|
entrypoint?: string;
|
|
34
26
|
sender?: string;
|
|
35
|
-
}
|
|
27
|
+
}
|
|
36
28
|
|
|
37
|
-
export
|
|
29
|
+
export interface InstantiateAccountOpts extends RequestArgs.ProxyRequestArgs {
|
|
30
|
+
}
|
|
38
31
|
|
|
39
|
-
export
|
|
32
|
+
export interface FundOpts extends RequestArgs.ProxyRequestArgs {
|
|
33
|
+
}
|
|
40
34
|
|
|
41
35
|
// To be used for the main entrypoint of the plugin
|
|
42
36
|
export type IntersectionOpts = OriginateOpts & TransferOpts & InstantiateAccountOpts & FundOpts;
|
|
@@ -45,7 +39,7 @@ export type IntersectionOpts = OriginateOpts & TransferOpts & InstantiateAccount
|
|
|
45
39
|
type UnionOpts = OriginateOpts | TransferOpts | InstantiateAccountOpts | FundOpts;
|
|
46
40
|
|
|
47
41
|
export const getEnvTypeAndNodeConfig = (
|
|
48
|
-
parsedArgs:
|
|
42
|
+
parsedArgs: UnionOpts,
|
|
49
43
|
env: Environment.t,
|
|
50
44
|
): Promise<['Network', NetworkConfig.t] | ['Sandbox', SandboxConfig.t]> => {
|
|
51
45
|
const targetConstraintErrMsg = 'Each environment can only have one target, be it a network or a sandbox';
|
|
@@ -100,7 +94,7 @@ export const configureToolKitForSandbox = async (sandbox: SandboxConfig.t, sende
|
|
|
100
94
|
};
|
|
101
95
|
|
|
102
96
|
export const configureToolKitForNetwork = async (
|
|
103
|
-
parsedArgs:
|
|
97
|
+
parsedArgs: UnionOpts,
|
|
104
98
|
network: NetworkConfig.t,
|
|
105
99
|
sender?: string,
|
|
106
100
|
): Promise<TezosToolkit> => {
|
|
@@ -124,8 +118,8 @@ export const configureToolKitForNetwork = async (
|
|
|
124
118
|
return tezos;
|
|
125
119
|
};
|
|
126
120
|
|
|
127
|
-
export const getDeclaredAccounts = (parsedArgs:
|
|
128
|
-
Object.entries(parsedArgs.config.accounts
|
|
121
|
+
export const getDeclaredAccounts = (parsedArgs: UnionOpts): Record<string, number> =>
|
|
122
|
+
Object.entries(parsedArgs.config.accounts).reduce(
|
|
129
123
|
(acc, declaredAccount) => {
|
|
130
124
|
const alias: string = declaredAccount[0];
|
|
131
125
|
const mutez: string | number = declaredAccount[1];
|
|
@@ -172,7 +166,7 @@ export const getNetworkInstantiatedAccounts = (network: NetworkConfig.t): Record
|
|
|
172
166
|
: {};
|
|
173
167
|
|
|
174
168
|
export const generateAccountKeys = async (
|
|
175
|
-
parsedArgs:
|
|
169
|
+
parsedArgs: UnionOpts,
|
|
176
170
|
network: NetworkConfig.t,
|
|
177
171
|
account: string,
|
|
178
172
|
): Promise<void> => {
|
package/fund.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCurrentEnvironment,
|
|
3
3
|
getCurrentEnvironmentConfig,
|
|
4
|
-
RequestArgs,
|
|
5
4
|
sendAsyncErr,
|
|
6
5
|
sendJsonRes,
|
|
7
6
|
sendWarn,
|
|
@@ -23,7 +22,7 @@ type TableRow = {
|
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
const getAccountsInfo = (
|
|
26
|
-
parsedArgs:
|
|
25
|
+
parsedArgs: Opts,
|
|
27
26
|
tezos: TezosToolkit,
|
|
28
27
|
instantiatedAccounts: Record<string, any>,
|
|
29
28
|
): Promise<ContractInfo[]> =>
|
|
@@ -64,7 +63,7 @@ const prepAccountsInfoForDisplay = (accountsInfo: ContractInfo[]): TableRow[] =>
|
|
|
64
63
|
};
|
|
65
64
|
});
|
|
66
65
|
|
|
67
|
-
const fund = async (parsedArgs:
|
|
66
|
+
const fund = async (parsedArgs: Opts): Promise<void> => {
|
|
68
67
|
const env = getCurrentEnvironmentConfig(parsedArgs);
|
|
69
68
|
if (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
70
69
|
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
|
|
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,11 +112,10 @@ 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);
|
|
116
115
|
return {
|
|
117
116
|
contractAlias: $944e64d99e99b46e$var$isContractAddress(contract) ? "N/A" : contract,
|
|
118
117
|
contractAddress: $944e64d99e99b46e$var$isContractAddress(contract) ? contract : await (0, $iVZbm$taquerianodesdk.getAddressOfAlias)(env, contract),
|
|
119
|
-
parameter: parsedArgs.param ? await (0, $iVZbm$taquerianodesdk.getParameter)(
|
|
118
|
+
parameter: parsedArgs.param ? await (0, $iVZbm$taquerianodesdk.getParameter)(parsedArgs, parsedArgs.param) : "Unit",
|
|
120
119
|
entrypoint: parsedArgs.entrypoint ?? "default",
|
|
121
120
|
mutezTransfer: parseInt(parsedArgs.mutez ?? "0")
|
|
122
121
|
};
|
|
@@ -150,15 +149,14 @@ const $944e64d99e99b46e$var$prepContractInfoForDisplay = (tezos, contractInfo)=>
|
|
|
150
149
|
destination: tezos.rpc.getRpcUrl()
|
|
151
150
|
};
|
|
152
151
|
};
|
|
153
|
-
const $944e64d99e99b46e$var$transfer = async (
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
if (!env) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`There is no environment called ${protocolArgs.env} in your config.json`);
|
|
152
|
+
const $944e64d99e99b46e$var$transfer = async (parsedArgs)=>{
|
|
153
|
+
const env = (0, $iVZbm$taquerianodesdk.getCurrentEnvironmentConfig)(parsedArgs);
|
|
154
|
+
if (!env) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
157
155
|
try {
|
|
158
|
-
const [envType, nodeConfig] = await (0, $2c87226370e1ba97$export$e1210318d02974b)(
|
|
159
|
-
const tezos = await (envType === "Network" ? (0, $2c87226370e1ba97$export$5a1c5b7c3009d1b0)(
|
|
160
|
-
const contractInfo = await $944e64d99e99b46e$var$getContractInfo(
|
|
161
|
-
await $944e64d99e99b46e$export$e61a38557a73155d(tezos, (0, $iVZbm$taquerianodesdk.getCurrentEnvironment)(
|
|
156
|
+
const [envType, nodeConfig] = await (0, $2c87226370e1ba97$export$e1210318d02974b)(parsedArgs, env);
|
|
157
|
+
const tezos = await (envType === "Network" ? (0, $2c87226370e1ba97$export$5a1c5b7c3009d1b0)(parsedArgs, nodeConfig, parsedArgs.sender) : (0, $2c87226370e1ba97$export$cf995f4bdbe82fd9)(nodeConfig, parsedArgs.sender));
|
|
158
|
+
const contractInfo = await $944e64d99e99b46e$var$getContractInfo(parsedArgs, env);
|
|
159
|
+
await $944e64d99e99b46e$export$e61a38557a73155d(tezos, (0, $iVZbm$taquerianodesdk.getCurrentEnvironment)(parsedArgs), [
|
|
162
160
|
contractInfo
|
|
163
161
|
]);
|
|
164
162
|
const contractInfoForDisplay = $944e64d99e99b46e$var$prepContractInfoForDisplay(tezos, contractInfo);
|
|
@@ -231,9 +229,8 @@ const $ae16ebef21e504f4$var$instantiate_account = async (parsedArgs)=>{
|
|
|
231
229
|
} else (0, $iVZbm$taquerianodesdk.sendWarn)(`Note: ${declaredAccountAlias} is already instantiated in the current environment, "${parsedArgs.env}"`);
|
|
232
230
|
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`);
|
|
233
231
|
else return (0, $iVZbm$taquerianodesdk.sendJsonRes)(`No accounts were instantiated because they were all instantiated in the target environment already`);
|
|
234
|
-
} catch
|
|
235
|
-
|
|
236
|
-
if (parsedArgs.debug) await (0, $iVZbm$taquerianodesdk.sendAsyncErr)(String(err));
|
|
232
|
+
} catch {
|
|
233
|
+
return (0, $iVZbm$taquerianodesdk.sendAsyncErr)("No operations performed");
|
|
237
234
|
}
|
|
238
235
|
};
|
|
239
236
|
var $ae16ebef21e504f4$export$2e2bcd8739ae039 = $ae16ebef21e504f4$var$instantiate_account;
|
|
@@ -242,7 +239,7 @@ var $ae16ebef21e504f4$export$2e2bcd8739ae039 = $ae16ebef21e504f4$var$instantiate
|
|
|
242
239
|
|
|
243
240
|
|
|
244
241
|
|
|
245
|
-
const $806c5c6032403442$var$getContractPath = (parsedArgs, contractFilename)=>(0, $iVZbm$path.join)(
|
|
242
|
+
const $806c5c6032403442$var$getContractPath = (parsedArgs, contractFilename)=>(0, $iVZbm$path.join)(parsedArgs.config.artifactsDir, /\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);
|
|
246
243
|
const $806c5c6032403442$var$getDefaultStorageFilename = (contractName)=>{
|
|
247
244
|
const baseFilename = (0, $iVZbm$path.basename)(contractName, (0, $iVZbm$path.extname)(contractName));
|
|
248
245
|
const extFilename = (0, $iVZbm$path.extname)(contractName);
|
|
@@ -251,12 +248,11 @@ const $806c5c6032403442$var$getDefaultStorageFilename = (contractName)=>{
|
|
|
251
248
|
};
|
|
252
249
|
const $806c5c6032403442$var$getContractInfo = async (parsedArgs)=>{
|
|
253
250
|
const contract = parsedArgs.contract;
|
|
254
|
-
const protocolArgs = (0, $iVZbm$taquerianodesdk.RequestArgs).create(parsedArgs);
|
|
255
251
|
const contractWithTzExtension = (0, $iVZbm$taquerianodesdk.addTzExtensionIfMissing)(contract);
|
|
256
|
-
const contractCode = await (0, $iVZbm$taquerianodesdk.getContractContent)(
|
|
252
|
+
const contractCode = await (0, $iVZbm$taquerianodesdk.getContractContent)(parsedArgs, contractWithTzExtension);
|
|
257
253
|
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`);
|
|
258
254
|
const storageFilename = parsedArgs.storage ?? $806c5c6032403442$var$getDefaultStorageFilename(contractWithTzExtension);
|
|
259
|
-
const contractInitStorage = await (0, $iVZbm$taquerianodesdk.getContractContent)(
|
|
255
|
+
const contractInitStorage = await (0, $iVZbm$taquerianodesdk.getContractContent)(parsedArgs, storageFilename);
|
|
260
256
|
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`);
|
|
261
257
|
return {
|
|
262
258
|
contract: contract,
|
|
@@ -282,35 +278,29 @@ const $806c5c6032403442$export$4737da0e626ec8c7 = async (tezos, env, contractsIn
|
|
|
282
278
|
}
|
|
283
279
|
};
|
|
284
280
|
const $806c5c6032403442$var$prepContractInfoForDisplay = async (parsedArgs, tezos, contractInfo, op)=>{
|
|
285
|
-
const protocolArgs = (0, $iVZbm$taquerianodesdk.RequestArgs).create(parsedArgs);
|
|
286
281
|
const operationResults = await op.operationResults();
|
|
287
282
|
const originationResults = operationResults.filter((result)=>result.kind === "origination").map((result)=>result);
|
|
288
283
|
// Length should be 1 since we are batching originate operations into one
|
|
289
|
-
const
|
|
290
|
-
const address =
|
|
284
|
+
const result1 = originationResults.length === 1 ? originationResults[0] : undefined;
|
|
285
|
+
const address = result1?.metadata?.operation_result?.originated_contracts?.join(",");
|
|
291
286
|
const alias = parsedArgs.alias ?? (0, $iVZbm$path.basename)(contractInfo.contract, (0, $iVZbm$path.extname)(contractInfo.contract));
|
|
292
|
-
|
|
293
|
-
if (address) {
|
|
294
|
-
const validatedAddress = (0, $iVZbm$taquerianodesdk.NonEmptyString).create(address);
|
|
295
|
-
await (0, $iVZbm$taquerianodesdk.updateAddressAlias)(protocolArgs, alias, validatedAddress);
|
|
296
|
-
}
|
|
287
|
+
if (address) await (0, $iVZbm$taquerianodesdk.updateAddressAlias)(parsedArgs, alias, address);
|
|
297
288
|
return {
|
|
298
289
|
contract: contractInfo.contract,
|
|
299
|
-
address:
|
|
290
|
+
address: address ?? "Something went wrong during origination",
|
|
300
291
|
alias: address ? alias : "N/A",
|
|
301
292
|
balanceInMutez: contractInfo.mutezTransfer.toString(),
|
|
302
293
|
destination: tezos.rpc.getRpcUrl()
|
|
303
294
|
};
|
|
304
295
|
};
|
|
305
296
|
const $806c5c6032403442$var$originate = async (parsedArgs)=>{
|
|
306
|
-
const
|
|
307
|
-
const env = (0, $iVZbm$taquerianodesdk.getCurrentEnvironmentConfig)(protocolArgs);
|
|
297
|
+
const env = (0, $iVZbm$taquerianodesdk.getCurrentEnvironmentConfig)(parsedArgs);
|
|
308
298
|
if (!env) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
309
299
|
try {
|
|
310
|
-
const [envType, nodeConfig] = await (0, $2c87226370e1ba97$export$e1210318d02974b)(
|
|
311
|
-
const tezos = await (envType === "Network" ? (0, $2c87226370e1ba97$export$5a1c5b7c3009d1b0)(
|
|
300
|
+
const [envType, nodeConfig] = await (0, $2c87226370e1ba97$export$e1210318d02974b)(parsedArgs, env);
|
|
301
|
+
const tezos = await (envType === "Network" ? (0, $2c87226370e1ba97$export$5a1c5b7c3009d1b0)(parsedArgs, nodeConfig, parsedArgs.sender) : (0, $2c87226370e1ba97$export$cf995f4bdbe82fd9)(nodeConfig, parsedArgs.sender));
|
|
312
302
|
const contractInfo = await $806c5c6032403442$var$getContractInfo(parsedArgs);
|
|
313
|
-
const op = await $806c5c6032403442$export$4737da0e626ec8c7(tezos, (0, $iVZbm$taquerianodesdk.getCurrentEnvironment)(
|
|
303
|
+
const op = await $806c5c6032403442$export$4737da0e626ec8c7(tezos, (0, $iVZbm$taquerianodesdk.getCurrentEnvironment)(parsedArgs), [
|
|
314
304
|
contractInfo
|
|
315
305
|
]);
|
|
316
306
|
const contractInfoForDisplay = await $806c5c6032403442$var$prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);
|
|
@@ -326,18 +316,17 @@ var $806c5c6032403442$export$2e2bcd8739ae039 = $806c5c6032403442$var$originate;
|
|
|
326
316
|
|
|
327
317
|
|
|
328
318
|
const $0b2a174572c7ba1b$export$f22da7240b7add18 = (parsedArgs)=>{
|
|
329
|
-
|
|
330
|
-
switch(unsafeArgs.task){
|
|
319
|
+
switch(parsedArgs.task){
|
|
331
320
|
case "deploy":
|
|
332
|
-
return (0, $806c5c6032403442$export$2e2bcd8739ae039)(
|
|
321
|
+
return (0, $806c5c6032403442$export$2e2bcd8739ae039)(parsedArgs);
|
|
333
322
|
case "transfer":
|
|
334
|
-
return (0, $944e64d99e99b46e$export$2e2bcd8739ae039)(
|
|
323
|
+
return (0, $944e64d99e99b46e$export$2e2bcd8739ae039)(parsedArgs);
|
|
335
324
|
case "instantiate-account":
|
|
336
325
|
return (0, $ae16ebef21e504f4$export$2e2bcd8739ae039)(parsedArgs);
|
|
337
326
|
case "fund":
|
|
338
327
|
return (0, $1e142599cb4e04fd$export$2e2bcd8739ae039)(parsedArgs);
|
|
339
328
|
default:
|
|
340
|
-
return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`${
|
|
329
|
+
return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`${parsedArgs.task} is not an understood task by the Taquito plugin`);
|
|
341
330
|
}
|
|
342
331
|
};
|
|
343
332
|
var $0b2a174572c7ba1b$export$2e2bcd8739ae039 = $0b2a174572c7ba1b$export$f22da7240b7add18;
|
|
@@ -372,7 +361,7 @@ var $0b2a174572c7ba1b$export$2e2bcd8739ae039 = $0b2a174572c7ba1b$export$f22da724
|
|
|
372
361
|
flag: "mutez",
|
|
373
362
|
description: "Amount of Mutez to transfer",
|
|
374
363
|
required: false
|
|
375
|
-
})
|
|
364
|
+
}),
|
|
376
365
|
],
|
|
377
366
|
aliases: [
|
|
378
367
|
"originate"
|
|
@@ -404,7 +393,7 @@ var $0b2a174572c7ba1b$export$2e2bcd8739ae039 = $0b2a174572c7ba1b$export$f22da724
|
|
|
404
393
|
flag: "sender",
|
|
405
394
|
description: "Name of an instantiated account to use as the sender of the transfer operation",
|
|
406
395
|
required: false
|
|
407
|
-
})
|
|
396
|
+
}),
|
|
408
397
|
],
|
|
409
398
|
aliases: [
|
|
410
399
|
"call"
|
|
@@ -425,7 +414,7 @@ var $0b2a174572c7ba1b$export$2e2bcd8739ae039 = $0b2a174572c7ba1b$export$f22da724
|
|
|
425
414
|
description: 'Instantiate all accounts declared in the "accounts" field at the root level of the config file to a target environment',
|
|
426
415
|
handler: "proxy",
|
|
427
416
|
encoding: "application/json"
|
|
428
|
-
})
|
|
417
|
+
}),
|
|
429
418
|
],
|
|
430
419
|
proxy: (0, $0b2a174572c7ba1b$export$2e2bcd8739ae039)
|
|
431
420
|
}), process.argv);
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;IAC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MAAM,CAAC;gBACX,MAAM;gBACN,SAAS;gBACT,aAAa;gBACb,SAAS;gBACT,UAAU;YACX;YACA,CAAA,GAAA,2BAAG,EAAE,MAAM,CAAC;gBACX,MAAM;gBACN,SAAS;gBACT,aACC;gBACD,SAAS;gBACT,UAAU;YACX;SACA;QACD,OAAO,CAAA,GAAA,wCAAG;IACX,CAAA,GAAI,QAAQ,IAAI","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 { 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":"../"}
|
|
1
|
+
{"mappings":";;;;;;AAAA;ACAA;ACAA;ACAA;;;AAwCO,MAAM,wCAAuB,GAAG,CACtC,UAAqB,EACrB,GAAkB,GACwD;IAC1E,MAAM,sB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kB;aAC5B,CAAC;YACF,CAAA,GAAA,2BAAI,CAAA,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,MAAM;gBACf,WAAW,EAAE,8FAA8F;gBAC3G,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,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":"../"}
|
package/instantiate_account.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { getCurrentEnvironmentConfig,
|
|
1
|
+
import { getCurrentEnvironmentConfig, 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,
|
|
7
8
|
} from './common';
|
|
8
9
|
|
|
9
|
-
const instantiate_account = async (parsedArgs:
|
|
10
|
+
const instantiate_account = async (parsedArgs: Opts): Promise<void> => {
|
|
10
11
|
const env = getCurrentEnvironmentConfig(parsedArgs);
|
|
11
12
|
if (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
12
13
|
try {
|
|
@@ -41,9 +42,8 @@ const instantiate_account = async (parsedArgs: RequestArgs.t): Promise<void> =>
|
|
|
41
42
|
`No accounts were instantiated because they were all instantiated in the target environment already`,
|
|
42
43
|
);
|
|
43
44
|
}
|
|
44
|
-
} catch
|
|
45
|
-
|
|
46
|
-
if (parsedArgs.debug) await sendAsyncErr(String(err));
|
|
45
|
+
} catch {
|
|
46
|
+
return sendAsyncErr('No operations performed');
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
|
package/main.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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
|
-
|
|
10
|
-
switch (unsafeArgs.task) {
|
|
8
|
+
export const main = (parsedArgs: Opts): Promise<void> => {
|
|
9
|
+
switch (parsedArgs.task) {
|
|
11
10
|
case 'deploy':
|
|
12
|
-
return originate(
|
|
11
|
+
return originate(parsedArgs);
|
|
13
12
|
case 'transfer':
|
|
14
|
-
return transfer(
|
|
13
|
+
return transfer(parsedArgs);
|
|
15
14
|
case 'instantiate-account':
|
|
16
15
|
return instantiate_account(parsedArgs);
|
|
17
16
|
case 'fund':
|
|
18
17
|
return fund(parsedArgs);
|
|
19
18
|
default:
|
|
20
|
-
return sendAsyncErr(`${
|
|
19
|
+
return sendAsyncErr(`${parsedArgs.task} is not an understood task by the Taquito plugin`);
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
22
|
|
package/originate.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addTzExtensionIfMissing,
|
|
3
|
-
getArtifactsDir,
|
|
4
3
|
getContractContent,
|
|
5
4
|
getCurrentEnvironment,
|
|
6
5
|
getCurrentEnvironmentConfig,
|
|
7
|
-
NonEmptyString,
|
|
8
|
-
RequestArgs,
|
|
9
6
|
sendAsyncErr,
|
|
10
7
|
sendErr,
|
|
11
8
|
sendJsonRes,
|
|
@@ -39,8 +36,8 @@ type TableRow = {
|
|
|
39
36
|
destination: string;
|
|
40
37
|
};
|
|
41
38
|
|
|
42
|
-
const getContractPath = (parsedArgs:
|
|
43
|
-
join(
|
|
39
|
+
const getContractPath = (parsedArgs: Opts, contractFilename: string) =>
|
|
40
|
+
join(parsedArgs.config.artifactsDir, /\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);
|
|
44
41
|
|
|
45
42
|
const getDefaultStorageFilename = (contractName: string): string => {
|
|
46
43
|
const baseFilename = basename(contractName, extname(contractName));
|
|
@@ -51,9 +48,8 @@ const getDefaultStorageFilename = (contractName: string): string => {
|
|
|
51
48
|
|
|
52
49
|
const getContractInfo = async (parsedArgs: Opts): Promise<ContractInfo> => {
|
|
53
50
|
const contract = parsedArgs.contract;
|
|
54
|
-
const protocolArgs = RequestArgs.create(parsedArgs);
|
|
55
51
|
const contractWithTzExtension = addTzExtensionIfMissing(contract);
|
|
56
|
-
const contractCode = await getContractContent(
|
|
52
|
+
const contractCode = await getContractContent(parsedArgs, contractWithTzExtension);
|
|
57
53
|
if (contractCode === undefined) {
|
|
58
54
|
return sendAsyncErr(
|
|
59
55
|
`Please generate ${contractWithTzExtension} with one of the compilers (LIGO, SmartPy, Archetype) or write it manually and put it under /${parsedArgs.config.artifactsDir}\n`,
|
|
@@ -61,7 +57,7 @@ const getContractInfo = async (parsedArgs: Opts): Promise<ContractInfo> => {
|
|
|
61
57
|
}
|
|
62
58
|
|
|
63
59
|
const storageFilename = parsedArgs.storage ?? getDefaultStorageFilename(contractWithTzExtension);
|
|
64
|
-
const contractInitStorage = await getContractContent(
|
|
60
|
+
const contractInitStorage = await getContractContent(parsedArgs, storageFilename);
|
|
65
61
|
if (contractInitStorage === undefined) {
|
|
66
62
|
return sendAsyncErr(
|
|
67
63
|
`❌ 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 "${
|
|
@@ -108,7 +104,6 @@ const prepContractInfoForDisplay = async (
|
|
|
108
104
|
contractInfo: ContractInfo,
|
|
109
105
|
op: BatchWalletOperation,
|
|
110
106
|
): Promise<TableRow> => {
|
|
111
|
-
const protocolArgs = RequestArgs.create(parsedArgs);
|
|
112
107
|
const operationResults = await op.operationResults();
|
|
113
108
|
const originationResults = operationResults
|
|
114
109
|
.filter(result => result.kind === 'origination')
|
|
@@ -117,18 +112,13 @@ const prepContractInfoForDisplay = async (
|
|
|
117
112
|
// Length should be 1 since we are batching originate operations into one
|
|
118
113
|
const result = originationResults.length === 1 ? originationResults[0] : undefined;
|
|
119
114
|
const address = result?.metadata?.operation_result?.originated_contracts?.join(',');
|
|
120
|
-
const alias = parsedArgs.alias ?? basename(contractInfo.contract, extname(contractInfo.contract));
|
|
121
|
-
|
|
122
|
-
const displayableAddress = address ?? 'Something went wrong during origination';
|
|
123
115
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
await updateAddressAlias(protocolArgs, alias, validatedAddress);
|
|
127
|
-
}
|
|
116
|
+
const alias = parsedArgs.alias ?? basename(contractInfo.contract, extname(contractInfo.contract));
|
|
117
|
+
if (address) await updateAddressAlias(parsedArgs, alias, address);
|
|
128
118
|
|
|
129
119
|
return {
|
|
130
120
|
contract: contractInfo.contract,
|
|
131
|
-
address:
|
|
121
|
+
address: address ?? 'Something went wrong during origination',
|
|
132
122
|
alias: address ? alias : 'N/A',
|
|
133
123
|
balanceInMutez: contractInfo.mutezTransfer.toString(),
|
|
134
124
|
destination: tezos.rpc.getRpcUrl(),
|
|
@@ -136,18 +126,17 @@ const prepContractInfoForDisplay = async (
|
|
|
136
126
|
};
|
|
137
127
|
|
|
138
128
|
const originate = async (parsedArgs: Opts): Promise<void> => {
|
|
139
|
-
const
|
|
140
|
-
const env = getCurrentEnvironmentConfig(protocolArgs);
|
|
129
|
+
const env = getCurrentEnvironmentConfig(parsedArgs);
|
|
141
130
|
if (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
142
131
|
try {
|
|
143
|
-
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(
|
|
132
|
+
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);
|
|
144
133
|
const tezos = await (envType === 'Network'
|
|
145
|
-
? configureToolKitForNetwork(
|
|
134
|
+
? configureToolKitForNetwork(parsedArgs, nodeConfig, parsedArgs.sender)
|
|
146
135
|
: configureToolKitForSandbox(nodeConfig, parsedArgs.sender));
|
|
147
136
|
|
|
148
137
|
const contractInfo = await getContractInfo(parsedArgs);
|
|
149
138
|
|
|
150
|
-
const op = await performOriginateOps(tezos, getCurrentEnvironment(
|
|
139
|
+
const op = await performOriginateOps(tezos, getCurrentEnvironment(parsedArgs), [contractInfo]);
|
|
151
140
|
|
|
152
141
|
const contractInfoForDisplay = await prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);
|
|
153
142
|
return sendJsonRes([contractInfoForDisplay]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-taquito",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.11-rc",
|
|
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": "
|
|
45
|
+
"parcel": "2.6.1",
|
|
46
46
|
"typescript": "^4.7.2"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@taqueria/node-sdk": "^0.25.
|
|
49
|
+
"@taqueria/node-sdk": "^0.25.11-rc",
|
|
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,7 +3,6 @@ import {
|
|
|
3
3
|
getCurrentEnvironment,
|
|
4
4
|
getCurrentEnvironmentConfig,
|
|
5
5
|
getParameter,
|
|
6
|
-
RequestArgs,
|
|
7
6
|
sendAsyncErr,
|
|
8
7
|
sendJsonRes,
|
|
9
8
|
} from '@taqueria/node-sdk';
|
|
@@ -41,11 +40,10 @@ const isContractAddress = (contract: string): boolean =>
|
|
|
41
40
|
|
|
42
41
|
const getContractInfo = async (parsedArgs: Opts, env: Environment.t): Promise<ContractInfo> => {
|
|
43
42
|
const contract = parsedArgs.contract;
|
|
44
|
-
const protocolArgs = RequestArgs.create(parsedArgs);
|
|
45
43
|
return {
|
|
46
44
|
contractAlias: isContractAddress(contract) ? 'N/A' : contract,
|
|
47
45
|
contractAddress: isContractAddress(contract) ? contract : await getAddressOfAlias(env, contract),
|
|
48
|
-
parameter: parsedArgs.param ? await getParameter(
|
|
46
|
+
parameter: parsedArgs.param ? await getParameter(parsedArgs, parsedArgs.param) : 'Unit',
|
|
49
47
|
entrypoint: parsedArgs.entrypoint ?? 'default',
|
|
50
48
|
mutezTransfer: parseInt(parsedArgs.mutez ?? '0'),
|
|
51
49
|
};
|
|
@@ -89,19 +87,18 @@ const prepContractInfoForDisplay = (tezos: TezosToolkit, contractInfo: ContractI
|
|
|
89
87
|
};
|
|
90
88
|
};
|
|
91
89
|
|
|
92
|
-
const transfer = async (
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
if (!env) return sendAsyncErr(`There is no environment called ${protocolArgs.env} in your config.json`);
|
|
90
|
+
const transfer = async (parsedArgs: Opts): Promise<void> => {
|
|
91
|
+
const env = getCurrentEnvironmentConfig(parsedArgs);
|
|
92
|
+
if (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
96
93
|
try {
|
|
97
|
-
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(
|
|
94
|
+
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);
|
|
98
95
|
const tezos = await (envType === 'Network'
|
|
99
|
-
? configureToolKitForNetwork(
|
|
100
|
-
: configureToolKitForSandbox(nodeConfig,
|
|
96
|
+
? configureToolKitForNetwork(parsedArgs, nodeConfig, parsedArgs.sender)
|
|
97
|
+
: configureToolKitForSandbox(nodeConfig, parsedArgs.sender));
|
|
101
98
|
|
|
102
|
-
const contractInfo = await getContractInfo(
|
|
99
|
+
const contractInfo = await getContractInfo(parsedArgs, env);
|
|
103
100
|
|
|
104
|
-
await performTransferOps(tezos, getCurrentEnvironment(
|
|
101
|
+
await performTransferOps(tezos, getCurrentEnvironment(parsedArgs), [contractInfo]);
|
|
105
102
|
|
|
106
103
|
const contractInfoForDisplay = prepContractInfoForDisplay(tezos, contractInfo);
|
|
107
104
|
return sendJsonRes([contractInfoForDisplay]);
|
package/tsconfig.json
CHANGED
|
@@ -12,9 +12,7 @@
|
|
|
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
|
-
"lib": [
|
|
16
|
-
"ES2021.String"
|
|
17
|
-
], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
18
16
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
19
17
|
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
20
18
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|