@taqueria/plugin-taquito 0.53.1 → 0.53.2

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
@@ -26,6 +26,9 @@ export type OriginateOpts = ProxyTaskArgs.t & {
26
26
  sender?: string;
27
27
  mutez?: string;
28
28
  timeout: number;
29
+ gasLimit?: number;
30
+ storageLimit?: number;
31
+ fee?: number;
29
32
  };
30
33
 
31
34
  export type TransferOpts = ProxyTaskArgs.t & {
@@ -35,6 +38,9 @@ export type TransferOpts = ProxyTaskArgs.t & {
35
38
  entrypoint?: string;
36
39
  sender?: string;
37
40
  timeout: number;
41
+ gasLimit?: number;
42
+ storageLimit?: number;
43
+ fee?: number;
38
44
  };
39
45
 
40
46
  export type FundOpts = ProxyTaskArgs.t & {
package/index.js CHANGED
@@ -186,7 +186,10 @@ var getContractInfo = async (parsedArgs, env) => {
186
186
  mutezTransfer: parseInt(parsedArgs.mutez ?? "0")
187
187
  };
188
188
  };
189
- var createBatchForTransfer = (tezos, contractsInfo) => contractsInfo.reduce((acc, contractInfo) => acc.withTransfer({
189
+ var createBatchForTransfer = (tezos, contractsInfo, gasLimit, storageLimit, fee) => contractsInfo.reduce((acc, contractInfo) => acc.withTransfer({
190
+ fee,
191
+ gasLimit,
192
+ storageLimit,
190
193
  to: contractInfo.contractAddress,
191
194
  amount: contractInfo.mutezTransfer,
192
195
  parameter: {
@@ -195,8 +198,8 @@ var createBatchForTransfer = (tezos, contractsInfo) => contractsInfo.reduce((acc
195
198
  },
196
199
  mutez: true
197
200
  }), tezos.wallet.batch());
198
- var performTransferOps = async (tezos, env, contractsInfo, maxTimeout) => {
199
- const batch = createBatchForTransfer(tezos, contractsInfo);
201
+ var performTransferOps = async (tezos, env, contractsInfo, maxTimeout, gasLimit, storageLimit, fee) => {
202
+ const batch = createBatchForTransfer(tezos, contractsInfo, gasLimit, storageLimit, fee);
200
203
  try {
201
204
  return await doWithin(maxTimeout, async () => {
202
205
  const op = await batch.send();
@@ -226,7 +229,15 @@ var transfer = async (opts) => {
226
229
  const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
227
230
  const tezos = await (envType === "Network" ? configureToolKitForNetwork(protocolArgs, nodeConfig, opts.sender) : configureToolKitForSandbox(nodeConfig, opts.sender));
228
231
  const contractInfo = await getContractInfo(opts, env);
229
- await performTransferOps(tezos, (0, import_node_sdk2.getCurrentEnvironment)(protocolArgs), [contractInfo], opts.timeout);
232
+ await performTransferOps(
233
+ tezos,
234
+ (0, import_node_sdk2.getCurrentEnvironment)(protocolArgs),
235
+ [contractInfo],
236
+ opts.timeout,
237
+ opts.gasLimit,
238
+ opts.storageLimit,
239
+ opts.fee
240
+ );
230
241
  const contractInfoForDisplay = prepContractInfoForDisplay(tezos, contractInfo);
231
242
  return (0, import_node_sdk2.sendJsonRes)([contractInfoForDisplay]);
232
243
  } catch {
@@ -369,7 +380,10 @@ You can also manually pass a storage file to the originate task using the --stor
369
380
  mutezTransfer: parseInt(parsedArgs.mutez ?? "0")
370
381
  };
371
382
  };
372
- var createBatchForOriginate = (tezos, contractsInfo) => contractsInfo.reduce((acc, contractInfo) => acc.withOrigination({
383
+ var createBatchForOriginate = (tezos, contractsInfo, gasLimit, storageLimit, fee) => contractsInfo.reduce((acc, contractInfo) => acc.withOrigination({
384
+ gasLimit,
385
+ storageLimit,
386
+ fee,
373
387
  code: contractInfo.code,
374
388
  init: contractInfo.initStorage,
375
389
  balance: contractInfo.mutezTransfer.toString(),
@@ -392,8 +406,8 @@ function withIntervalHack(fn) {
392
406
  }
393
407
  };
394
408
  }
395
- var performOriginateOps = withIntervalHack(async (tezos, env, contractsInfo, maxTimeout, isSandbox = false) => {
396
- const batch = createBatchForOriginate(tezos, contractsInfo);
409
+ var performOriginateOps = withIntervalHack(async (tezos, env, contractsInfo, maxTimeout, isSandbox = false, gasLimit, storageLimit, fee) => {
410
+ const batch = createBatchForOriginate(tezos, contractsInfo, gasLimit, storageLimit, fee);
397
411
  try {
398
412
  return await doWithin(maxTimeout, async () => {
399
413
  const op = await batch.send();
@@ -438,7 +452,10 @@ var originate = async (parsedArgs) => {
438
452
  (0, import_node_sdk5.getCurrentEnvironment)(protocolArgs),
439
453
  [contractInfo],
440
454
  parsedArgs.timeout,
441
- envType !== "Network"
455
+ envType !== "Network",
456
+ parsedArgs.gasLimit,
457
+ parsedArgs.storageLimit,
458
+ parsedArgs.fee
442
459
  );
443
460
  const contractInfoForDisplay = await prepContractInfoForDisplay2(parsedArgs, tezos, contractInfo, op);
444
461
  return (0, import_node_sdk5.sendJsonRes)([contractInfoForDisplay]);
@@ -517,7 +534,25 @@ import_node_sdk7.Plugin.create((_i18n) => ({
517
534
  flag: "timeout",
518
535
  shortFlag: "t",
519
536
  defaultValue: 40,
520
- description: "Number of retry attempts (to avoid congestion and network failures)",
537
+ description: "Number of seconds to elapse before abandoning the operation (to avoid congestion and network failures)",
538
+ required: false
539
+ }),
540
+ import_node_sdk7.Option.create({
541
+ flag: "gasLimit",
542
+ shortFlag: "g",
543
+ description: "Gas limit per contract/origination specified in mutez",
544
+ required: false
545
+ }),
546
+ import_node_sdk7.Option.create({
547
+ flag: "storageLimit",
548
+ shortFlag: "s",
549
+ description: "Storage limit per contract/origination specified in mutez",
550
+ required: false
551
+ }),
552
+ import_node_sdk7.Option.create({
553
+ flag: "fee",
554
+ shortFlag: "f",
555
+ description: "Fee per contract/origination specified in mutez",
521
556
  required: false
522
557
  })
523
558
  ],
@@ -556,6 +591,24 @@ import_node_sdk7.Plugin.create((_i18n) => ({
556
591
  defaultValue: 40,
557
592
  description: "Number of retry attempts (to avoid congestion and network failures)",
558
593
  required: false
594
+ }),
595
+ import_node_sdk7.Option.create({
596
+ flag: "gasLimit",
597
+ shortFlag: "g",
598
+ description: "Gas limit per contract/origination specified in mutez",
599
+ required: false
600
+ }),
601
+ import_node_sdk7.Option.create({
602
+ flag: "storageLimit",
603
+ shortFlag: "s",
604
+ description: "Storage limit per contract/origination specified in mutez",
605
+ required: false
606
+ }),
607
+ import_node_sdk7.Option.create({
608
+ flag: "fee",
609
+ shortFlag: "f",
610
+ description: "Fee per contract/origination specified in mutez",
611
+ required: false
559
612
  })
560
613
  ],
561
614
  aliases: ["call"],
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\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.trim(),\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\n// Provide a means to clear intervals that were created but not cleaned up in either\n// Taquito or RxJS. This is a hack to prevent the program from hanging after all promises have resolved.\nfunction withIntervalHack(fn: CallableFunction) {\n\treturn async function(...args: unknown[]) {\n\t\tconst originalSetInterval = setInterval;\n\t\tconst intervals: NodeJS.Timeout[] = [];\n\n\t\t// Override global setInterval\n\t\t// @ts-ignore\n\t\tglobal.setInterval = (callback, delay) => {\n\t\t\tconst id = originalSetInterval(callback, delay);\n\t\t\tintervals.push(id);\n\t\t\treturn id;\n\t\t};\n\n\t\ttry {\n\t\t\treturn await fn(...args);\n\t\t} finally {\n\t\t\t// Clear intervals and restore original setInterval\n\t\t\tintervals.forEach(id => clearInterval(id));\n\t\t\tglobal.setInterval = originalSetInterval;\n\t\t}\n\t};\n}\n\nconst performOriginateOps = withIntervalHack(async (\n\ttezos: TezosToolkit,\n\tenv: string,\n\tcontractsInfo: ContractInfo[],\n\tmaxTimeout: number,\n\tisSandbox = false,\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForOriginate(tezos, contractsInfo);\n\n\ttry {\n\t\treturn await doWithin<BatchWalletOperation>(maxTimeout, async () => {\n\t\t\tconst op = await batch.send();\n\t\t\tawait op.confirmation(isSandbox ? 1 : 3);\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 unknown 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\t// destination: 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\tenvType !== 'Network',\n\t\t);\n\n\t\tconst contractInfoForDisplay = await prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);\n\t\treturn sendJsonRes([contractInfoForDisplay]);\n\t} catch (e) {\n\t\tif (e instanceof Error && e.message.includes('503')) {\n\t\t\ttry {\n\t\t\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);\n\t\t\t\tif (envType === 'Network' && nodeConfig.rpcUrl.includes('ghostnet')) {\n\t\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t\t`❌ Ghostnet is returning 503 errors, indicating that the server is under heavy load.\\nPlease try again later.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t`❌ The node you are trying to connect to is not available\\nPlease check if the node is running and the URL is correct in your config.json`,\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\t// Resort to the default error message\n\t\t\t}\n\t\t}\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,CAAC;AAClC,UAAM,cAAU,kCAAiB,UAAU,EAAE,WAAW;AACxD,QAAI,CAAC,SAAS;AACb,iBAA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;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"]}
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:\n\t\t\t\t\t\t'Number of seconds to elapse before abandoning the operation (to avoid congestion and network failures)',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'gasLimit',\n\t\t\t\t\tshortFlag: 'g',\n\t\t\t\t\tdescription: 'Gas limit per contract/origination specified in mutez',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'storageLimit',\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tdescription: 'Storage limit per contract/origination specified in mutez',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'fee',\n\t\t\t\t\tshortFlag: 'f',\n\t\t\t\t\tdescription: 'Fee per contract/origination specified in mutez',\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\tOption.create({\n\t\t\t\t\tflag: 'gasLimit',\n\t\t\t\t\tshortFlag: 'g',\n\t\t\t\t\tdescription: 'Gas limit per contract/origination specified in mutez',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'storageLimit',\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tdescription: 'Storage limit per contract/origination specified in mutez',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'fee',\n\t\t\t\t\tshortFlag: 'f',\n\t\t\t\t\tdescription: 'Fee per contract/origination specified in mutez',\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\tgasLimit?: number;\n\tstorageLimit?: number;\n\tfee?: 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\tgasLimit?: number;\n\tstorageLimit?: number;\n\tfee?: 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 = (\n\ttezos: TezosToolkit,\n\tcontractsInfo: ContractInfo[],\n\tgasLimit?: number,\n\tstorageLimit?: number,\n\tfee?: number,\n): WalletOperationBatch =>\n\tcontractsInfo.reduce((acc, contractInfo) =>\n\t\tacc.withTransfer({\n\t\t\tfee,\n\t\t\tgasLimit,\n\t\t\tstorageLimit,\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\tgasLimit?: number,\n\tstorageLimit?: number,\n\tfee?: number,\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForTransfer(tezos, contractsInfo, gasLimit, storageLimit, fee);\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(\n\t\t\ttezos,\n\t\t\tgetCurrentEnvironment(protocolArgs),\n\t\t\t[contractInfo],\n\t\t\topts.timeout,\n\t\t\topts.gasLimit,\n\t\t\topts.storageLimit,\n\t\t\topts.fee,\n\t\t);\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.trim(),\n\t\tmutezTransfer: parseInt(parsedArgs.mutez ?? '0'),\n\t};\n};\n\nconst createBatchForOriginate = (\n\ttezos: TezosToolkit,\n\tcontractsInfo: ContractInfo[],\n\tgasLimit?: number,\n\tstorageLimit?: number,\n\tfee?: number,\n): WalletOperationBatch =>\n\tcontractsInfo.reduce((acc, contractInfo) =>\n\t\tacc.withOrigination({\n\t\t\tgasLimit,\n\t\t\tstorageLimit,\n\t\t\tfee,\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\n// Provide a means to clear intervals that were created but not cleaned up in either\n// Taquito or RxJS. This is a hack to prevent the program from hanging after all promises have resolved.\nfunction withIntervalHack(fn: CallableFunction) {\n\treturn async function(...args: unknown[]) {\n\t\tconst originalSetInterval = setInterval;\n\t\tconst intervals: NodeJS.Timeout[] = [];\n\n\t\t// Override global setInterval\n\t\t// @ts-ignore\n\t\tglobal.setInterval = (callback, delay) => {\n\t\t\tconst id = originalSetInterval(callback, delay);\n\t\t\tintervals.push(id);\n\t\t\treturn id;\n\t\t};\n\n\t\ttry {\n\t\t\treturn await fn(...args);\n\t\t} finally {\n\t\t\t// Clear intervals and restore original setInterval\n\t\t\tintervals.forEach(id => clearInterval(id));\n\t\t\tglobal.setInterval = originalSetInterval;\n\t\t}\n\t};\n}\n\nconst performOriginateOps = withIntervalHack(async (\n\ttezos: TezosToolkit,\n\tenv: string,\n\tcontractsInfo: ContractInfo[],\n\tmaxTimeout: number,\n\tisSandbox = false,\n\tgasLimit?: number,\n\tstorageLimit?: number,\n\tfee?: number,\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForOriginate(tezos, contractsInfo, gasLimit, storageLimit, fee);\n\n\ttry {\n\t\treturn await doWithin<BatchWalletOperation>(maxTimeout, async () => {\n\t\t\tconst op = await batch.send();\n\t\t\tawait op.confirmation(isSandbox ? 1 : 3);\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 unknown 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\t// destination: 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\tenvType !== 'Network',\n\t\t\tparsedArgs.gasLimit,\n\t\t\tparsedArgs.storageLimit,\n\t\t\tparsedArgs.fee,\n\t\t);\n\n\t\tconst contractInfoForDisplay = await prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);\n\t\treturn sendJsonRes([contractInfoForDisplay]);\n\t} catch (e) {\n\t\tif (e instanceof Error && e.message.includes('503')) {\n\t\t\ttry {\n\t\t\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);\n\t\t\t\tif (envType === 'Network' && nodeConfig.rpcUrl.includes('ghostnet')) {\n\t\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t\t`❌ Ghostnet is returning 503 errors, indicating that the server is under heavy load.\\nPlease try again later.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t`❌ The node you are trying to connect to is not available\\nPlease check if the node is running and the URL is correct in your config.json`,\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\t// Resort to the default error message\n\t\t\t}\n\t\t}\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;AAsCtB,IAAM,0BAA0B,CACtC,YACA,QAC0E;AA5D3E;AA6DC,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,CAAC;AAClC,UAAM,cAAU,kCAAiB,UAAU,EAAE,WAAW;AACxD,QAAI,CAAC,SAAS;AACb,iBAAO;AAAA,QACN,kEAAkE,WAAW;AAAA,MAC9E;AAAA,IACD;AACA,WAAO,QAAQ,QAAQ,CAAC,WAAW,OAAO,CAAC;AAAA,EAC5C;AACA,QAAI,SAAI,cAAJ,mBAAe,YAAW,GAAG;AAChC,UAAM,cAAc,IAAI,UAAU,CAAC;AACnC,UAAM,cAAU,kCAAiB,UAAU,EAAE,WAAW;AACxD,QAAI,CAAC,SAAS;AACb,iBAAO;AAAA,QACN,kEAAkE,WAAW;AAAA,MAC9E;AAAA,IACD;AACA,WAAO,QAAQ,QAAQ,CAAC,WAAW,OAAO,CAAC;AAAA,EAC5C;AACA,aAAO,8BAAa,sBAAsB;AAC3C;AAEO,IAAM,6BAA6B,OAAO,SAA0B,WAA2C;AAC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AAA,UACN,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,cAAc;AAAA,UACd,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,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
@@ -205,7 +205,10 @@ var getContractInfo = async (parsedArgs, env) => {
205
205
  mutezTransfer: parseInt(parsedArgs.mutez ?? "0")
206
206
  };
207
207
  };
208
- var createBatchForTransfer = (tezos, contractsInfo) => contractsInfo.reduce((acc, contractInfo) => acc.withTransfer({
208
+ var createBatchForTransfer = (tezos, contractsInfo, gasLimit, storageLimit, fee) => contractsInfo.reduce((acc, contractInfo) => acc.withTransfer({
209
+ fee,
210
+ gasLimit,
211
+ storageLimit,
209
212
  to: contractInfo.contractAddress,
210
213
  amount: contractInfo.mutezTransfer,
211
214
  parameter: {
@@ -214,8 +217,8 @@ var createBatchForTransfer = (tezos, contractsInfo) => contractsInfo.reduce((acc
214
217
  },
215
218
  mutez: true
216
219
  }), tezos.wallet.batch());
217
- var performTransferOps = async (tezos, env, contractsInfo, maxTimeout) => {
218
- const batch = createBatchForTransfer(tezos, contractsInfo);
220
+ var performTransferOps = async (tezos, env, contractsInfo, maxTimeout, gasLimit, storageLimit, fee) => {
221
+ const batch = createBatchForTransfer(tezos, contractsInfo, gasLimit, storageLimit, fee);
219
222
  try {
220
223
  return await doWithin(maxTimeout, async () => {
221
224
  const op = await batch.send();
@@ -245,7 +248,15 @@ var transfer = async (opts) => {
245
248
  const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
246
249
  const tezos = await (envType === "Network" ? configureToolKitForNetwork(protocolArgs, nodeConfig, opts.sender) : configureToolKitForSandbox(nodeConfig, opts.sender));
247
250
  const contractInfo = await getContractInfo(opts, env);
248
- await performTransferOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo], opts.timeout);
251
+ await performTransferOps(
252
+ tezos,
253
+ getCurrentEnvironment(protocolArgs),
254
+ [contractInfo],
255
+ opts.timeout,
256
+ opts.gasLimit,
257
+ opts.storageLimit,
258
+ opts.fee
259
+ );
249
260
  const contractInfoForDisplay = prepContractInfoForDisplay(tezos, contractInfo);
250
261
  return sendJsonRes([contractInfoForDisplay]);
251
262
  } catch {
@@ -399,7 +410,10 @@ You can also manually pass a storage file to the originate task using the --stor
399
410
  mutezTransfer: parseInt(parsedArgs.mutez ?? "0")
400
411
  };
401
412
  };
402
- var createBatchForOriginate = (tezos, contractsInfo) => contractsInfo.reduce((acc, contractInfo) => acc.withOrigination({
413
+ var createBatchForOriginate = (tezos, contractsInfo, gasLimit, storageLimit, fee) => contractsInfo.reduce((acc, contractInfo) => acc.withOrigination({
414
+ gasLimit,
415
+ storageLimit,
416
+ fee,
403
417
  code: contractInfo.code,
404
418
  init: contractInfo.initStorage,
405
419
  balance: contractInfo.mutezTransfer.toString(),
@@ -422,8 +436,8 @@ function withIntervalHack(fn) {
422
436
  }
423
437
  };
424
438
  }
425
- var performOriginateOps = withIntervalHack(async (tezos, env, contractsInfo, maxTimeout, isSandbox = false) => {
426
- const batch = createBatchForOriginate(tezos, contractsInfo);
439
+ var performOriginateOps = withIntervalHack(async (tezos, env, contractsInfo, maxTimeout, isSandbox = false, gasLimit, storageLimit, fee) => {
440
+ const batch = createBatchForOriginate(tezos, contractsInfo, gasLimit, storageLimit, fee);
427
441
  try {
428
442
  return await doWithin(maxTimeout, async () => {
429
443
  const op = await batch.send();
@@ -468,7 +482,10 @@ var originate = async (parsedArgs) => {
468
482
  getCurrentEnvironment3(protocolArgs),
469
483
  [contractInfo],
470
484
  parsedArgs.timeout,
471
- envType !== "Network"
485
+ envType !== "Network",
486
+ parsedArgs.gasLimit,
487
+ parsedArgs.storageLimit,
488
+ parsedArgs.fee
472
489
  );
473
490
  const contractInfoForDisplay = await prepContractInfoForDisplay2(parsedArgs, tezos, contractInfo, op);
474
491
  return sendJsonRes4([contractInfoForDisplay]);
@@ -547,7 +564,25 @@ Plugin.create((_i18n) => ({
547
564
  flag: "timeout",
548
565
  shortFlag: "t",
549
566
  defaultValue: 40,
550
- description: "Number of retry attempts (to avoid congestion and network failures)",
567
+ description: "Number of seconds to elapse before abandoning the operation (to avoid congestion and network failures)",
568
+ required: false
569
+ }),
570
+ Option.create({
571
+ flag: "gasLimit",
572
+ shortFlag: "g",
573
+ description: "Gas limit per contract/origination specified in mutez",
574
+ required: false
575
+ }),
576
+ Option.create({
577
+ flag: "storageLimit",
578
+ shortFlag: "s",
579
+ description: "Storage limit per contract/origination specified in mutez",
580
+ required: false
581
+ }),
582
+ Option.create({
583
+ flag: "fee",
584
+ shortFlag: "f",
585
+ description: "Fee per contract/origination specified in mutez",
551
586
  required: false
552
587
  })
553
588
  ],
@@ -586,6 +621,24 @@ Plugin.create((_i18n) => ({
586
621
  defaultValue: 40,
587
622
  description: "Number of retry attempts (to avoid congestion and network failures)",
588
623
  required: false
624
+ }),
625
+ Option.create({
626
+ flag: "gasLimit",
627
+ shortFlag: "g",
628
+ description: "Gas limit per contract/origination specified in mutez",
629
+ required: false
630
+ }),
631
+ Option.create({
632
+ flag: "storageLimit",
633
+ shortFlag: "s",
634
+ description: "Storage limit per contract/origination specified in mutez",
635
+ required: false
636
+ }),
637
+ Option.create({
638
+ flag: "fee",
639
+ shortFlag: "f",
640
+ description: "Fee per contract/origination specified in mutez",
641
+ required: false
589
642
  })
590
643
  ],
591
644
  aliases: ["call"],
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\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.trim(),\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\n// Provide a means to clear intervals that were created but not cleaned up in either\n// Taquito or RxJS. This is a hack to prevent the program from hanging after all promises have resolved.\nfunction withIntervalHack(fn: CallableFunction) {\n\treturn async function(...args: unknown[]) {\n\t\tconst originalSetInterval = setInterval;\n\t\tconst intervals: NodeJS.Timeout[] = [];\n\n\t\t// Override global setInterval\n\t\t// @ts-ignore\n\t\tglobal.setInterval = (callback, delay) => {\n\t\t\tconst id = originalSetInterval(callback, delay);\n\t\t\tintervals.push(id);\n\t\t\treturn id;\n\t\t};\n\n\t\ttry {\n\t\t\treturn await fn(...args);\n\t\t} finally {\n\t\t\t// Clear intervals and restore original setInterval\n\t\t\tintervals.forEach(id => clearInterval(id));\n\t\t\tglobal.setInterval = originalSetInterval;\n\t\t}\n\t};\n}\n\nconst performOriginateOps = withIntervalHack(async (\n\ttezos: TezosToolkit,\n\tenv: string,\n\tcontractsInfo: ContractInfo[],\n\tmaxTimeout: number,\n\tisSandbox = false,\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForOriginate(tezos, contractsInfo);\n\n\ttry {\n\t\treturn await doWithin<BatchWalletOperation>(maxTimeout, async () => {\n\t\t\tconst op = await batch.send();\n\t\t\tawait op.confirmation(isSandbox ? 1 : 3);\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 unknown 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\t// destination: 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\tenvType !== 'Network',\n\t\t);\n\n\t\tconst contractInfoForDisplay = await prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);\n\t\treturn sendJsonRes([contractInfoForDisplay]);\n\t} catch (e) {\n\t\tif (e instanceof Error && e.message.includes('503')) {\n\t\t\ttry {\n\t\t\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);\n\t\t\t\tif (envType === 'Network' && nodeConfig.rpcUrl.includes('ghostnet')) {\n\t\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t\t`❌ Ghostnet is returning 503 errors, indicating that the server is under heavy load.\\nPlease try again later.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t`❌ The node you are trying to connect to is not available\\nPlease check if the node is running and the URL is correct in your config.json`,\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\t// Resort to the default error message\n\t\t\t}\n\t\t}\n\t\treturn sendAsyncErr('No operations performed');\n\t}\n};\n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A,UACX,cAAc;AAAA,UACd,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,MACF;AAAA,IACD,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","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"]}
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:\n\t\t\t\t\t\t'Number of seconds to elapse before abandoning the operation (to avoid congestion and network failures)',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'gasLimit',\n\t\t\t\t\tshortFlag: 'g',\n\t\t\t\t\tdescription: 'Gas limit per contract/origination specified in mutez',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'storageLimit',\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tdescription: 'Storage limit per contract/origination specified in mutez',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'fee',\n\t\t\t\t\tshortFlag: 'f',\n\t\t\t\t\tdescription: 'Fee per contract/origination specified in mutez',\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\tOption.create({\n\t\t\t\t\tflag: 'gasLimit',\n\t\t\t\t\tshortFlag: 'g',\n\t\t\t\t\tdescription: 'Gas limit per contract/origination specified in mutez',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'storageLimit',\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tdescription: 'Storage limit per contract/origination specified in mutez',\n\t\t\t\t\trequired: false,\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'fee',\n\t\t\t\t\tshortFlag: 'f',\n\t\t\t\t\tdescription: 'Fee per contract/origination specified in mutez',\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\tgasLimit?: number;\n\tstorageLimit?: number;\n\tfee?: 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\tgasLimit?: number;\n\tstorageLimit?: number;\n\tfee?: 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 = (\n\ttezos: TezosToolkit,\n\tcontractsInfo: ContractInfo[],\n\tgasLimit?: number,\n\tstorageLimit?: number,\n\tfee?: number,\n): WalletOperationBatch =>\n\tcontractsInfo.reduce((acc, contractInfo) =>\n\t\tacc.withTransfer({\n\t\t\tfee,\n\t\t\tgasLimit,\n\t\t\tstorageLimit,\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\tgasLimit?: number,\n\tstorageLimit?: number,\n\tfee?: number,\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForTransfer(tezos, contractsInfo, gasLimit, storageLimit, fee);\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(\n\t\t\ttezos,\n\t\t\tgetCurrentEnvironment(protocolArgs),\n\t\t\t[contractInfo],\n\t\t\topts.timeout,\n\t\t\topts.gasLimit,\n\t\t\topts.storageLimit,\n\t\t\topts.fee,\n\t\t);\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.trim(),\n\t\tmutezTransfer: parseInt(parsedArgs.mutez ?? '0'),\n\t};\n};\n\nconst createBatchForOriginate = (\n\ttezos: TezosToolkit,\n\tcontractsInfo: ContractInfo[],\n\tgasLimit?: number,\n\tstorageLimit?: number,\n\tfee?: number,\n): WalletOperationBatch =>\n\tcontractsInfo.reduce((acc, contractInfo) =>\n\t\tacc.withOrigination({\n\t\t\tgasLimit,\n\t\t\tstorageLimit,\n\t\t\tfee,\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\n// Provide a means to clear intervals that were created but not cleaned up in either\n// Taquito or RxJS. This is a hack to prevent the program from hanging after all promises have resolved.\nfunction withIntervalHack(fn: CallableFunction) {\n\treturn async function(...args: unknown[]) {\n\t\tconst originalSetInterval = setInterval;\n\t\tconst intervals: NodeJS.Timeout[] = [];\n\n\t\t// Override global setInterval\n\t\t// @ts-ignore\n\t\tglobal.setInterval = (callback, delay) => {\n\t\t\tconst id = originalSetInterval(callback, delay);\n\t\t\tintervals.push(id);\n\t\t\treturn id;\n\t\t};\n\n\t\ttry {\n\t\t\treturn await fn(...args);\n\t\t} finally {\n\t\t\t// Clear intervals and restore original setInterval\n\t\t\tintervals.forEach(id => clearInterval(id));\n\t\t\tglobal.setInterval = originalSetInterval;\n\t\t}\n\t};\n}\n\nconst performOriginateOps = withIntervalHack(async (\n\ttezos: TezosToolkit,\n\tenv: string,\n\tcontractsInfo: ContractInfo[],\n\tmaxTimeout: number,\n\tisSandbox = false,\n\tgasLimit?: number,\n\tstorageLimit?: number,\n\tfee?: number,\n): Promise<BatchWalletOperation> => {\n\tconst batch = createBatchForOriginate(tezos, contractsInfo, gasLimit, storageLimit, fee);\n\n\ttry {\n\t\treturn await doWithin<BatchWalletOperation>(maxTimeout, async () => {\n\t\t\tconst op = await batch.send();\n\t\t\tawait op.confirmation(isSandbox ? 1 : 3);\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 unknown 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\t// destination: 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\tenvType !== 'Network',\n\t\t\tparsedArgs.gasLimit,\n\t\t\tparsedArgs.storageLimit,\n\t\t\tparsedArgs.fee,\n\t\t);\n\n\t\tconst contractInfoForDisplay = await prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);\n\t\treturn sendJsonRes([contractInfoForDisplay]);\n\t} catch (e) {\n\t\tif (e instanceof Error && e.message.includes('503')) {\n\t\t\ttry {\n\t\t\t\tconst [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);\n\t\t\t\tif (envType === 'Network' && nodeConfig.rpcUrl.includes('ghostnet')) {\n\t\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t\t`❌ Ghostnet is returning 503 errors, indicating that the server is under heavy load.\\nPlease try again later.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t`❌ The node you are trying to connect to is not available\\nPlease check if the node is running and the URL is correct in your config.json`,\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\t// Resort to the default error message\n\t\t\t}\n\t\t}\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;AAsCtB,IAAM,0BAA0B,CACtC,YACA,QAC0E;AA5D3E;AA6DC,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,CAAC;AAClC,UAAM,UAAU,iBAAiB,UAAU,EAAE,WAAW;AACxD,QAAI,CAAC,SAAS;AACb,aAAO;AAAA,QACN,kEAAkE,WAAW;AAAA,MAC9E;AAAA,IACD;AACA,WAAO,QAAQ,QAAQ,CAAC,WAAW,OAAO,CAAC;AAAA,EAC5C;AACA,QAAI,SAAI,cAAJ,mBAAe,YAAW,GAAG;AAChC,UAAM,cAAc,IAAI,UAAU,CAAC;AACnC,UAAM,UAAU,iBAAiB,UAAU,EAAE,WAAW;AACxD,QAAI,CAAC,SAAS;AACb,aAA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cAAc;AAAA,UACd,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,MACF;AAAA,IACD,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","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
@@ -36,7 +36,26 @@ Plugin.create(_i18n => ({
36
36
  flag: 'timeout',
37
37
  shortFlag: 't',
38
38
  defaultValue: 40,
39
- description: 'Number of retry attempts (to avoid congestion and network failures)',
39
+ description:
40
+ 'Number of seconds to elapse before abandoning the operation (to avoid congestion and network failures)',
41
+ required: false,
42
+ }),
43
+ Option.create({
44
+ flag: 'gasLimit',
45
+ shortFlag: 'g',
46
+ description: 'Gas limit per contract/origination specified in mutez',
47
+ required: false,
48
+ }),
49
+ Option.create({
50
+ flag: 'storageLimit',
51
+ shortFlag: 's',
52
+ description: 'Storage limit per contract/origination specified in mutez',
53
+ required: false,
54
+ }),
55
+ Option.create({
56
+ flag: 'fee',
57
+ shortFlag: 'f',
58
+ description: 'Fee per contract/origination specified in mutez',
40
59
  required: false,
41
60
  }),
42
61
  ],
@@ -79,6 +98,24 @@ Plugin.create(_i18n => ({
79
98
  description: 'Number of retry attempts (to avoid congestion and network failures)',
80
99
  required: false,
81
100
  }),
101
+ Option.create({
102
+ flag: 'gasLimit',
103
+ shortFlag: 'g',
104
+ description: 'Gas limit per contract/origination specified in mutez',
105
+ required: false,
106
+ }),
107
+ Option.create({
108
+ flag: 'storageLimit',
109
+ shortFlag: 's',
110
+ description: 'Storage limit per contract/origination specified in mutez',
111
+ required: false,
112
+ }),
113
+ Option.create({
114
+ flag: 'fee',
115
+ shortFlag: 'f',
116
+ description: 'Fee per contract/origination specified in mutez',
117
+ required: false,
118
+ }),
82
119
  ],
83
120
  aliases: ['call'],
84
121
  handler: 'proxy',
package/originate.ts CHANGED
@@ -78,9 +78,18 @@ const getContractInfo = async (parsedArgs: Opts): Promise<ContractInfo> => {
78
78
  };
79
79
  };
80
80
 
81
- const createBatchForOriginate = (tezos: TezosToolkit, contractsInfo: ContractInfo[]): WalletOperationBatch =>
81
+ const createBatchForOriginate = (
82
+ tezos: TezosToolkit,
83
+ contractsInfo: ContractInfo[],
84
+ gasLimit?: number,
85
+ storageLimit?: number,
86
+ fee?: number,
87
+ ): WalletOperationBatch =>
82
88
  contractsInfo.reduce((acc, contractInfo) =>
83
89
  acc.withOrigination({
90
+ gasLimit,
91
+ storageLimit,
92
+ fee,
84
93
  code: contractInfo.code,
85
94
  init: contractInfo.initStorage,
86
95
  balance: contractInfo.mutezTransfer.toString(),
@@ -118,8 +127,11 @@ const performOriginateOps = withIntervalHack(async (
118
127
  contractsInfo: ContractInfo[],
119
128
  maxTimeout: number,
120
129
  isSandbox = false,
130
+ gasLimit?: number,
131
+ storageLimit?: number,
132
+ fee?: number,
121
133
  ): Promise<BatchWalletOperation> => {
122
- const batch = createBatchForOriginate(tezos, contractsInfo);
134
+ const batch = createBatchForOriginate(tezos, contractsInfo, gasLimit, storageLimit, fee);
123
135
 
124
136
  try {
125
137
  return await doWithin<BatchWalletOperation>(maxTimeout, async () => {
@@ -182,6 +194,9 @@ const originate = async (parsedArgs: Opts): Promise<void> => {
182
194
  [contractInfo],
183
195
  parsedArgs.timeout,
184
196
  envType !== 'Network',
197
+ parsedArgs.gasLimit,
198
+ parsedArgs.storageLimit,
199
+ parsedArgs.fee,
185
200
  );
186
201
 
187
202
  const contractInfoForDisplay = await prepContractInfoForDisplay(parsedArgs, tezos, contractInfo, op);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-taquito",
3
- "version": "0.53.1",
3
+ "version": "0.53.2",
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/pinnacle-labs/taqueria#readme",
44
44
  "dependencies": {
45
- "@taqueria/node-sdk": "^0.53.1",
45
+ "@taqueria/node-sdk": "^0.53.2",
46
46
  "@taquito/michel-codec": "^20.0.0-beta.0",
47
47
  "@taquito/signer": "^20.0.0-beta.0",
48
48
  "@taquito/taquito": "^20.0.0-beta.0",
package/transfer.ts CHANGED
@@ -52,9 +52,18 @@ const getContractInfo = async (parsedArgs: Opts, env: Environment.t): Promise<Co
52
52
  };
53
53
  };
54
54
 
55
- const createBatchForTransfer = (tezos: TezosToolkit, contractsInfo: ContractInfo[]): WalletOperationBatch =>
55
+ const createBatchForTransfer = (
56
+ tezos: TezosToolkit,
57
+ contractsInfo: ContractInfo[],
58
+ gasLimit?: number,
59
+ storageLimit?: number,
60
+ fee?: number,
61
+ ): WalletOperationBatch =>
56
62
  contractsInfo.reduce((acc, contractInfo) =>
57
63
  acc.withTransfer({
64
+ fee,
65
+ gasLimit,
66
+ storageLimit,
58
67
  to: contractInfo.contractAddress,
59
68
  amount: contractInfo.mutezTransfer,
60
69
  parameter: {
@@ -69,8 +78,11 @@ export const performTransferOps = async (
69
78
  env: string,
70
79
  contractsInfo: ContractInfo[],
71
80
  maxTimeout: number,
81
+ gasLimit?: number,
82
+ storageLimit?: number,
83
+ fee?: number,
72
84
  ): Promise<BatchWalletOperation> => {
73
- const batch = createBatchForTransfer(tezos, contractsInfo);
85
+ const batch = createBatchForTransfer(tezos, contractsInfo, gasLimit, storageLimit, fee);
74
86
  try {
75
87
  return await doWithin<BatchWalletOperation>(maxTimeout, async () => {
76
88
  const op = await batch.send();
@@ -105,7 +117,15 @@ const transfer = async (opts: Opts): Promise<void> => {
105
117
 
106
118
  const contractInfo = await getContractInfo(opts, env);
107
119
 
108
- await performTransferOps(tezos, getCurrentEnvironment(protocolArgs), [contractInfo], opts.timeout);
120
+ await performTransferOps(
121
+ tezos,
122
+ getCurrentEnvironment(protocolArgs),
123
+ [contractInfo],
124
+ opts.timeout,
125
+ opts.gasLimit,
126
+ opts.storageLimit,
127
+ opts.fee,
128
+ );
109
129
 
110
130
  const contractInfoForDisplay = prepContractInfoForDisplay(tezos, contractInfo);
111
131
  return sendJsonRes([contractInfoForDisplay]);