@taqueria/plugin-taquito 0.28.2 → 0.28.4

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 CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  getSandboxConfig,
6
6
  RequestArgs,
7
7
  sendAsyncErr,
8
+ sendErr,
8
9
  TAQ_OPERATOR_ACCOUNT,
9
10
  } from '@taqueria/node-sdk';
10
11
  import {
@@ -24,6 +25,7 @@ export type OriginateOpts = ProxyTaskArgs.t & {
24
25
  alias?: string;
25
26
  sender?: string;
26
27
  mutez?: string;
28
+ timeout: number;
27
29
  };
28
30
 
29
31
  export type TransferOpts = ProxyTaskArgs.t & {
@@ -32,11 +34,14 @@ export type TransferOpts = ProxyTaskArgs.t & {
32
34
  param?: string;
33
35
  entrypoint?: string;
34
36
  sender?: string;
37
+ timeout: number;
35
38
  };
36
39
 
37
- export type InstantiateAccountOpts = ProxyTaskArgs.t;
40
+ export type FundOpts = ProxyTaskArgs.t & {
41
+ timeout: number;
42
+ };
38
43
 
39
- export type FundOpts = ProxyTaskArgs.t;
44
+ export type InstantiateAccountOpts = ProxyTaskArgs.t;
40
45
 
41
46
  // To be used for the main entrypoint of the plugin
42
47
  export type IntersectionOpts = OriginateOpts & TransferOpts & InstantiateAccountOpts & FundOpts;
@@ -196,5 +201,35 @@ export const handleOpsError = (err: unknown, env: string): Promise<never> => {
196
201
  }
197
202
  }
198
203
  }
204
+
199
205
  return sendAsyncErr(`Error while performing operation:\n${err} ${JSON.stringify(err, null, 2)}`);
200
206
  };
207
+
208
+ export const doWithin = async <T>(seconds: number, fn: () => Promise<T>) => {
209
+ let captured: Error = new Error(
210
+ 'Operation timed out. Please try again and perhaps increase the timeout using the --timeout option.',
211
+ );
212
+ let timeout: ReturnType<typeof setTimeout>;
213
+
214
+ const maxTimeout = new Promise((resolve, reject) => {
215
+ timeout = setTimeout(() => {
216
+ reject(captured);
217
+ }, seconds * 1000);
218
+ }) as Promise<T>;
219
+
220
+ const process = async () => {
221
+ while (true) {
222
+ try {
223
+ const retval: T = await fn();
224
+ return retval;
225
+ } catch (err) {
226
+ captured = err as Error;
227
+ }
228
+ }
229
+ };
230
+
231
+ return Promise.race<T>([process(), maxTimeout]).then(retval => {
232
+ clearTimeout(timeout);
233
+ return retval;
234
+ });
235
+ };
package/fund.ts CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  import { TezosToolkit } from '@taquito/taquito';
10
10
  import {
11
11
  configureToolKitForNetwork,
12
+ FundOpts,
12
13
  FundOpts as Opts,
13
14
  getDeclaredAccounts,
14
15
  getEnvTypeAndNodeConfig,
@@ -64,7 +65,7 @@ const prepAccountsInfoForDisplay = (accountsInfo: ContractInfo[]): TableRow[] =>
64
65
  };
65
66
  });
66
67
 
