@taqueria/plugin-taquito 0.56.15 → 0.57.9
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/index.d.mts +2 -0
- package/index.js +9 -18
- package/index.js.map +1 -1
- package/index.mjs +9 -18
- package/index.mjs.map +1 -1
- package/package.json +73 -72
- package/tsconfig.json +6 -1
package/index.d.mts
ADDED
package/index.js
CHANGED
|
@@ -16,8 +16,7 @@ var import_taquito = require("@taquito/taquito");
|
|
|
16
16
|
var getEnvTypeAndNodeConfig = (parsedArgs, env) => {
|
|
17
17
|
var _a, _b, _c, _d;
|
|
18
18
|
const targetConstraintErrMsg = "Each environment can only have one target, be it a network or a sandbox";
|
|
19
|
-
if (((_a = env.networks) == null ? void 0 : _a.length) === 1 && ((_b = env.sandboxes) == null ? void 0 : _b.length) === 1)
|
|
20
|
-
return (0, import_node_sdk.sendAsyncErr)(targetConstraintErrMsg);
|
|
19
|
+
if (((_a = env.networks) == null ? void 0 : _a.length) === 1 && ((_b = env.sandboxes) == null ? void 0 : _b.length) === 1) return (0, import_node_sdk.sendAsyncErr)(targetConstraintErrMsg);
|
|
21
20
|
if (((_c = env.networks) == null ? void 0 : _c.length) === 1) {
|
|
22
21
|
const networkName = env.networks[0];
|
|
23
22
|
const network = (0, import_node_sdk.getNetworkConfig)(parsedArgs)(networkName);
|
|
@@ -124,10 +123,8 @@ var generateAccountKeys = async (parsedArgs, network, account) => {
|
|
|
124
123
|
var handleOpsError = (err, env) => {
|
|
125
124
|
if (err instanceof Error) {
|
|
126
125
|
const msg = err.message;
|
|
127
|
-
if (/ENOTFOUND/.test(msg))
|
|
128
|
-
|
|
129
|
-
if (/ECONNREFUSED/.test(msg))
|
|
130
|
-
return (0, import_node_sdk.sendAsyncErr)("The RPC URL may be down or the sandbox is not running");
|
|
126
|
+
if (/ENOTFOUND/.test(msg)) return (0, import_node_sdk.sendAsyncErr)("The RPC URL may be invalid. Check ./.taq/config.json");
|
|
127
|
+
if (/ECONNREFUSED/.test(msg)) return (0, import_node_sdk.sendAsyncErr)("The RPC URL may be down or the sandbox is not running");
|
|
131
128
|
if (/empty_implicit_contract/.test(msg)) {
|
|
132
129
|
const result = msg.match(/(?<="implicit":")tz[^"]+(?=")/);
|
|
133
130
|
const publicKeyHash = result ? result[0] : void 0;
|
|
@@ -223,8 +220,7 @@ var prepContractInfoForDisplay = (tezos, contractInfo) => {
|
|
|
223
220
|
var transfer = async (opts) => {
|
|
224
221
|
const protocolArgs = import_node_sdk2.RequestArgs.create(opts);
|
|
225
222
|
const env = (0, import_node_sdk2.getCurrentEnvironmentConfig)(protocolArgs);
|
|
226
|
-
if (!env)
|
|
227
|
-
return (0, import_node_sdk2.sendAsyncErr)(`There is no environment called ${protocolArgs.env} in your config.json`);
|
|
223
|
+
if (!env) return (0, import_node_sdk2.sendAsyncErr)(`There is no environment called ${protocolArgs.env} in your config.json`);
|
|
228
224
|
try {
|
|
229
225
|
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
|
|
230
226
|
const tezos = await (envType === "Network" ? configureToolKitForNetwork(protocolArgs, nodeConfig, opts.sender) : configureToolKitForSandbox(nodeConfig, opts.sender));
|
|
@@ -278,12 +274,10 @@ var prepAccountsInfoForDisplay = (accountsInfo) => accountsInfo.map((accountInfo
|
|
|
278
274
|
});
|
|
279
275
|
var fund = async (parsedArgs) => {
|
|
280
276
|
const env = (0, import_node_sdk3.getCurrentEnvironmentConfig)(parsedArgs);
|
|
281
|
-
if (!env)
|
|
282
|
-
return (0, import_node_sdk3.sendAsyncErr)(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
277
|
+
if (!env) return (0, import_node_sdk3.sendAsyncErr)(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
283
278
|
try {
|
|
284
279
|
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);
|
|
285
|
-
if (envType !== "Network")
|
|
286
|
-
return (0, import_node_sdk3.sendAsyncErr)("taq fund can only be executed in a network environment");
|
|
280
|
+
if (envType !== "Network") return (0, import_node_sdk3.sendAsyncErr)("taq fund can only be executed in a network environment");
|
|
287
281
|
const tezos = await configureToolKitForNetwork(parsedArgs, nodeConfig);
|
|
288
282
|
const instantiatedAccounts = getNetworkInstantiatedAccounts(nodeConfig);
|
|
289
283
|
const accountsInfo = await getAccountsInfo(parsedArgs, tezos, instantiatedAccounts);
|
|
@@ -305,8 +299,7 @@ var fund_default = fund;
|
|
|
305
299
|
var import_node_sdk4 = require("@taqueria/node-sdk");
|
|
306
300
|
var instantiate_account = async (parsedArgs) => {
|
|
307
301
|
const env = (0, import_node_sdk4.getCurrentEnvironmentConfig)(parsedArgs);
|
|
308
|
-
if (!env)
|
|
309
|
-
return (0, import_node_sdk4.sendAsyncErr)(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
302
|
+
if (!env) return (0, import_node_sdk4.sendAsyncErr)(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
310
303
|
try {
|
|
311
304
|
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);
|
|
312
305
|
if (envType !== "Network") {
|
|
@@ -337,8 +330,7 @@ Please execute "taq fund" targeting the same environment to fund these accounts`
|
|
|
337
330
|
}
|
|
338
331
|
} catch (err) {
|
|
339
332
|
await (0, import_node_sdk4.sendAsyncErr)("No operations performed");
|
|
340
|
-
if (parsedArgs.debug)
|
|
341
|
-
await (0, import_node_sdk4.sendAsyncErr)(String(err));
|
|
333
|
+
if (parsedArgs.debug) await (0, import_node_sdk4.sendAsyncErr)(String(err));
|
|
342
334
|
}
|
|
343
335
|
};
|
|
344
336
|
var instantiate_account_default = instantiate_account;
|
|
@@ -441,8 +433,7 @@ var prepContractInfoForDisplay2 = async (parsedArgs, tezos, contractInfo, op) =>
|
|
|
441
433
|
var originate = async (parsedArgs) => {
|
|
442
434
|
const protocolArgs = import_node_sdk5.RequestArgs.create(parsedArgs);
|
|
443
435
|
const env = (0, import_node_sdk5.getCurrentEnvironmentConfig)(protocolArgs);
|
|
444
|
-
if (!env)
|
|
445
|
-
return (0, import_node_sdk5.sendAsyncErr)(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
436
|
+
if (!env) return (0, import_node_sdk5.sendAsyncErr)(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
446
437
|
try {
|
|
447
438
|
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
|
|
448
439
|
const tezos = await (envType === "Network" ? configureToolKitForNetwork(protocolArgs, nodeConfig, parsedArgs.sender) : configureToolKitForSandbox(nodeConfig, parsedArgs.sender));
|
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:\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().replaceAll('_', '')),\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.replaceAll('_', '')) : 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;AACrH,MAAI;AACJ,MAAI,UAAU,WAAW,WAAW;AACnC,UAAM,WAAW,+BAA+B,OAAO;AACvD,QAAI,SAAS,eAAe,MAAM,GAAG;AACpC,mBAAa,SAAS,MAAM,EAAE;AAAA,IAC/B,OAAO;AACN,iBAAO;AAAA,QACN,GAAG,MAAM;AAAA,MACV;AAAA,IACD;AAAA,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C;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"]}
|
|
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().replaceAll('_', '')),\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.replaceAll('_', '')) : 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,EAAG,YAAO,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,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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
|
@@ -27,8 +27,7 @@ import { TezosToolkit } from "@taquito/taquito";
|
|
|
27
27
|
var getEnvTypeAndNodeConfig = (parsedArgs, env) => {
|
|
28
28
|
var _a, _b, _c, _d;
|
|
29
29
|
const targetConstraintErrMsg = "Each environment can only have one target, be it a network or a sandbox";
|
|
30
|
-
if (((_a = env.networks) == null ? void 0 : _a.length) === 1 && ((_b = env.sandboxes) == null ? void 0 : _b.length) === 1)
|
|
31
|
-
return sendAsyncErr(targetConstraintErrMsg);
|
|
30
|
+
if (((_a = env.networks) == null ? void 0 : _a.length) === 1 && ((_b = env.sandboxes) == null ? void 0 : _b.length) === 1) return sendAsyncErr(targetConstraintErrMsg);
|
|
32
31
|
if (((_c = env.networks) == null ? void 0 : _c.length) === 1) {
|
|
33
32
|
const networkName = env.networks[0];
|
|
34
33
|
const network = getNetworkConfig(parsedArgs)(networkName);
|
|
@@ -135,10 +134,8 @@ var generateAccountKeys = async (parsedArgs, network, account) => {
|
|
|
135
134
|
var handleOpsError = (err, env) => {
|
|
136
135
|
if (err instanceof Error) {
|
|
137
136
|
const msg = err.message;
|
|
138
|
-
if (/ENOTFOUND/.test(msg))
|
|
139
|
-
|
|
140
|
-
if (/ECONNREFUSED/.test(msg))
|
|
141
|
-
return sendAsyncErr("The RPC URL may be down or the sandbox is not running");
|
|
137
|
+
if (/ENOTFOUND/.test(msg)) return sendAsyncErr("The RPC URL may be invalid. Check ./.taq/config.json");
|
|
138
|
+
if (/ECONNREFUSED/.test(msg)) return sendAsyncErr("The RPC URL may be down or the sandbox is not running");
|
|
142
139
|
if (/empty_implicit_contract/.test(msg)) {
|
|
143
140
|
const result = msg.match(/(?<="implicit":")tz[^"]+(?=")/);
|
|
144
141
|
const publicKeyHash = result ? result[0] : void 0;
|
|
@@ -242,8 +239,7 @@ var prepContractInfoForDisplay = (tezos, contractInfo) => {
|
|
|
242
239
|
var transfer = async (opts) => {
|
|
243
240
|
const protocolArgs = RequestArgs2.create(opts);
|
|
244
241
|
const env = getCurrentEnvironmentConfig(protocolArgs);
|
|
245
|
-
if (!env)
|
|
246
|
-
return sendAsyncErr2(`There is no environment called ${protocolArgs.env} in your config.json`);
|
|
242
|
+
if (!env) return sendAsyncErr2(`There is no environment called ${protocolArgs.env} in your config.json`);
|
|
247
243
|
try {
|
|
248
244
|
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
|
|
249
245
|
const tezos = await (envType === "Network" ? configureToolKitForNetwork(protocolArgs, nodeConfig, opts.sender) : configureToolKitForSandbox(nodeConfig, opts.sender));
|
|
@@ -297,12 +293,10 @@ var prepAccountsInfoForDisplay = (accountsInfo) => accountsInfo.map((accountInfo
|
|
|
297
293
|
});
|
|
298
294
|
var fund = async (parsedArgs) => {
|
|
299
295
|
const env = getCurrentEnvironmentConfig2(parsedArgs);
|
|
300
|
-
if (!env)
|
|
301
|
-
return sendAsyncErr3(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
296
|
+
if (!env) return sendAsyncErr3(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
302
297
|
try {
|
|
303
298
|
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);
|
|
304
|
-
if (envType !== "Network")
|
|
305
|
-
return sendAsyncErr3("taq fund can only be executed in a network environment");
|
|
299
|
+
if (envType !== "Network") return sendAsyncErr3("taq fund can only be executed in a network environment");
|
|
306
300
|
const tezos = await configureToolKitForNetwork(parsedArgs, nodeConfig);
|
|
307
301
|
const instantiatedAccounts = getNetworkInstantiatedAccounts(nodeConfig);
|
|
308
302
|
const accountsInfo = await getAccountsInfo(parsedArgs, tezos, instantiatedAccounts);
|
|
@@ -324,8 +318,7 @@ var fund_default = fund;
|
|
|
324
318
|
import { getCurrentEnvironmentConfig as getCurrentEnvironmentConfig3, sendAsyncErr as sendAsyncErr4, sendJsonRes as sendJsonRes3, sendWarn as sendWarn2 } from "@taqueria/node-sdk";
|
|
325
319
|
var instantiate_account = async (parsedArgs) => {
|
|
326
320
|
const env = getCurrentEnvironmentConfig3(parsedArgs);
|
|
327
|
-
if (!env)
|
|
328
|
-
return sendAsyncErr4(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
321
|
+
if (!env) return sendAsyncErr4(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
329
322
|
try {
|
|
330
323
|
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(parsedArgs, env);
|
|
331
324
|
if (envType !== "Network") {
|
|
@@ -356,8 +349,7 @@ Please execute "taq fund" targeting the same environment to fund these accounts`
|
|
|
356
349
|
}
|
|
357
350
|
} catch (err) {
|
|
358
351
|
await sendAsyncErr4("No operations performed");
|
|
359
|
-
if (parsedArgs.debug)
|
|
360
|
-
await sendAsyncErr4(String(err));
|
|
352
|
+
if (parsedArgs.debug) await sendAsyncErr4(String(err));
|
|
361
353
|
}
|
|
362
354
|
};
|
|
363
355
|
var instantiate_account_default = instantiate_account;
|
|
@@ -471,8 +463,7 @@ var prepContractInfoForDisplay2 = async (parsedArgs, tezos, contractInfo, op) =>
|
|
|
471
463
|
var originate = async (parsedArgs) => {
|
|
472
464
|
const protocolArgs = RequestArgs5.create(parsedArgs);
|
|
473
465
|
const env = getCurrentEnvironmentConfig4(protocolArgs);
|
|
474
|
-
if (!env)
|
|
475
|
-
return sendAsyncErr5(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
466
|
+
if (!env) return sendAsyncErr5(`There is no environment called ${parsedArgs.env} in your config.json`);
|
|
476
467
|
try {
|
|
477
468
|
const [envType, nodeConfig] = await getEnvTypeAndNodeConfig(protocolArgs, env);
|
|
478
469
|
const tezos = await (envType === "Network" ? configureToolKitForNetwork(protocolArgs, nodeConfig, parsedArgs.sender) : configureToolKitForSandbox(nodeConfig, parsedArgs.sender));
|
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:\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().replaceAll('_', '')),\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.replaceAll('_', '')) : 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,gBAA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,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,cAAc;AAAA,UACd,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,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,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,MACV,SAAS;AAAA,QACR,OAAO,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,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().replaceAll('_', '')),\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.replaceAll('_', '')) : 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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ACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aACC;AAAA,UACD,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,cAAc;AAAA,UACd,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,QACD,OAAO,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,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,MACV,SAAS;AAAA,QACR,OAAO,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,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/package.json
CHANGED
|
@@ -1,73 +1,74 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
2
|
+
"name": "@taqueria/plugin-taquito",
|
|
3
|
+
"version": "0.57.9",
|
|
4
|
+
"description": "A taqueria plugin for originating smart contracts using Taquito",
|
|
5
|
+
"targets": {
|
|
6
|
+
"default": {
|
|
7
|
+
"source": "./index.ts",
|
|
8
|
+
"distDir": "./",
|
|
9
|
+
"context": "node",
|
|
10
|
+
"isLibrary": true
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"taqueria",
|
|
15
|
+
"tezos",
|
|
16
|
+
"originate",
|
|
17
|
+
"deploy",
|
|
18
|
+
"pinnaclelabs",
|
|
19
|
+
"pinnacle-labs",
|
|
20
|
+
"plugin",
|
|
21
|
+
"taquito",
|
|
22
|
+
"smart contract"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=16"
|
|
26
|
+
},
|
|
27
|
+
"author": "Taqueria",
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/tezostaqueria/taqueria.git",
|
|
32
|
+
"directory": "taqueria-plugin-taquito"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/tezostaqueria/taqueria/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/tezostaqueria/taqueria#readme",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@taquito/michel-codec": "^21.0.0-beta.0",
|
|
40
|
+
"@taquito/rpc": "^20.0.1",
|
|
41
|
+
"@taquito/signer": "^21.0.0-beta.0",
|
|
42
|
+
"@taquito/taquito": "^21.0.0-beta.0",
|
|
43
|
+
"fast-glob": "^3.3.2",
|
|
44
|
+
"wtfnode": "^0.9.3",
|
|
45
|
+
"@taqueria/node-sdk": "0.57.9"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"tsup": "^8.3.0",
|
|
49
|
+
"typescript": "^5.6.2"
|
|
50
|
+
},
|
|
51
|
+
"tsup": {
|
|
52
|
+
"entry": [
|
|
53
|
+
"index.ts"
|
|
54
|
+
],
|
|
55
|
+
"sourcemap": true,
|
|
56
|
+
"target": "node16",
|
|
57
|
+
"outDir": "./",
|
|
58
|
+
"dts": true,
|
|
59
|
+
"clean": false,
|
|
60
|
+
"skipNodeModulesBundle": true,
|
|
61
|
+
"platform": "node",
|
|
62
|
+
"format": [
|
|
63
|
+
"esm",
|
|
64
|
+
"cjs"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"gitHead": "ff58a2fc06ad233869ad6be574093c8b3b272e2e",
|
|
68
|
+
"scripts": {
|
|
69
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
70
|
+
"pluginInfo": "npx ts-node index.ts --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}",
|
|
71
|
+
"build": "npx tsc -noEmit -p ./tsconfig.json && npx tsup",
|
|
72
|
+
"debugPluginInfo": "node --inspect-brk index.js --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}"
|
|
73
|
+
}
|
|
74
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -100,5 +100,10 @@
|
|
|
100
100
|
/* Completeness */
|
|
101
101
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
102
102
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
103
|
-
}
|
|
103
|
+
},
|
|
104
|
+
"references": [
|
|
105
|
+
{
|
|
106
|
+
"path": "../taqueria-sdk"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
104
109
|
}
|