67
- const fund = async (parsedArgs: RequestArgs.t): Promise<void> => {
68
+ const fund = async (parsedArgs: FundOpts): Promise<void> => {
68
69
  const env = getCurrentEnvironmentConfig(parsedArgs);
69
70
  if (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json`);
70
71
  try {
@@ -81,7 +82,7 @@ const fund = async (parsedArgs: RequestArgs.t): Promise<void> => {
81
82
  );
82
83
  }
83
84
 
84
- await performTransferOps(tezos, getCurrentEnvironment(parsedArgs), accountsInfo);
85
+ await performTransferOps(tezos, getCurrentEnvironment(parsedArgs), accountsInfo, parsedArgs.timeout);
85
86
 
86
87
  const accountsInfoForDisplay = prepAccountsInfoForDisplay(accountsInfo);
87
88
  return sendJsonRes(accountsInfoForDisplay);
package/index.js CHANGED
@@ -145,6 +145,31 @@ To fund this account:
145
145
  return (0, import_node_sdk.sendAsyncErr)(`Error while performing operation:
146
146
  ${err} ${JSON.stringify(err, null, 2)}`);
147
147
  };
148
+ var doWithin = async (seconds, fn) => {
149
+ let captured = new Error(
150
+ "Operation timed out. Please try again and perhaps increase the timeout using the --timeout option."
151
+ );
152
+ let timeout;
153
+ const maxTimeout = new Promise((resolve, reject) => {
154
+ timeout = setTimeout(() => {
155
+ reject(captured);
156
+ }, seconds * 1e3);
157
+ });
158
+ const process2 = async () => {
159
+ while (true) {
160
+ try {
161
+ const retval = await fn();
162
+ return retval;
163
+ } catch (err) {
164
+ captured = err;
165
+ }
166
+ }
167
+ };
168
+ return Promise.race([process2(), maxTimeout]).then((retval) => {
169
+ clearTimeout(timeout);
170
+ return retval;
171
+ });
172
+ };
148
173
 
149
174
  // transfer.ts
150
175
  var import_node_sdk2 = require("@taqueria/node-sdk");
@@ -170,12 +195,14 @@ var createBatchForTransfer = (tezos, contractsInfo) => contractsInfo.reduce((acc
170
195
  },
171
196
  mutez: true
172
197
  }), tezos.wallet.batch());
173
- var performTransferOps = async (tezos, env, contractsInfo) => {
198
+ var performTransferOps = async (tezos, env, contractsInfo, maxTimeout) => {
174
199
  const batch = createBatchForTransfer(tezos, contractsInfo);
175
200
  try {
176
- const op = await batch.send();
177
- await op.confirmation();
178
- return op;
201
+ return await doWithin(maxTimeout, async () => {
202
+ const op = await batch.send();
203
+ await op.confirmation();
204
+ return op;
205
+ });
179
206
  } catch (err) {
180
207
  return handleOpsError(err, env);
181
208
  }
@@ -199,7 +226,7 @@ var transfer = async (opts) => {
199
226
  const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
200
227
  const tezos = await (envType === "Network" ? configureToolKitForNetwork(protocolArgs, nodeConfig, opts.sender) : configureToolKitForSandbox(nodeConfig, opts.sender));
201
228
  const contractInfo = await getContractInfo(opts, env);
202
- await performTransferOps(tezos, (0, import_node_sdk2.getCurrentEnvironment)(protocolArgs), [contractInfo]);
229
+ await performTransferOps(tezos, (0, import_node_sdk2.getCurrentEnvironment)(protocolArgs), [contractInfo], opts.timeout);
203
230
  const contractInfoForDisplay = prepContractInfoForDisplay(tezos, contractInfo);
204
231
  return (0, import_node_sdk2.sendJsonRes)([contractInfoForDisplay]);
205
232
  } catch {
@@ -254,7 +281,7 @@ var fund = async (parsedArgs) => {
254
281
  `All instantiated accounts in the current environment, "${parsedArgs.env}", are funded up to or beyond the declared amount`
255
282
  );
256
283
  }
257
- await performTransferOps(tezos, (0, import_node_sdk3.getCurrentEnvironment)(parsedArgs), accountsInfo);
284
+ await performTransferOps(tezos, (0, import_node_sdk3.getCurrentEnvironment)(parsedArgs), accountsInfo, parsedArgs.timeout);
258
285
  const accountsInfoForDisplay = prepAccountsInfoForDisplay(accountsInfo);
259
286
  return (0, import_node_sdk3.sendJsonRes)(accountsInfoForDisplay);
260
287
  } catch {
@@ -348,12 +375,14 @@ var createBatchForOriginate = (tezos, contractsInfo) => contractsInfo.reduce((ac
348
375
  balance: contractInfo.mutezTransfer.toString(),
349
376
  mutez: true
350
377
  }), tezos.wallet.batch());
351
- var performOriginateOps = async (tezos, env, contractsInfo) => {
378
+ var performOriginateOps = async (tezos, env, contractsInfo, maxTimeout) => {
352
379
  const batch = createBatchForOriginate(tezos, contractsInfo);
353
380
  try {
354
- const op = await batch.send();
355
- await op.confirmation();
356
- return op;
381
+ return await doWithin(maxTimeout, async () => {
382
+ const op = await batch.send();
383
+ await op.confirmation();
384
+ return op;
385
+ });
357
386
  } catch (err) {
358
387
  return handleOpsError(err, env);
359
388
  }
@@ -388,7 +417,12 @@ var originate = async (parsedArgs) => {
388
417
  const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
389
418
  const tezos = await (envType === "Network" ? configureToolKitForNetwork(protocolArgs, nodeConfig, parsedArgs.sender) : configureToolKitForSandbox(nodeConfig, parsedArgs.sender));
390
419
  const contractInfo = await getContractInfo2(parsedArgs);
391
- const op = await performOriginateOps(tezos, (0, import_node_sdk5.getCurrentEnvironment)(protocolArgs), [contractInfo]);
420
+ const op = await performOriginateOps(
421
+ tezos,
422
+ (0, import_node_sdk5.getCurrentEnvironment)(protocolArgs),
423
+ [contractInfo],
424
+ parsedArgs.timeout
425
+ );
392
426
  const contractInfoForDisplay = await prepContractInfoForDisplay2(parsedArgs, tezos, contractInfo, op);
393
427
  return (0, import_node_sdk5.sendJsonRes)([contractInfoForDisplay]);
394
428
  } catch {
@@ -408,7 +442,7 @@ var main = (parsedArgs) => {
408
442
  case "instantiate-account":
409
443
  return instantiate_account_default(parsedArgs);
410
444
  case "fund":
411
- return fund_default(parsedArgs);
445
+ return fund_default(unsafeArgs);
412
446
  default:
413
447
  return (0, import_node_sdk6.sendAsyncErr)(`${unsafeArgs} is not an understood task by the Taquito plugin`);
414
448
  }
@@ -445,6 +479,13 @@ import_node_sdk7.Plugin.create((_i18n) => ({
445
479
  flag: "mutez",
446
480
  description: "Amount of Mutez to transfer",
447
481
  required: false
482
+ }),
483
+ import_node_sdk7.Option.create({
484
+ flag: "timeout",
485
+ shortFlag: "t",
486
+ defaultValue: 40,
487
+ description: "Number of retry attempts (to avoid congestion and network failures)",
488
+ required: false
448
489
  })
449
490
  ],
450
491
  aliases: ["originate"],
@@ -475,6 +516,13 @@ import_node_sdk7.Plugin.create((_i18n) => ({
475
516
  flag: "sender",
476
517
  description: "Name of an instantiated account to use as the sender of the transfer operation",
477
518
  required: false
519
+ }),
520
+ import_node_sdk7.Option.create({
521
+ flag: "timeout",
522
+ shortFlag: "t",
523
+ defaultValue: 40,
524
+ description: "Number of retry attempts (to avoid congestion and network failures)",
525
+ required: false
478
526
  })
479
527
  ],
480
528
  aliases: ["call"],
@@ -486,7 +534,16 @@ import_node_sdk7.Plugin.create((_i18n) => ({
486
534
  command: "fund",
487
535
  description: "Fund all the instantiated accounts up to the desired/declared amount in a target environment",
488
536
  handler: "proxy",
489
- encoding: "application/json"
537
+ encoding: "application/json",
538
+ options: [
539
+ import_node_sdk7.Option.create({
540
+ flag: "timeout",
541
+ shortFlag: "t",
542
+ defaultValue: 40,
543
+ description: "Number of retry attempts (to avoid congestion and network failures)",
544
+ required: false
545
+ })
546
+ ]
490
547
  }),
491
548
  import_node_sdk7.Task.create({
492
549
  task: "instantiate-account",
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts","main.ts","fund.ts","common.ts","transfer.ts","instantiate_account.ts","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"],"mappings":";;;AAAA,IAAAA,mBAAqC;;;ACArC,IAAAC,mBAA0C;;;ACA1C,IAAAC,mBAOO;;;ACPP,sBAQO;AASP,oBAA0C;AAC1C,qBAA6B;AA4BtB,IAAM,0BAA0B,CACtC,YACA,QAC0E;AAjD3E;AAkDC,QAAM,yBAAyB;AAC/B,QAAI,SAAI,aAAJ,mBAAc,YAAW,OAAK,SAAI,cAAJ,mBAAe,YAAW;AAAG,eAAO,8BAAa,sBAAsB;AACzG,QAAI,SAAI,aAAJ,mBAAc,YAAW,GAAG;AAC/B,UAAM,cAAc,IAAI,SAAS;AACjC,UAAM,cAAU,kCAAiB,UAAU,EAAE,WAAW;AACxD,QAAI,CAAC,SAAS;AACb,iBAAO;AAAA,QACN,kEAAkE;AAAA,MACnE;AAAA,IACD;AACA,WAAO,QAAQ,QAAQ,CAAC,WAAW,OAAO,CAAC;AAAA,EAC5C;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ACD,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aACC;AAAA,MACD,SAAS;AAAA,QACR,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aACC;AAAA,UACD,UAAU;AAAA,QACX,CAAC;AAAA,QACD,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aACC;AAAA,UACD,UAAU;AAAA,QACX,CAAC;AAAA,QACD,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,MACF;AAAA,MACA,SAAS,CAAC,MAAM;AAAA,MAChB,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aACC;AAAA,MACD,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AACR,IAAI,QAAQ,IAAI;","names":["import_node_sdk","import_node_sdk","import_node_sdk","import_node_sdk","import_node_sdk","import_node_sdk","getContractInfo","prepContractInfoForDisplay","result"]}
1
+ {"version":3,"sources":["index.ts","main.ts","fund.ts","common.ts","transfer.ts","instantiate_account.ts","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\tOption.create({\n\t\t\t\t\tflag: 'timeout',\n\t\t\t\t\tshortFlag: 't',\n\t\t\t\t\tdefaultValue: 40,\n\t\t\t\t\tdescription: 'Number of retry attempts (to avoid congestion and network failures)',\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\tOption.create({\n\t\t\t\t\tflag: 'timeout',\n\t\t\t\t\tshortFlag: 't',\n\t\t\t\t\tdefaultValue: 40,\n\t\t\t\t\tdescription: 'Number of retry attempts (to avoid congestion and network failures)',\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\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'timeout',\n\t\t\t\t\tshortFlag: 't',\n\t\t\t\t\tdefaultValue: 40,\n\t\t\t\t\tdescription: 'Number of retry attempts (to avoid congestion and network failures)',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t],\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(unsafeArgs);\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,\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: FundOpts): 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, parsedArgs.timeout);\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\tsendErr,\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\ttimeout: number;\n};\n\nexport type TransferOpts = ProxyTaskArgs.t & {\n\tcontract: string;\n\tmutez?: string;\n\tparam?: string;\n\tentrypoint?: string;\n\tsender?: string;\n\ttimeout: number;\n};\n\nexport type FundOpts = ProxyTaskArgs.t & {\n\ttimeout: number;\n};\n\nexport type InstantiateAccountOpts = 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\n\treturn sendAsyncErr(`Error while performing operation:\\n${err} ${JSON.stringify(err, null, 2)}`);\n};\n\nexport const doWithin = async <T>(seconds: number, fn: () => Promise<T>) => {\n\tlet captured: Error = new Error(\n\t\t'Operation timed out. Please try again and perhaps increase the timeout using the --timeout option.',\n\t);\n\tlet timeout: ReturnType<typeof setTimeout>;\n\n\tconst maxTimeout = new Promise((resolve, reject) => {\n\t\ttimeout = setTimeout(() => {\n\t\t\treject(captured);\n\t\t}, seconds * 1000);\n\t}) as Promise<T>;\n\n\tconst process = async () => {\n\t\twhile (true) {\n\t\t\ttry {\n\t\t\t\tconst retval: T = await fn();\n\t\t\t\treturn retval;\n\t\t\t} catch (err) {\n\t\t\t\tcaptured = err as Error;\n\t\t\t}\n\t\t}\n\t};\n\n\treturn Promise.race<T>([process(), maxTimeout]).then(retval => {\n\t\tclearTimeout(timeout);\n\t\treturn retval;\n\t});\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\tdoWithin,\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\tmaxTimeout: number,\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForTransfer(tezos, contractsInfo);\n\ttry {\n\t\treturn await doWithin<BatchWalletOperation>(maxTimeout, async () => {\n\t\t\tconst op = await batch.send();\n\t\t\tawait op.confirmation();\n\t\t\treturn op;\n\t\t});\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], opts.timeout);\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 { basename, extname, join } from 'path';\nimport {\n\tconfigureToolKitForNetwork,\n\tconfigureToolKitForSandbox,\n\tdoWithin,\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\tmaxTimeout: number,\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForOriginate(tezos, contractsInfo);\n\ttry {\n\t\treturn await doWithin<BatchWalletOperation>(maxTimeout, async () => {\n\t\t\tconst op = await batch.send();\n\t\t\tawait op.confirmation();\n\t\t\treturn op;\n\t\t});\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(\n\t\t\ttezos,\n\t\t\tgetCurrentEnvironment(protocolArgs),\n\t\t\t[contractInfo],\n\t\t\tparsedArgs.timeout,\n\t\t);\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"],"mappings":";;;AAAA,IAAAA,mBAAqC;;;ACArC,IAAAC,mBAA0C;;;ACA1C,IAAAC,mBAOO;;;ACPP,sBASO;AASP,oBAA0C;AAC1C,qBAA6B;AAgCtB,IAAM,0BAA0B,CACtC,YACA,QAC0E;AAtD3E;AAuDC,QAAM,yBAAyB;AAC/B,QAAI,SAAI,aAAJ,mBAAc,YAAW,OAAK,SAAI,cAAJ,mBAAe,YAAW;AAAG,eAAO,8BAAa,sBAAsB;AACzG,QAAI,SAAI,aAAJ,mBAAc,YAAW,GAAG;AAC/B,UAAM,cAAc,IAAI,SAAS;AACjC,UAAM,cAAU,kCAAiB,UAAU,EAAE,WAAW;AACxD,QAAI,CAAC,SAAS;AACb,iBAAO;AAAA,QACN,kEAAkE;AAAA,MACnE;AAAA,IACD;AACA,WAAO,QAAQ,QAAQ,CAAC,WAAW,OAAO,CAAC;AAAA,EAC5C;AACA,QAAI,SAAI,cAAJ,mBAAe,YAAW,GAAG;AAChC,UAAM,cAAc,IAAI,UAAU;AAClC,UAAM,cAAU,kCAAiB,UAAU,EAAE,WAAW;AACxD,QAAI,C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AAAA,UACd,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,MACF;AAAA,MACA,SAAS,CAAC,MAAM;AAAA,MAChB,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,MACV,SAAS;AAAA,QACR,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,cAAc;AAAA,UACd,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,MACF;AAAA,IACD,CAAC;AAAA,IACD,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aACC;AAAA,MACD,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AACR,IAAI,QAAQ,IAAI;","names":["import_node_sdk","import_node_sdk","import_node_sdk","process","import_node_sdk","import_node_sdk","import_node_sdk","getContractInfo","prepContractInfoForDisplay","result"]}
package/index.mjs CHANGED
@@ -156,6 +156,31 @@ To fund this account:
156
156
  return sendAsyncErr(`Error while performing operation:
157
157
  ${err} ${JSON.stringify(err, null, 2)}`);
158
158
  };
159
+ var doWithin = async (seconds, fn) => {
160
+ let captured = new Error(
161
+ "Operation timed out. Please try again and perhaps increase the timeout using the --timeout option."
162
+ );
163
+ let timeout;
164
+ const maxTimeout = new Promise((resolve, reject) => {
165
+ timeout = setTimeout(() => {
166
+ reject(captured);
167
+ }, seconds * 1e3);
168
+ });
169
+ const process2 = async () => {
170
+ while (true) {
171
+ try {
172
+ const retval = await fn();
173
+ return retval;
174
+ } catch (err) {
175
+ captured = err;
176
+ }
177
+ }
178
+ };
179
+ return Promise.race([process2(), maxTimeout]).then((retval) => {
180
+ clearTimeout(timeout);
181
+ return retval;
182
+ });
183
+ };
159
184
 
160
185
  // transfer.ts
161
186
  import {
@@ -189,12 +214,14 @@ var createBatchForTransfer = (tezos, contractsInfo) => contractsInfo.reduce((acc
189
214
  },
190
215
  mutez: true
191
216
  }), tezos.wallet.batch());
192
- var performTransferOps = async (tezos, env, contractsInfo) => {
217
+ var performTransferOps = async (tezos, env, contractsInfo, maxTimeout) => {
193
218
  const batch = createBatchForTransfer(tezos, contractsInfo);
194
219
  try {
195
- const op = await batch.send();
196
- await op.confirmation();
197
- return op;
220
+ return await doWithin(maxTimeout, async () => {
221
+ const op = await batch.send();
222
+ await op.confirmation();
223
+ return op;
224
+ });
198
225
  } catch (err) {
199
226
  return handleOpsError(err, env);
200
227
  }
@@ -218,7 +245,7 @@ var transfer = async (opts) => {
218
245
  const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
219
246
  const tezos = await (envType === "Network" ? configureToolKitForNetwork(protocolArgs, nodeConfig, opts.sender) : configureToolKitForSandbox(nodeConfig, opts.sender));
220
247
  const contractInfo = await getContractInfo(opts, env);
221
- await performTransferOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo]);
248
+ await performTransferOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo], opts.timeout);
222
249
  const contractInfoForDisplay = prepContractInfoForDisplay(tezos, contractInfo);
223
250
  return sendJsonRes([contractInfoForDisplay]);
224
251
  } catch {
@@ -273,7 +300,7 @@ var fund = async (parsedArgs) => {
273
300
  `All instantiated accounts in the current environment, "${parsedArgs.env}", are funded up to or beyond the declared amount`
274
301
  );
275
302
  }
276
- await performTransferOps(tezos, getCurrentEnvironment2(parsedArgs), accountsInfo);
303
+ await performTransferOps(tezos, getCurrentEnvironment2(parsedArgs), accountsInfo, parsedArgs.timeout);
277
304
  const accountsInfoForDisplay = prepAccountsInfoForDisplay(accountsInfo);
278
305
  return sendJsonRes2(accountsInfoForDisplay);
279
306
  } catch {
@@ -378,12 +405,14 @@ var createBatchForOriginate = (tezos, contractsInfo) => contractsInfo.reduce((ac
378
405
  balance: contractInfo.mutezTransfer.toString(),
379
406
  mutez: true
380
407
  }), tezos.wallet.batch());
381
- var performOriginateOps = async (tezos, env, contractsInfo) => {
408
+ var performOriginateOps = async (tezos, env, contractsInfo, maxTimeout) => {
382
409
  const batch = createBatchForOriginate(tezos, contractsInfo);
383
410
  try {
384
- const op = await batch.send();
385
- await op.confirmation();
386
- return op;
411
+ return await doWithin(maxTimeout, async () => {
412
+ const op = await batch.send();
413
+ await op.confirmation();
414
+ return op;
415
+ });
387
416
  } catch (err) {
388
417
  return handleOpsError(err, env);
389
418
  }
@@ -418,7 +447,12 @@ var originate = async (parsedArgs) => {
418
447
  const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
419
448
  const tezos = await (envType === "Network" ? configureToolKitForNetwork(protocolArgs, nodeConfig, parsedArgs.sender) : configureToolKitForSandbox(nodeConfig, parsedArgs.sender));
420
449
  const contractInfo = await getContractInfo2(parsedArgs);
421
- const op = await performOriginateOps(tezos, getCurrentEnvironment3(protocolArgs), [contractInfo]);
450
+ const op = await performOriginateOps(
451
+ tezos,
452
+ getCurrentEnvironment3(protocolArgs),
453
+ [contractInfo],
454
+ parsedArgs.timeout
455
+ );
422
456
  const contractInfoForDisplay = await prepContractInfoForDisplay2(parsedArgs, tezos, contractInfo, op);
423
457
  return sendJsonRes4([contractInfoForDisplay]);
424
458
  } catch {
@@ -438,7 +472,7 @@ var main = (parsedArgs) => {
438
472
  case "instantiate-account":
439
473
  return instantiate_account_default(parsedArgs);
440
474
  case "fund":
441
- return fund_default(parsedArgs);
475
+ return fund_default(unsafeArgs);
442
476
  default:
443
477
  return sendAsyncErr6(`${unsafeArgs} is not an understood task by the Taquito plugin`);
444
478
  }
@@ -475,6 +509,13 @@ Plugin.create((_i18n) => ({
475
509
  flag: "mutez",
476
510
  description: "Amount of Mutez to transfer",
477
511
  required: false
512
+ }),
513
+ Option.create({
514
+ flag: "timeout",
515
+ shortFlag: "t",
516
+ defaultValue: 40,
517
+ description: "Number of retry attempts (to avoid congestion and network failures)",
518
+ required: false
478
519
  })
479
520
  ],
480
521
  aliases: ["originate"],
@@ -505,6 +546,13 @@ Plugin.create((_i18n) => ({
505
546
  flag: "sender",
506
547
  description: "Name of an instantiated account to use as the sender of the transfer operation",
507
548
  required: false
549
+ }),
550
+ Option.create({
551
+ flag: "timeout",
552
+ shortFlag: "t",
553
+ defaultValue: 40,
554
+ description: "Number of retry attempts (to avoid congestion and network failures)",
555
+ required: false
508
556
  })
509
557
  ],
510
558
  aliases: ["call"],
@@ -516,7 +564,16 @@ Plugin.create((_i18n) => ({
516
564
  command: "fund",
517
565
  description: "Fund all the instantiated accounts up to the desired/declared amount in a target environment",
518
566
  handler: "proxy",
519
- encoding: "application/json"
567
+ encoding: "application/json",
568
+ options: [
569
+ Option.create({
570
+ flag: "timeout",
571
+ shortFlag: "t",
572
+ defaultValue: 40,
573
+ description: "Number of retry attempts (to avoid congestion and network failures)",
574
+ required: false
575
+ })
576
+ ]
520
577
  }),
521
578
  Task.create({
522
579
  task: "instantiate-account",
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts","main.ts","fund.ts","common.ts","transfer.ts","instantiate_account.ts","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"],"mappings":";AAAA,SAAS,QAAQ,QAAQ,YAAY;;;ACArC,SAAsB,gBAAAA,qBAAoB;;;ACA1C;AAAA,EACC,yBAAAC;AAAA,EACA,+BAAAC;AAAA,EAEA,gBAAAC;AAAA,EACA,eAAAC;AAAA,EACA;AAAA,OACM;;;ACPP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACM;AASP,SAAS,WAAW,sBAAsB;AAC1C,SAAS,oBAAoB;AA4BtB,IAAM,0BAA0B,CACtC,YACA,QAC0E;AAjD3E;AAkDC,QAAM,yBAAyB;AAC/B,QAAI,SAAI,aAAJ,mBAAc,YAAW,OAAK,SAAI,cAAJ,mBAAe,YAAW;AAAG,WAAO,aAAa,sBAAsB;AACzG,QAAI,SAAI,aAAJ,mBAAc,YAAW,GAAG;AAC/B,UAAM,cAAc,IAAI,SAAS;AACjC,UAAM,UAAU,iBAAiB,UAAU,EAAE,WAAW;AACxD,QAAI,CAAC,SAAS;AACb,aAAO;AAAA,QACN,kEAAkE;AAAA,MACnE;AAAA,IACD;AACA,WAAO,QAAQ,QAAQ,CAAC,WAAW,OAAO,CAAC;AAAA,EAC5C;AACA,QAAI,SAAI,cAAJ,mBAAe,YAAW,GAAG;AAChC,UAAM,cAAc,IAAI,UAAU;AAClC,UAAM,UAAU,iBAAiB,UAAU,EAAE,WAAW;AACxD,QAAI,CAAC,SAAS;AACb,aAAO;AAAA,QACN,kEAAkE;AAAA,MACnE;AAAA,IACD;AACA,WAAO,QAAQ,QAAQ,CAAC,WAAW,OAAO,CAAC;AAAA,EAC5C;AACA,SAAO,aAAa,sBAAsB;AAC3C;AAEO,IAAM,6BAA6B,OAAO,SAA0B,WAA2C;AACrH,MA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AA,MACD,SAAS;AAAA,QACR,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aACC;AAAA,UACD,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aACC;AAAA,UACD,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,MACF;AAAA,MACA,SAAS,CAAC,MAAM;AAAA,MAChB,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aACC;AAAA,MACD,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AACR,IAAI,QAAQ,IAAI;","names":["sendAsyncErr","getCurrentEnvironment","getCurrentEnvironmentConfig","sendAsyncErr","sendJsonRes","RequestArgs","sendAsyncErr","RequestArgs","sendAsyncErr","sendAsyncErr","getCurrentEnvironmentConfig","sendJsonRes","getCurrentEnvironment","getCurrentEnvironmentConfig","sendAsyncErr","sendJsonRes","sendWarn","getCurrentEnvironmentConfig","sendAsyncErr","sendWarn","sendJsonRes","getCurrentEnvironment","getCurrentEnvironmentConfig","RequestArgs","sendAsyncErr","sendJsonRes","getContractInfo","RequestArgs","sendAsyncErr","prepContractInfoForDisplay","result","getCurrentEnvironmentConfig","getCurrentEnvironment","sendJsonRes","sendAsyncErr"]}
1
+ {"version":3,"sources":["index.ts","main.ts","fund.ts","common.ts","transfer.ts","instantiate_account.ts","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\tOption.create({\n\t\t\t\t\tflag: 'timeout',\n\t\t\t\t\tshortFlag: 't',\n\t\t\t\t\tdefaultValue: 40,\n\t\t\t\t\tdescription: 'Number of retry attempts (to avoid congestion and network failures)',\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\tOption.create({\n\t\t\t\t\tflag: 'timeout',\n\t\t\t\t\tshortFlag: 't',\n\t\t\t\t\tdefaultValue: 40,\n\t\t\t\t\tdescription: 'Number of retry attempts (to avoid congestion and network failures)',\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\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'timeout',\n\t\t\t\t\tshortFlag: 't',\n\t\t\t\t\tdefaultValue: 40,\n\t\t\t\t\tdescription: 'Number of retry attempts (to avoid congestion and network failures)',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t],\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(unsafeArgs);\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,\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: FundOpts): 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, parsedArgs.timeout);\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\tsendErr,\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\ttimeout: number;\n};\n\nexport type TransferOpts = ProxyTaskArgs.t & {\n\tcontract: string;\n\tmutez?: string;\n\tparam?: string;\n\tentrypoint?: string;\n\tsender?: string;\n\ttimeout: number;\n};\n\nexport type FundOpts = ProxyTaskArgs.t & {\n\ttimeout: number;\n};\n\nexport type InstantiateAccountOpts = 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\n\treturn sendAsyncErr(`Error while performing operation:\\n${err} ${JSON.stringify(err, null, 2)}`);\n};\n\nexport const doWithin = async <T>(seconds: number, fn: () => Promise<T>) => {\n\tlet captured: Error = new Error(\n\t\t'Operation timed out. Please try again and perhaps increase the timeout using the --timeout option.',\n\t);\n\tlet timeout: ReturnType<typeof setTimeout>;\n\n\tconst maxTimeout = new Promise((resolve, reject) => {\n\t\ttimeout = setTimeout(() => {\n\t\t\treject(captured);\n\t\t}, seconds * 1000);\n\t}) as Promise<T>;\n\n\tconst process = async () => {\n\t\twhile (true) {\n\t\t\ttry {\n\t\t\t\tconst retval: T = await fn();\n\t\t\t\treturn retval;\n\t\t\t} catch (err) {\n\t\t\t\tcaptured = err as Error;\n\t\t\t}\n\t\t}\n\t};\n\n\treturn Promise.race<T>([process(), maxTimeout]).then(retval => {\n\t\tclearTimeout(timeout);\n\t\treturn retval;\n\t});\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\tdoWithin,\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\tmaxTimeout: number,\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForTransfer(tezos, contractsInfo);\n\ttry {\n\t\treturn await doWithin<BatchWalletOperation>(maxTimeout, async () => {\n\t\t\tconst op = await batch.send();\n\t\t\tawait op.confirmation();\n\t\t\treturn op;\n\t\t});\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], opts.timeout);\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 { basename, extname, join } from 'path';\nimport {\n\tconfigureToolKitForNetwork,\n\tconfigureToolKitForSandbox,\n\tdoWithin,\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\tmaxTimeout: number,\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForOriginate(tezos, contractsInfo);\n\ttry {\n\t\treturn await doWithin<BatchWalletOperation>(maxTimeout, async () => {\n\t\t\tconst op = await batch.send();\n\t\t\tawait op.confirmation();\n\t\t\treturn op;\n\t\t});\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(\n\t\t\ttezos,\n\t\t\tgetCurrentEnvironment(protocolArgs),\n\t\t\t[contractInfo],\n\t\t\tparsedArgs.timeout,\n\t\t);\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"],"mappings":";AAAA,SAAS,QAAQ,QAAQ,YAAY;;;ACArC,SAAsB,gBAAAA,qBAAoB;;;ACA1C;AAAA,EACC,yBAAAC;AAAA,EACA,+BAAAC;AAAA,EAEA,gBAAAC;AAAA,EACA,eAAAC;AAAA,EACA;AAAA,OACM;;;ACPP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,OACM;AASP,SAAS,WAAW,sBAAsB;AAC1C,SAAS,oBAAoB;AAgCtB,IAAM,0BAA0B,CACtC,YACA,QAC0E;AAtD3E;AAuDC,QAAM,yBAAyB;AAC/B,QAAI,SAAI,aAAJ,mBAAc,YAAW,OAAK,SAAI,cAAJ,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C;AAAA,EACF;AAAA,EACA,OAAO;AACR,IAAI,QAAQ,IAAI;","names":["sendAsyncErr","getCurrentEnvironment","getCurrentEnvironmentConfig","sendAsyncErr","sendJsonRes","process","RequestArgs","sendAsyncErr","RequestArgs","sendAsyncErr","sendAsyncErr","getCurrentEnvironmentConfig","sendJsonRes","getCurrentEnvironment","getCurrentEnvironmentConfig","sendAsyncErr","sendJsonRes","sendWarn","getCurrentEnvironmentConfig","sendAsyncErr","sendWarn","sendJsonRes","getCurrentEnvironment","getCurrentEnvironmentConfig","RequestArgs","sendAsyncErr","sendJsonRes","getContractInfo","RequestArgs","sendAsyncErr","prepContractInfoForDisplay","result","getCurrentEnvironmentConfig","getCurrentEnvironment","sendJsonRes","sendAsyncErr"]}
package/index.ts CHANGED
@@ -32,6 +32,13 @@ Plugin.create(_i18n => ({
32
32
  description: 'Amount of Mutez to transfer',
33
33
  required: false,
34
34
  }),
35
+ Option.create({
36
+ flag: 'timeout',
37
+ shortFlag: 't',
38
+ defaultValue: 40,
39
+ description: 'Number of retry attempts (to avoid congestion and network failures)',
40
+ required: false,
41
+ }),
35
42
  ],
36
43
  aliases: ['originate'],
37
44
  handler: 'proxy',
@@ -65,6 +72,13 @@ Plugin.create(_i18n => ({
65
72
  description: 'Name of an instantiated account to use as the sender of the transfer operation',
66
73
  required: false,
67
74
  }),
75
+ Option.create({
76
+ flag: 'timeout',
77
+ shortFlag: 't',
78
+ defaultValue: 40,
79
+ description: 'Number of retry attempts (to avoid congestion and network failures)',
80
+ required: false,
81
+ }),
68
82
  ],
69
83
  aliases: ['call'],
70
84
  handler: 'proxy',
@@ -76,6 +90,15 @@ Plugin.create(_i18n => ({
76
90
  description: 'Fund all the instantiated accounts up to the desired/declared amount in a target environment',
77
91
  handler: 'proxy',
78
92
  encoding: 'application/json',
93
+ options: [
94
+ Option.create({
95
+ flag: 'timeout',
96
+ shortFlag: 't',
97
+ defaultValue: 40,
98
+ description: 'Number of retry attempts (to avoid congestion and network failures)',
99
+ required: false,
100
+ }),
101
+ ],
79
102
  }),
80
103
  Task.create({
81
104
  task: 'instantiate-account',
package/main.ts CHANGED
@@ -15,7 +15,7 @@ export const main = (parsedArgs: RequestArgs.t): Promise<void> => {
15
15
  case 'instantiate-account':
16
16
  return instantiate_account(parsedArgs);
17
17
  case 'fund':
18
- return fund(parsedArgs);
18
+ return fund(unsafeArgs);
19
19
  default:
20
20
  return sendAsyncErr(`${unsafeArgs} is not an understood task by the Taquito plugin`);
21
21
  }
package/originate.ts CHANGED
@@ -14,11 +14,11 @@ import {
14
14
  import { OperationContentsAndResultOrigination } from '@taquito/rpc';
15
15
  import { TezosToolkit, WalletOperationBatch } from '@taquito/taquito';
16
16
  import { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';
17
- import { readFile } from 'fs/promises';
18
17
  import { basename, extname, join } from 'path';
19
18
  import {
20
19
  configureToolKitForNetwork,
21
20
  configureToolKitForSandbox,
21
+ doWithin,
22
22
  getEnvTypeAndNodeConfig,
23
23
  handleOpsError,
24
24
  OriginateOpts as Opts,
@@ -91,12 +91,15 @@ export const performOriginateOps = async (
91
91
  tezos: TezosToolkit,
92
92
  env: string,
93
93
  contractsInfo: ContractInfo[],
94
+ maxTimeout: number,
94
95
  ): Promise<BatchWalletOperation> => {
95
96
  const batch = createBatchForOriginate(tezos, contractsInfo);
96
97
  try {
97
- const op = await batch.send();
98
- await op.confirmation();
99
- return op;
98
+ return await doWithin<BatchWalletOperation>(maxTimeout, async () => {
99
+ const op = await batch.send();
100
+ await op.confirmation();
101
+ return op;
102
+ });
100
103
  } catch (err) {
101
104
  return handleOpsError(err, env);
102
105
  }
@@ -147,7 +150,12 @@ const originate = async (parsedArgs: Opts): Promise<void> => {
147
150
 
148
151
  const contractInfo = await getContractInfo(parsedArgs);
149
152
 
150
- const op = await performOriginateOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo]);
153
+ const op = await performOriginateOps(
154
+ tezos,
155
+ getCurrentEnvironment(protocolArgs),
156
+ [contractInfo],
157
+ parsedArgs.timeout,
158
+ );
151
159
 
152
160
  const contractInfoForDisplay = await prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);
153
161
  return sendJsonRes([contractInfoForDisplay]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-taquito",
3
- "version": "0.28.2",
3
+ "version": "0.28.4",
4
4
  "description": "A taqueria plugin for originating smart contracts using Taquito",
5
5
  "targets": {
6
6
  "default": {
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "homepage": "https://github.com/ecadlabs/taqueria#readme",
44
44
  "dependencies": {
45
- "@taqueria/node-sdk": "^0.28.2",
45
+ "@taqueria/node-sdk": "^0.28.4",
46
46
  "@taquito/michel-codec": "^15.0.0",
47
47
  "@taquito/signer": "^15.0.0",
48
48
  "@taquito/taquito": "^15.0.0",
package/transfer.ts CHANGED
@@ -14,6 +14,7 @@ import { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-o
14
14
  import {
15
15
  configureToolKitForNetwork,
16
16
  configureToolKitForSandbox,
17
+ doWithin,
17
18
  getEnvTypeAndNodeConfig,
18
19
  handleOpsError,
19
20
  TransferOpts as Opts,
@@ -67,12 +68,15 @@ export const performTransferOps = async (
67
68
  tezos: TezosToolkit,
68
69
  env: string,
69
70
  contractsInfo: ContractInfo[],
71
+ maxTimeout: number,
70
72
  ): Promise<BatchWalletOperation> => {
71
73
  const batch = createBatchForTransfer(tezos, contractsInfo);
72
74
  try {
73
- const op = await batch.send();
74
- await op.confirmation();
75
- return op;
75
+ return await doWithin<BatchWalletOperation>(maxTimeout, async () => {
76
+ const op = await batch.send();
77
+ await op.confirmation();
78
+ return op;
79
+ });
76
80
  } catch (err) {
77
81
  return handleOpsError(err, env);
78
82
  }
@@ -101,7 +105,7 @@ const transfer = async (opts: Opts): Promise<void> => {
101
105
 
102
106
  const contractInfo = await getContractInfo(opts, env);
103
107
 
104
- await performTransferOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo]);
108
+ await performTransferOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo], opts.timeout);
105
109
 
106
110
  const contractInfoForDisplay = prepContractInfoForDisplay(tezos, contractInfo);
107
111
  return sendJsonRes([contractInfoForDisplay]);
package/tsconfig.json CHANGED
@@ -13,7 +13,8 @@
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"
16
+ "ES2021.String",
17
+ "ES2021.Promise"
17
18
  ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
18
19
  // "jsx": "preserve", /* Specify what JSX code is generated. */
19
20
  // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */