@taqueria/plugin-taquito 0.21.11 → 0.21.13

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.js CHANGED
@@ -104,21 +104,14 @@ const $806c5c6032403442$var$createBatch = async (parsedArgs, tezos, destination)
104
104
  const error = err;
105
105
  if (error.message) {
106
106
  const msg = error.message;
107
- if (/ENOTFOUND/.test(msg)) {
108
- (0, $iVZbm$taquerianodesdk.sendErr)("The RPC URL may be invalid. Check your ./.taq/config.json.\n");
109
- (0, $iVZbm$taquerianodesdk.sendErr)(msg);
110
- } else if (/ECONNREFUSED/.test(msg)) {
111
- (0, $iVZbm$taquerianodesdk.sendErr)("The RPC URL may be down or the sandbox is not running.\n");
112
- (0, $iVZbm$taquerianodesdk.sendErr)(msg);
113
- } else if (/empty_implicit_contract/.test(msg)) {
107
+ if (/ENOTFOUND/.test(msg)) (0, $iVZbm$taquerianodesdk.sendErr)(msg + " - The RPC URL may be invalid. Check ./taq/config.json.\n");
108
+ else if (/ECONNREFUSED/.test(msg)) (0, $iVZbm$taquerianodesdk.sendErr)(msg + " - The RPC URL may be down or the sandbox is not running.");
109
+ else if (/empty_implicit_contract/.test(msg)) {
114
110
  const result = msg.match(/(?<="implicit":")tz[^"]+(?=")/);
115
111
  const publicKeyHash = result ? result[0] : undefined;
116
112
  if (!publicKeyHash) (0, $iVZbm$taquerianodesdk.sendErr)(msg);
117
113
  else (0, $iVZbm$taquerianodesdk.sendErr)(`The account ${publicKeyHash} for the target environment, "${(0, $iVZbm$taquerianodesdk.getCurrentEnvironment)(parsedArgs)}", 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)`);
118
- } else {
119
- (0, $iVZbm$taquerianodesdk.sendErr)("There was a problem communicating with the chain. Please check the RPC URL of the network or sandbox you're targeting.\n");
120
- (0, $iVZbm$taquerianodesdk.sendErr)(msg);
121
- }
114
+ } else (0, $iVZbm$taquerianodesdk.sendErr)(msg + " - There was a problem communicating with the chain. Check the RPC URL of the network or sandbox you're targeting in config.json.\n");
122
115
  }
123
116
  return undefined;
124
117
  }
@@ -218,7 +211,7 @@ const $944e64d99e99b46e$var$getFirstAccountAlias = (sandboxName, opts)=>{
218
211
  const aliases = (0, $iVZbm$taquerianodesdk.getSandboxAccountNames)(opts)(sandboxName);
219
212
  return aliases.shift();
220
213
  };
221
- const $944e64d99e99b46e$var$configureToolKitWithSandbox = (parsedArgs, sandboxName)=>{
214
+ const $944e64d99e99b46e$var$configureToolKitWithSandbox = async (parsedArgs, sandboxName)=>{
222
215
  const sandbox = (0, $iVZbm$taquerianodesdk.getSandboxConfig)(parsedArgs)(sandboxName);
223
216
  if (!sandbox) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`The current environment is configured to use a sandbox called '${sandboxName}'; however, no sandbox of this name has been configured in .taq/config.json.`);
224
217
  let defaultAccount = (0, $iVZbm$taquerianodesdk.getDefaultAccount)(parsedArgs)(sandboxName);
@@ -234,7 +227,7 @@ const $944e64d99e99b46e$var$configureToolKitWithSandbox = (parsedArgs, sandboxNa
234
227
  tezos.setProvider({
235
228
  signer: new (0, $iVZbm$taquitosigner.InMemorySigner)(defaultAccount.secretKey.replace(/^unencrypted:/, ""))
236
229
  });
237
- return Promise.resolve(tezos);
230
+ return tezos;
238
231
  };
239
232
  const $944e64d99e99b46e$var$configureToolKitWithNetwork = async (parsedArgs, networkName)=>{
240
233
  const network = (0, $iVZbm$taquerianodesdk.getNetworkConfig)(parsedArgs)(networkName);
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;ACAA;ACAA;;;;;AA4CA,MAAM,0CAAoB,GAAG,CAAC,WAAmB,EAAE,IAAU,GAAK;IACjE,MAAM,OAAO,GAAG,CAAA,GAAA,6CAAsB,CAAA,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,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AC,MAAM,CAAC;wBACb,IAAI,EAAE,SAAS;wBACf,WAAW,EACV,iJAAiJ;wBAClJ,QAAQ,EAAE,KAAK;qBACf,CAAC;iBACF;gBACD,OAAO,EAAE;oBAAC,WAAW;iBAAC;gBACtB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,kBAAkB;aAC5B,CAAC;YACF,CAAA,GAAA,2BAAI,CAAA,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,qBAAqB;gBAC9B,WAAW,EACV,iIAAiI;gBAClI,OAAO,EAAE;oBACR,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,KAAK;wBACX,WAAW,EAAE,2BAA2B;wBACxC,QAAQ,EAAE,KAAK;qBACf,CAAC;oBACF,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,OAAO;wBACb,WAAW,EACV,2JAA2J;wBAC5J,QAAQ,EAAE,KAAK;qBACf,CAAC;oBACF,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,YAAY;wBAClB,WAAW,EACV,8IAA8I;wBAC/I,QAAQ,EAAE,KAAK;qBACf,CAAC;iBACF;gBACD,OAAO,EAAE;oBAAC,MAAM;iBAAC;gBACjB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,kBAAkB;aAC5B,CAAC;SACF;QACD,KAAK,EAAE,CAAA,GAAA,wCAAO,CAAA;KACd,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-taquito/index.ts","taqueria-plugin-taquito/taquito.ts","taqueria-plugin-taquito/originate.ts","taqueria-plugin-taquito/transfer.ts"],"sourcesContent":["import { Option, Plugin, Task } from '@taqueria/node-sdk';\nimport taquito from './taquito';\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],\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: 'tez',\n\t\t\t\t\tdescription: 'Amount of Tez 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],\n\t\t\taliases: ['call'],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t],\n\tproxy: taquito,\n}), process.argv);\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk/types';\nimport originate from './originate';\nimport transfer from './transfer';\n\ninterface Opts extends RequestArgs.ProxyRequestArgs {\n\t// from originate.ts\n\tstorage: string;\n\talias?: string;\n\t// from transfer.ts\n\ttez?: string;\n\tparam?: string;\n\tentrypoint?: string;\n\t// from originate.ts and transfer.ts\n\tcontract: string;\n}\n\nexport const taquito = (parsedArgs: Opts): Promise<void> => {\n\tswitch (parsedArgs.task) {\n\t\tcase 'originate':\n\t\tcase 'deploy':\n\t\t\treturn originate(parsedArgs);\n\t\tcase 'transfer':\n\t\tcase 'call':\n\t\t\treturn transfer(parsedArgs);\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${parsedArgs.task} is not an understood task by the Taquito plugin`);\n\t}\n};\n\nexport default taquito;\n","import {\n\tgetAccountPrivateKey,\n\tgetCurrentEnvironment,\n\tgetCurrentEnvironmentConfig,\n\tgetDefaultAccount,\n\tgetInitialStorage,\n\tgetNetworkConfig,\n\tgetSandboxAccountConfig,\n\tgetSandboxAccountNames,\n\tgetSandboxConfig,\n\tnewGetInitialStorage,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n\tsendRes,\n\tupdateAddressAlias,\n} from '@taqueria/node-sdk';\nimport { Protocol, RequestArgs } from '@taqueria/node-sdk/types';\nimport { OperationContentsAndResultOrigination } from '@taquito/rpc';\nimport { importKey, InMemorySigner } from '@taquito/signer';\nimport { TezosToolkit, WalletOperationBatch } from '@taquito/taquito';\nimport { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';\nimport glob from 'fast-glob';\nimport { readFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\n\ninterface Opts extends RequestArgs.t {\n\tcontract: string;\n\tstorage: string;\n\talias?: string;\n}\n\ninterface ContractStorageMapping {\n\tfilename: string;\n\tstorage?: unknown;\n}\n\ninterface OriginationResult {\n\tcontract: string;\n\taddress: string;\n\talias: string;\n\tdestination: string;\n}\n\nconst getFirstAccountAlias = (sandboxName: string, opts: Opts) => {\n\tconst aliases = getSandboxAccountNames(opts)(sandboxName);\n\treturn aliases.shift();\n};\n\nconst getContractAbspath = (contractFilename: string, parsedArgs: Opts) =>\n\tjoin(parsedArgs.config.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);\n\nconst addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) =>\n\tasync (mapping: ContractStorageMapping) => {\n\t\tconst contractAbspath = getContractAbspath(mapping.filename, parsedArgs);\n\t\tconst contractData = await readFile(contractAbspath, 'utf-8');\n\t\treturn (await batch).withOrigination({\n\t\t\tcode: contractData,\n\t\t\tinit: mapping.storage as any,\n\t\t});\n\t};\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\n// TODO: temporary quick solution. May refactor this to only deal with one contract later\nconst getValidContracts = async (parsedArgs: Opts) => {\n\tconst contracts = [parsedArgs.contract];\n\tconst storageFilename = parsedArgs.storage ?? getDefaultStorageFilename(contracts[0]);\n\n\treturn contracts.reduce(\n\t\tasync (retval, filename) => {\n\t\t\tconst storage = await newGetInitialStorage(parsedArgs, storageFilename);\n\t\t\tif (storage === undefined || storage === null) {\n\t\t\t\tsendErr(\n\t\t\t\t\t`❌ No initial storage file was found for ${filename}\\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\t\t\tgetDefaultStorageFilename(contracts[0])\n\t\t\t\t\t}\" in the artifacts directory\\nYou can also manually pass a storage file to the deploy task using the --storage STORAGE_FILE_NAME option\\n`,\n\t\t\t\t);\n\t\t\t\t// sendErr(\n\t\t\t\t// \t`Michelson artifact ${filename} has no initial storage specified for the target environment.\\nStorage is expected to be specified in .taq/config.json at JSON path: environment.${\n\t\t\t\t// \t\tgetCurrentEnvironment(parsedArgs)\n\t\t\t\t// \t}.storage[\"${filename}\"]\\nThe value of the above JSON key should be the name of the file (absolute path or relative path with respect to the root of the Taqueria project) that contains the actual value of the storage, as a Michelson expression.\\n`,\n\t\t\t\t// );\n\t\t\t\treturn retval;\n\t\t\t}\n\t\t\treturn [...(await retval), { filename, storage }];\n\t\t},\n\t\tPromise.resolve([] as ContractStorageMapping[]),\n\t);\n};\n\nconst mapOpToContract = async (\n\tparsedArgs: Opts,\n\tcontracts: ContractStorageMapping[],\n\top: BatchWalletOperation,\n\tdestination: string,\n) => {\n\tconst results = await op.operationResults();\n\tconst originationResults = results.filter(result => result.kind === 'origination')\n\t\t.map(result => result as OperationContentsAndResultOrigination);\n\n\treturn contracts.reduce(\n\t\t(retval, contract) => {\n\t\t\t// If initial storage was provided for the contract\n\t\t\t// then we submitted an operation to originate that contract\n\t\t\tif (contract.storage) {\n\t\t\t\t// WARNING - using side effect here.\n\t\t\t\t// For each iteration of reduce, results array is being modified-in-place.\n\t\t\t\t// TODO: Adjust to use recursion to avoid side-effect.\n\t\t\t\tconst result = originationResults.shift();\n\t\t\t\tconst address = result && result.metadata.operation_result.originated_contracts\n\t\t\t\t\t? result.metadata.operation_result.originated_contracts.join(',')\n\t\t\t\t\t: 'Error';\n\n\t\t\t\tconst alias = parsedArgs.alias ?? basename(contract.filename, extname(contract.filename));\n\t\t\t\tif (address !== 'Error') updateAddressAlias(parsedArgs, alias, address);\n\n\t\t\t\treturn [\n\t\t\t\t\t...retval,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontract: contract.filename,\n\t\t\t\t\t\taddress,\n\t\t\t\t\t\talias: address !== 'Error' ? alias : 'N/A',\n\t\t\t\t\t\tdestination,\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t...retval,\n\t\t\t\t{\n\t\t\t\t\tcontract: contract.filename,\n\t\t\t\t\taddress: 'Error',\n\t\t\t\t\talias: 'N/A',\n\t\t\t\t\tdestination,\n\t\t\t\t},\n\t\t\t];\n\t\t},\n\t\t[] as OriginationResult[],\n\t);\n};\n\nconst createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: string) => {\n\tconst contracts = await getValidContracts(parsedArgs);\n\tif (!contracts.length) {\n\t\treturn undefined;\n\t}\n\n\tconst batch = await contracts.reduce(\n\t\t(batch, contractMapping) =>\n\t\t\tcontractMapping.storage\n\t\t\t\t? addOrigination(parsedArgs, batch)(contractMapping)\n\t\t\t\t: batch,\n\t\tPromise.resolve(tezos.wallet.batch()),\n\t);\n\n\ttry {\n\t\tconst op = await batch.send();\n\t\tconst confirmed = await op.confirmation();\n\t\treturn await mapOpToContract(parsedArgs, contracts, op, destination);\n\t} catch (err) {\n\t\tconst error = (err as { message: string });\n\t\tif (error.message) {\n\t\t\tconst msg = error.message;\n\t\t\tif (/ENOTFOUND/.test(msg)) {\n\t\t\t\tsendErr('The RPC URL may be invalid. Check your ./.taq/config.json.\\n');\n\t\t\t\tsendErr(msg);\n\t\t\t} else if (/ECONNREFUSED/.test(msg)) {\n\t\t\t\tsendErr('The RPC URL may be down or the sandbox is not running.\\n');\n\t\t\t\tsendErr(msg);\n\t\t\t} else if (/empty_implicit_contract/.test(msg)) {\n\t\t\t\tconst result = msg.match(/(?<=\"implicit\":\")tz[^\"]+(?=\")/);\n\t\t\t\tconst publicKeyHash = result ? result[0] : undefined;\n\t\t\t\tif (!publicKeyHash) sendErr(msg);\n\t\t\t\telse {\n\t\t\t\t\tsendErr(\n\t\t\t\t\t\t`The account ${publicKeyHash} for the target environment, \"${\n\t\t\t\t\t\t\tgetCurrentEnvironment(parsedArgs)\n\t\t\t\t\t\t}\", 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\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsendErr(\n\t\t\t\t\t\"There was a problem communicating with the chain. Please check the RPC URL of the network or sandbox you're targeting.\\n\",\n\t\t\t\t);\n\t\t\t\tsendErr(msg);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n};\n\n/**\n * @description Import a key to sign operation with the side-effect of setting the Tezos instance to use the InMemorySigner provider\n *\n * @param toolkit The toolkit instance to attach a signer\n * @param privateKeyOrEmail Key to load in memory\n * @param passphrase If the key is encrypted passphrase to decrypt it\n * @param mnemonic Faucet mnemonic\n * @param secret Faucet secret\n */\nexport async function importFaucet(\n\ttoolkit: TezosToolkit,\n\tprivateKeyOrEmail?: string,\n\tpassphrase?: string,\n\tmnemonic?: string,\n\tsecret?: string,\n) {\n\tif (privateKeyOrEmail && passphrase && mnemonic && secret) {\n\t\treturn await importKey(toolkit, privateKeyOrEmail, passphrase, mnemonic, secret);\n\t} else if (mnemonic) {\n\t\tconst signer = InMemorySigner.fromFundraiser(privateKeyOrEmail ?? '', passphrase ?? '', mnemonic);\n\t\ttoolkit.setProvider({ signer });\n\t\tconst pkh = await signer.publicKeyHash();\n\t\tlet op;\n\t\ttry {\n\t\t\top = await toolkit.tz.activate(pkh, secret ?? '');\n\t\t\tif (op) {\n\t\t\t\tawait op.confirmation();\n\t\t\t}\n\t\t} catch (ex: any) {\n\t\t}\n\t} else if (privateKeyOrEmail) {\n\t\t// Fallback to regular import\n\t\tconst signer = await InMemorySigner.fromSecretKey(privateKeyOrEmail, passphrase);\n\t\ttoolkit.setProvider({ signer });\n\t}\n}\n\nconst originateToNetworks = (parsedArgs: Opts, currentEnv: Protocol.Environment.t) =>\n\tcurrentEnv.networks\n\t\t? currentEnv.networks.reduce(\n\t\t\t(retval, networkName) => {\n\t\t\t\tconst network = getNetworkConfig(parsedArgs)(networkName);\n\t\t\t\tif (network) {\n\t\t\t\t\tif (network.rpcUrl) {\n\t\t\t\t\t\tconst result = (async () => {\n\t\t\t\t\t\t\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\t\t\t\t\t\t\tconst key = await getAccountPrivateKey(parsedArgs, network, 'taqRootAccount');\n\t\t\t\t\t\t\tawait importKey(tezos, key);\n\t\t\t\t\t\t\treturn await createBatch(parsedArgs, tezos, networkName);\n\t\t\t\t\t\t})();\n\n\t\t\t\t\t\treturn [...retval, result];\n\t\t\t\t\t} else sendErr(`Network \"${networkName}\" is missing an RPC url in config.json.`);\n\t\t\t\t} else {\n\t\t\t\t\tsendErr(\n\t\t\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\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn retval;\n\t\t\t},\n\t\t\t[] as Promise<OriginationResult[] | undefined>[],\n\t\t)\n\t\t: [];\n\nconst originateToSandboxes = (parsedArgs: Opts, currentEnv: Protocol.Environment.t) =>\n\tcurrentEnv.sandboxes\n\t\t? currentEnv.sandboxes.reduce(\n\t\t\t(retval, sandboxName) => {\n\t\t\t\tconst sandbox = getSandboxConfig(parsedArgs)(sandboxName);\n\t\t\t\tif (sandbox) {\n\t\t\t\t\tif (sandbox.rpcUrl) {\n\t\t\t\t\t\tlet defaultAccount = getDefaultAccount(parsedArgs)(sandboxName);\n\t\t\t\t\t\tif (!defaultAccount) {\n\t\t\t\t\t\t\tconst first = getFirstAccountAlias(sandboxName, parsedArgs);\n\t\t\t\t\t\t\tif (first) {\n\t\t\t\t\t\t\t\tdefaultAccount = getSandboxAccountConfig(parsedArgs)(sandboxName)(first);\n\t\t\t\t\t\t\t\t// TODO: The error should be a warning, not an error. Descriptive string should not begin with 'Warning:'\n\t\t\t\t\t\t\t\tsendErr(\n\t\t\t\t\t\t\t\t\t`Warning: A default origination account has not been specified for sandbox ${sandboxName}. Taqueria will use the account ${first} for this origination.\\nA default account can be specified in .taq/config.json at JSON path: sandbox.${sandboxName}.accounts.default\\n`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (defaultAccount) {\n\t\t\t\t\t\t\tconst secretKey = defaultAccount.secretKey;\n\t\t\t\t\t\t\tconst result = (async () => {\n\t\t\t\t\t\t\t\tconst tezos = new TezosToolkit(sandbox.rpcUrl as string);\n\t\t\t\t\t\t\t\ttezos.setProvider({\n\t\t\t\t\t\t\t\t\tsigner: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn await createBatch(parsedArgs, tezos, sandboxName);\n\t\t\t\t\t\t\t})();\n\n\t\t\t\t\t\t\treturn [...retval, result];\n\t\t\t\t\t\t} else sendErr(`No accounts are available for the sandbox called ${sandboxName} to perform origination.`);\n\t\t\t\t\t} else sendErr(`Sandbox \"${sandboxName} is missing an RPC url in config.json.\"`);\n\t\t\t\t} else {\n\t\t\t\t\tsendErr(\n\t\t\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\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn retval;\n\t\t\t},\n\t\t\t[] as Promise<OriginationResult[] | undefined>[],\n\t\t)\n\t\t: [];\n\nexport const originate = <T>(parsedArgs: Opts) => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\n\tif (!env) {\n\t\treturn sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);\n\t}\n\n\tconst jobs = [\n\t\t...originateToNetworks(parsedArgs, env),\n\t\t...originateToSandboxes(parsedArgs, env),\n\t];\n\n\treturn Promise.all(jobs)\n\t\t.then(jobs =>\n\t\t\tjobs.reduce(\n\t\t\t\t(retval, originations) => {\n\t\t\t\t\treturn originations\n\t\t\t\t\t\t? [...retval as OriginationResult[], ...originations]\n\t\t\t\t\t\t: retval;\n\t\t\t\t},\n\t\t\t\t[],\n\t\t\t)\n\t\t)\n\t\t.then(results => results && results.length > 0 ? sendJsonRes(results) : sendErr(`No contracts originated.`));\n};\n\nexport default originate;\n","import {\n\tgetAccountPrivateKey,\n\tgetAddressOfAlias,\n\tgetCurrentEnvironment,\n\tgetCurrentEnvironmentConfig,\n\tgetDefaultAccount,\n\tgetNetworkConfig,\n\tgetParameter,\n\tgetSandboxAccountConfig,\n\tgetSandboxAccountNames,\n\tgetSandboxConfig,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n} from '@taqueria/node-sdk';\nimport { Environment, RequestArgs } from '@taqueria/node-sdk/types';\nimport { Expr, Parser } from '@taquito/michel-codec';\nimport { importKey, InMemorySigner } from '@taquito/signer';\nimport { TezosToolkit } from '@taquito/taquito';\n\ninterface Opts extends RequestArgs.t {\n\tcontract: string;\n\ttez?: string;\n\tparam?: string;\n\tentrypoint?: string;\n}\n\ntype TableRow = {\n\tcontractAlias: string;\n\tcontractAddress: string;\n\ttezTransfer: string;\n\tparameter: string;\n\tentrypoint: string;\n\tdestination: string;\n};\n\nconst getFirstAccountAlias = (sandboxName: string, opts: Opts) => {\n\tconst aliases = getSandboxAccountNames(opts)(sandboxName);\n\treturn aliases.shift();\n};\n\nconst configureToolKitWithSandbox = (parsedArgs: Opts, sandboxName: string): Promise<TezosToolkit> => {\n\tconst sandbox = getSandboxConfig(parsedArgs)(sandboxName);\n\tif (!sandbox) {\n\t\treturn sendAsyncErr(\n\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);\n\t}\n\n\tlet defaultAccount = getDefaultAccount(parsedArgs)(sandboxName);\n\tif (!defaultAccount) {\n\t\tconst first = getFirstAccountAlias(sandboxName, parsedArgs);\n\t\tif (first) {\n\t\t\tdefaultAccount = getSandboxAccountConfig(parsedArgs)(sandboxName)(first);\n\t\t\tsendErr(\n\t\t\t\t`Warning: A default account has not been specified for sandbox ${sandboxName}. Taqueria will use the account ${first} for this operation.\\nA default account can be specified in .taq/config.json at JSON path: sandbox.${sandboxName}.accounts.default\\n`,\n\t\t\t);\n\t\t}\n\t}\n\tif (!defaultAccount) {\n\t\treturn sendAsyncErr(`No accounts are available for the sandbox called ${sandboxName} to perform the operation.`);\n\t}\n\n\tconst tezos = new TezosToolkit(sandbox.rpcUrl as string);\n\ttezos.setProvider({\n\t\tsigner: new InMemorySigner((defaultAccount.secretKey as string).replace(/^unencrypted:/, '')),\n\t});\n\treturn Promise.resolve(tezos);\n};\n\nconst configureToolKitWithNetwork = async (parsedArgs: Opts, networkName: string): Promise<TezosToolkit> => {\n\tconst network = getNetworkConfig(parsedArgs)(networkName);\n\tif (!network) {\n\t\treturn sendAsyncErr(\n\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);\n\t}\n\n\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\tconst key = await getAccountPrivateKey(parsedArgs, network, 'taqRootAccount');\n\tawait importKey(tezos, key);\n\treturn tezos;\n};\n\nconst configureTezosToolKit = (parsedArgs: Opts, env: Environment.t): Promise<TezosToolkit> => {\n\tconst targetConstraintErrMsg = 'Each environment can only have one target, be it a sandbox or a network';\n\tif (env.sandboxes?.length === 1 && env.networks?.length === 1) return sendAsyncErr(targetConstraintErrMsg);\n\tif (env.sandboxes?.length === 1) return configureToolKitWithSandbox(parsedArgs, env.sandboxes[0]);\n\tif (env.networks?.length === 1) return configureToolKitWithNetwork(parsedArgs, env.networks[0]);\n\treturn sendAsyncErr(targetConstraintErrMsg);\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, tezos: TezosToolkit): Promise<TableRow> => {\n\tconst contract = parsedArgs.contract;\n\treturn {\n\t\tcontractAlias: isContractAddress(contract) ? 'N/A' : contract,\n\t\tcontractAddress: isContractAddress(contract) ? contract : await getAddressOfAlias(env, contract),\n\t\ttezTransfer: parsedArgs.tez ?? '0',\n\t\tparameter: parsedArgs.param ? await getParameter(parsedArgs, parsedArgs.param) : 'Unit',\n\t\tentrypoint: parsedArgs.entrypoint ?? 'default',\n\t\tdestination: tezos.rpc.getRpcUrl(),\n\t};\n};\n\nconst performTransferOp = (tezos: TezosToolkit, contractInfo: TableRow, parsedArgs: Opts): Promise<string> => {\n\treturn tezos.contract\n\t\t.transfer({\n\t\t\tto: contractInfo.contractAddress,\n\t\t\tamount: parseFloat(contractInfo.tezTransfer),\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})\n\t\t.then(op => op.confirmation().then(() => op.hash))\n\t\t.catch(err => {\n\t\t\tif (err instanceof Error) {\n\t\t\t\tif (/empty_implicit_contract/.test(err.message)) {\n\t\t\t\t\tconst result = (err.message).match(/(?<=\"implicit\":\")tz[^\"]+(?=\")/);\n\t\t\t\t\tconst publicKeyHash = result ? result[0] : undefined;\n\t\t\t\t\tif (publicKeyHash) {\n\t\t\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t\t\t`The account ${publicKeyHash} for the target environment, \"${\n\t\t\t\t\t\t\t\tgetCurrentEnvironment(parsedArgs)\n\t\t\t\t\t\t\t}\", 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\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sendAsyncErr(`Error during transfer operation:\\n${err} ${JSON.stringify(err, null, 2)}`);\n\t\t});\n};\n\nexport const transfer = async (parsedArgs: Opts): Promise<void> => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\tif (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);\n\ttry {\n\t\tconst tezos = await configureTezosToolKit(parsedArgs, env);\n\t\tconst contractInfo = await getContractInfo(parsedArgs, env, tezos);\n\t\tawait performTransferOp(tezos, contractInfo, parsedArgs);\n\t\treturn sendJsonRes([contractInfo]);\n\t} catch {\n\t\treturn sendAsyncErr('No operations performed.');\n\t}\n};\n\nexport default transfer;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
1
+ {"mappings":";;;;;;;AAAA;ACAA;ACAA;;;;;AA4CA,MAAM,0CAAoB,GAAG,CAAC,WAAmB,EAAE,IAAU,GAAK;IACjE,MAAM,OAAO,GAAG,CAAA,GAAA,6CAAsB,CAAA,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,AAAC;IAC1D,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;CACvB,AAAC;AAEF,MAAM,wCAAkB,GAAG,CAAC,gBAAwB,EAAE,UAAgB,GACrE,CAAA,GAAA,gBAAI,CAAA,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,IAAI,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,AAAC;AAEpH,MAAM,oCAAc,GAAG,CAAC,UAAgB,EAAE,KAAoC,GAC7E,OAAO,OAA+B,GAAK;QAC1C,MAAM,eAAe,GAAG,wCAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,AAAC;QACzE,MAAM,YAAY,GAAG,MAAM,CAAA,GAAA,0BAAQ,CAAA,CAAC,eAAe,EAAE,OAAO,CAAC,AAAC;QAC9D,OAAO,AAAC,CAAA,MAAM,KAAK,CAAA,CAAE,eAAe,CAAC;YACpC,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,OAAO,CAAC,OAAO;SACrB,CAAC,CAAC;KACH,AAAC;AAEH,MAAM,+CAAyB,GAAG,CAAC,YAAoB,GAAa;IACnE,MAAM,YAAY,GAAG,CAAA,GAAA,oBAAQ,CAAA,CAAC,YAAY,EAAE,CAAA,GAAA,mBAAO,CAAA,CAAC,YAAY,CAAC,CAAC,AAAC;IACnE,MAAM,WAAW,GAAG,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AAC,MAAM,CAAC;wBACb,IAAI,EAAE,OAAO;wBACb,WAAW,EAAE,wDAAwD;wBACrE,QAAQ,EAAE,KAAK;qBACf,CAAC;oBACF,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,SAAS;wBACf,WAAW,EACV,iJAAiJ;wBAClJ,QAAQ,EAAE,KAAK;qBACf,CAAC;iBACF;gBACD,OAAO,EAAE;oBAAC,WAAW;iBAAC;gBACtB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,kBAAkB;aAC5B,CAAC;YACF,CAAA,GAAA,2BAAI,CAAA,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,qBAAqB;gBAC9B,WAAW,EACV,iIAAiI;gBAClI,OAAO,EAAE;oBACR,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,KAAK;wBACX,WAAW,EAAE,2BAA2B;wBACxC,QAAQ,EAAE,KAAK;qBACf,CAAC;oBACF,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,OAAO;wBACb,WAAW,EACV,2JAA2J;wBAC5J,QAAQ,EAAE,KAAK;qBACf,CAAC;oBACF,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,YAAY;wBAClB,WAAW,EACV,8IAA8I;wBAC/I,QAAQ,EAAE,KAAK;qBACf,CAAC;iBACF;gBACD,OAAO,EAAE;oBAAC,MAAM;iBAAC;gBACjB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,kBAAkB;aAC5B,CAAC;SACF;QACD,KAAK,EAAE,CAAA,GAAA,wCAAO,CAAA;KACd,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-taquito/index.ts","taqueria-plugin-taquito/taquito.ts","taqueria-plugin-taquito/originate.ts","taqueria-plugin-taquito/transfer.ts"],"sourcesContent":["import { Option, Plugin, Task } from '@taqueria/node-sdk';\nimport taquito from './taquito';\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],\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: 'tez',\n\t\t\t\t\tdescription: 'Amount of Tez 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],\n\t\t\taliases: ['call'],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t],\n\tproxy: taquito,\n}), process.argv);\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk/types';\nimport originate from './originate';\nimport transfer from './transfer';\n\ninterface Opts extends RequestArgs.ProxyRequestArgs {\n\t// from originate.ts\n\tstorage: string;\n\talias?: string;\n\t// from transfer.ts\n\ttez?: string;\n\tparam?: string;\n\tentrypoint?: string;\n\t// from originate.ts and transfer.ts\n\tcontract: string;\n}\n\nexport const taquito = (parsedArgs: Opts): Promise<void> => {\n\tswitch (parsedArgs.task) {\n\t\tcase 'originate':\n\t\tcase 'deploy':\n\t\t\treturn originate(parsedArgs);\n\t\tcase 'transfer':\n\t\tcase 'call':\n\t\t\treturn transfer(parsedArgs);\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${parsedArgs.task} is not an understood task by the Taquito plugin`);\n\t}\n};\n\nexport default taquito;\n","import {\n\tgetAccountPrivateKey,\n\tgetCurrentEnvironment,\n\tgetCurrentEnvironmentConfig,\n\tgetDefaultAccount,\n\tgetInitialStorage,\n\tgetNetworkConfig,\n\tgetSandboxAccountConfig,\n\tgetSandboxAccountNames,\n\tgetSandboxConfig,\n\tnewGetInitialStorage,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n\tsendRes,\n\tupdateAddressAlias,\n} from '@taqueria/node-sdk';\nimport { Protocol, RequestArgs } from '@taqueria/node-sdk/types';\nimport { OperationContentsAndResultOrigination } from '@taquito/rpc';\nimport { importKey, InMemorySigner } from '@taquito/signer';\nimport { TezosToolkit, WalletOperationBatch } from '@taquito/taquito';\nimport { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';\nimport glob from 'fast-glob';\nimport { readFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\n\ninterface Opts extends RequestArgs.t {\n\tcontract: string;\n\tstorage: string;\n\talias?: string;\n}\n\ninterface ContractStorageMapping {\n\tfilename: string;\n\tstorage?: unknown;\n}\n\ninterface OriginationResult {\n\tcontract: string;\n\taddress: string;\n\talias: string;\n\tdestination: string;\n}\n\nconst getFirstAccountAlias = (sandboxName: string, opts: Opts) => {\n\tconst aliases = getSandboxAccountNames(opts)(sandboxName);\n\treturn aliases.shift();\n};\n\nconst getContractAbspath = (contractFilename: string, parsedArgs: Opts) =>\n\tjoin(parsedArgs.config.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);\n\nconst addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) =>\n\tasync (mapping: ContractStorageMapping) => {\n\t\tconst contractAbspath = getContractAbspath(mapping.filename, parsedArgs);\n\t\tconst contractData = await readFile(contractAbspath, 'utf-8');\n\t\treturn (await batch).withOrigination({\n\t\t\tcode: contractData,\n\t\t\tinit: mapping.storage as any,\n\t\t});\n\t};\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\n// TODO: temporary quick solution. May refactor this to only deal with one contract later\nconst getValidContracts = async (parsedArgs: Opts) => {\n\tconst contracts = [parsedArgs.contract];\n\tconst storageFilename = parsedArgs.storage ?? getDefaultStorageFilename(contracts[0]);\n\n\treturn contracts.reduce(\n\t\tasync (retval, filename) => {\n\t\t\tconst storage = await newGetInitialStorage(parsedArgs, storageFilename);\n\t\t\tif (storage === undefined || storage === null) {\n\t\t\t\tsendErr(\n\t\t\t\t\t`❌ No initial storage file was found for ${filename}\\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\t\t\tgetDefaultStorageFilename(contracts[0])\n\t\t\t\t\t}\" in the artifacts directory\\nYou can also manually pass a storage file to the deploy task using the --storage STORAGE_FILE_NAME option\\n`,\n\t\t\t\t);\n\t\t\t\t// sendErr(\n\t\t\t\t// \t`Michelson artifact ${filename} has no initial storage specified for the target environment.\\nStorage is expected to be specified in .taq/config.json at JSON path: environment.${\n\t\t\t\t// \t\tgetCurrentEnvironment(parsedArgs)\n\t\t\t\t// \t}.storage[\"${filename}\"]\\nThe value of the above JSON key should be the name of the file (absolute path or relative path with respect to the root of the Taqueria project) that contains the actual value of the storage, as a Michelson expression.\\n`,\n\t\t\t\t// );\n\t\t\t\treturn retval;\n\t\t\t}\n\t\t\treturn [...(await retval), { filename, storage }];\n\t\t},\n\t\tPromise.resolve([] as ContractStorageMapping[]),\n\t);\n};\n\nconst mapOpToContract = async (\n\tparsedArgs: Opts,\n\tcontracts: ContractStorageMapping[],\n\top: BatchWalletOperation,\n\tdestination: string,\n) => {\n\tconst results = await op.operationResults();\n\tconst originationResults = results.filter(result => result.kind === 'origination')\n\t\t.map(result => result as OperationContentsAndResultOrigination);\n\n\treturn contracts.reduce(\n\t\t(retval, contract) => {\n\t\t\t// If initial storage was provided for the contract\n\t\t\t// then we submitted an operation to originate that contract\n\t\t\tif (contract.storage) {\n\t\t\t\t// WARNING - using side effect here.\n\t\t\t\t// For each iteration of reduce, results array is being modified-in-place.\n\t\t\t\t// TODO: Adjust to use recursion to avoid side-effect.\n\t\t\t\tconst result = originationResults.shift();\n\t\t\t\tconst address = result && result.metadata.operation_result.originated_contracts\n\t\t\t\t\t? result.metadata.operation_result.originated_contracts.join(',')\n\t\t\t\t\t: 'Error';\n\n\t\t\t\tconst alias = parsedArgs.alias ?? basename(contract.filename, extname(contract.filename));\n\t\t\t\tif (address !== 'Error') updateAddressAlias(parsedArgs, alias, address);\n\n\t\t\t\treturn [\n\t\t\t\t\t...retval,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontract: contract.filename,\n\t\t\t\t\t\taddress,\n\t\t\t\t\t\talias: address !== 'Error' ? alias : 'N/A',\n\t\t\t\t\t\tdestination,\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t...retval,\n\t\t\t\t{\n\t\t\t\t\tcontract: contract.filename,\n\t\t\t\t\taddress: 'Error',\n\t\t\t\t\talias: 'N/A',\n\t\t\t\t\tdestination,\n\t\t\t\t},\n\t\t\t];\n\t\t},\n\t\t[] as OriginationResult[],\n\t);\n};\n\nconst createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: string) => {\n\tconst contracts = await getValidContracts(parsedArgs);\n\tif (!contracts.length) {\n\t\treturn undefined;\n\t}\n\n\tconst batch = await contracts.reduce(\n\t\t(batch, contractMapping) =>\n\t\t\tcontractMapping.storage\n\t\t\t\t? addOrigination(parsedArgs, batch)(contractMapping)\n\t\t\t\t: batch,\n\t\tPromise.resolve(tezos.wallet.batch()),\n\t);\n\n\ttry {\n\t\tconst op = await batch.send();\n\t\tconst confirmed = await op.confirmation();\n\t\treturn await mapOpToContract(parsedArgs, contracts, op, destination);\n\t} catch (err) {\n\t\tconst error = (err as { message: string });\n\t\tif (error.message) {\n\t\t\tconst msg = error.message;\n\t\t\tif (/ENOTFOUND/.test(msg)) {\n\t\t\t\tsendErr(msg + ' - The RPC URL may be invalid. Check ./taq/config.json.\\n');\n\t\t\t} else if (/ECONNREFUSED/.test(msg)) {\n\t\t\t\tsendErr(msg + ' - The RPC URL may be down or the sandbox is not running.');\n\t\t\t} else if (/empty_implicit_contract/.test(msg)) {\n\t\t\t\tconst result = msg.match(/(?<=\"implicit\":\")tz[^\"]+(?=\")/);\n\t\t\t\tconst publicKeyHash = result ? result[0] : undefined;\n\t\t\t\tif (!publicKeyHash) sendErr(msg);\n\t\t\t\telse {\n\t\t\t\t\tsendErr(\n\t\t\t\t\t\t`The account ${publicKeyHash} for the target environment, \"${\n\t\t\t\t\t\t\tgetCurrentEnvironment(parsedArgs)\n\t\t\t\t\t\t}\", 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\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsendErr(\n\t\t\t\t\tmsg\n\t\t\t\t\t\t+ \" - There was a problem communicating with the chain. Check the RPC URL of the network or sandbox you're targeting in config.json.\\n\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n};\n\n/**\n * @description Import a key to sign operation with the side-effect of setting the Tezos instance to use the InMemorySigner provider\n *\n * @param toolkit The toolkit instance to attach a signer\n * @param privateKeyOrEmail Key to load in memory\n * @param passphrase If the key is encrypted passphrase to decrypt it\n * @param mnemonic Faucet mnemonic\n * @param secret Faucet secret\n */\nexport async function importFaucet(\n\ttoolkit: TezosToolkit,\n\tprivateKeyOrEmail?: string,\n\tpassphrase?: string,\n\tmnemonic?: string,\n\tsecret?: string,\n) {\n\tif (privateKeyOrEmail && passphrase && mnemonic && secret) {\n\t\treturn await importKey(toolkit, privateKeyOrEmail, passphrase, mnemonic, secret);\n\t} else if (mnemonic) {\n\t\tconst signer = InMemorySigner.fromFundraiser(privateKeyOrEmail ?? '', passphrase ?? '', mnemonic);\n\t\ttoolkit.setProvider({ signer });\n\t\tconst pkh = await signer.publicKeyHash();\n\t\tlet op;\n\t\ttry {\n\t\t\top = await toolkit.tz.activate(pkh, secret ?? '');\n\t\t\tif (op) {\n\t\t\t\tawait op.confirmation();\n\t\t\t}\n\t\t} catch (ex: any) {\n\t\t}\n\t} else if (privateKeyOrEmail) {\n\t\t// Fallback to regular import\n\t\tconst signer = await InMemorySigner.fromSecretKey(privateKeyOrEmail, passphrase);\n\t\ttoolkit.setProvider({ signer });\n\t}\n}\n\nconst originateToNetworks = (parsedArgs: Opts, currentEnv: Protocol.Environment.t) =>\n\tcurrentEnv.networks\n\t\t? currentEnv.networks.reduce(\n\t\t\t(retval, networkName) => {\n\t\t\t\tconst network = getNetworkConfig(parsedArgs)(networkName);\n\t\t\t\tif (network) {\n\t\t\t\t\tif (network.rpcUrl) {\n\t\t\t\t\t\tconst result = (async () => {\n\t\t\t\t\t\t\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\t\t\t\t\t\t\tconst key = await getAccountPrivateKey(parsedArgs, network, 'taqRootAccount');\n\t\t\t\t\t\t\tawait importKey(tezos, key);\n\t\t\t\t\t\t\treturn await createBatch(parsedArgs, tezos, networkName);\n\t\t\t\t\t\t})();\n\n\t\t\t\t\t\treturn [...retval, result];\n\t\t\t\t\t} else sendErr(`Network \"${networkName}\" is missing an RPC url in config.json.`);\n\t\t\t\t} else {\n\t\t\t\t\tsendErr(\n\t\t\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\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn retval;\n\t\t\t},\n\t\t\t[] as Promise<OriginationResult[] | undefined>[],\n\t\t)\n\t\t: [];\n\nconst originateToSandboxes = (parsedArgs: Opts, currentEnv: Protocol.Environment.t) =>\n\tcurrentEnv.sandboxes\n\t\t? currentEnv.sandboxes.reduce(\n\t\t\t(retval, sandboxName) => {\n\t\t\t\tconst sandbox = getSandboxConfig(parsedArgs)(sandboxName);\n\t\t\t\tif (sandbox) {\n\t\t\t\t\tif (sandbox.rpcUrl) {\n\t\t\t\t\t\tlet defaultAccount = getDefaultAccount(parsedArgs)(sandboxName);\n\t\t\t\t\t\tif (!defaultAccount) {\n\t\t\t\t\t\t\tconst first = getFirstAccountAlias(sandboxName, parsedArgs);\n\t\t\t\t\t\t\tif (first) {\n\t\t\t\t\t\t\t\tdefaultAccount = getSandboxAccountConfig(parsedArgs)(sandboxName)(first);\n\t\t\t\t\t\t\t\t// TODO: The error should be a warning, not an error. Descriptive string should not begin with 'Warning:'\n\t\t\t\t\t\t\t\tsendErr(\n\t\t\t\t\t\t\t\t\t`Warning: A default origination account has not been specified for sandbox ${sandboxName}. Taqueria will use the account ${first} for this origination.\\nA default account can be specified in .taq/config.json at JSON path: sandbox.${sandboxName}.accounts.default\\n`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (defaultAccount) {\n\t\t\t\t\t\t\tconst secretKey = defaultAccount.secretKey;\n\t\t\t\t\t\t\tconst result = (async () => {\n\t\t\t\t\t\t\t\tconst tezos = new TezosToolkit(sandbox.rpcUrl as string);\n\t\t\t\t\t\t\t\ttezos.setProvider({\n\t\t\t\t\t\t\t\t\tsigner: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn await createBatch(parsedArgs, tezos, sandboxName);\n\t\t\t\t\t\t\t})();\n\n\t\t\t\t\t\t\treturn [...retval, result];\n\t\t\t\t\t\t} else sendErr(`No accounts are available for the sandbox called ${sandboxName} to perform origination.`);\n\t\t\t\t\t} else sendErr(`Sandbox \"${sandboxName} is missing an RPC url in config.json.\"`);\n\t\t\t\t} else {\n\t\t\t\t\tsendErr(\n\t\t\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\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn retval;\n\t\t\t},\n\t\t\t[] as Promise<OriginationResult[] | undefined>[],\n\t\t)\n\t\t: [];\n\nexport const originate = <T>(parsedArgs: Opts) => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\n\tif (!env) {\n\t\treturn sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);\n\t}\n\n\tconst jobs = [\n\t\t...originateToNetworks(parsedArgs, env),\n\t\t...originateToSandboxes(parsedArgs, env),\n\t];\n\n\treturn Promise.all(jobs)\n\t\t.then(jobs =>\n\t\t\tjobs.reduce(\n\t\t\t\t(retval, originations) => {\n\t\t\t\t\treturn originations\n\t\t\t\t\t\t? [...retval as OriginationResult[], ...originations]\n\t\t\t\t\t\t: retval;\n\t\t\t\t},\n\t\t\t\t[],\n\t\t\t)\n\t\t)\n\t\t.then(results => results && results.length > 0 ? sendJsonRes(results) : sendErr(`No contracts originated.`));\n};\n\nexport default originate;\n","import {\n\tgetAccountPrivateKey,\n\tgetAddressOfAlias,\n\tgetCurrentEnvironment,\n\tgetCurrentEnvironmentConfig,\n\tgetDefaultAccount,\n\tgetNetworkConfig,\n\tgetParameter,\n\tgetSandboxAccountConfig,\n\tgetSandboxAccountNames,\n\tgetSandboxConfig,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n} from '@taqueria/node-sdk';\nimport { Environment, RequestArgs } from '@taqueria/node-sdk/types';\nimport { Expr, Parser } from '@taquito/michel-codec';\nimport { importKey, InMemorySigner } from '@taquito/signer';\nimport { TezosToolkit } from '@taquito/taquito';\n\ninterface Opts extends RequestArgs.t {\n\tcontract: string;\n\ttez?: string;\n\tparam?: string;\n\tentrypoint?: string;\n}\n\ntype TableRow = {\n\tcontractAlias: string;\n\tcontractAddress: string;\n\ttezTransfer: string;\n\tparameter: string;\n\tentrypoint: string;\n\tdestination: string;\n};\n\nconst getFirstAccountAlias = (sandboxName: string, opts: Opts) => {\n\tconst aliases = getSandboxAccountNames(opts)(sandboxName);\n\treturn aliases.shift();\n};\n\nconst configureToolKitWithSandbox = async (parsedArgs: Opts, sandboxName: string): Promise<TezosToolkit> => {\n\tconst sandbox = getSandboxConfig(parsedArgs)(sandboxName);\n\tif (!sandbox) {\n\t\treturn sendAsyncErr(\n\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);\n\t}\n\n\tlet defaultAccount = getDefaultAccount(parsedArgs)(sandboxName);\n\tif (!defaultAccount) {\n\t\tconst first = getFirstAccountAlias(sandboxName, parsedArgs);\n\t\tif (first) {\n\t\t\tdefaultAccount = getSandboxAccountConfig(parsedArgs)(sandboxName)(first);\n\t\t\tsendErr(\n\t\t\t\t`Warning: A default account has not been specified for sandbox ${sandboxName}. Taqueria will use the account ${first} for this operation.\\nA default account can be specified in .taq/config.json at JSON path: sandbox.${sandboxName}.accounts.default\\n`,\n\t\t\t);\n\t\t}\n\t}\n\tif (!defaultAccount) {\n\t\treturn sendAsyncErr(`No accounts are available for the sandbox called ${sandboxName} to perform the operation.`);\n\t}\n\n\tconst tezos = new TezosToolkit(sandbox.rpcUrl as string);\n\ttezos.setProvider({\n\t\tsigner: new InMemorySigner((defaultAccount.secretKey as string).replace(/^unencrypted:/, '')),\n\t});\n\treturn tezos;\n};\n\nconst configureToolKitWithNetwork = async (parsedArgs: Opts, networkName: string): Promise<TezosToolkit> => {\n\tconst network = getNetworkConfig(parsedArgs)(networkName);\n\tif (!network) {\n\t\treturn sendAsyncErr(\n\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);\n\t}\n\n\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\tconst key = await getAccountPrivateKey(parsedArgs, network, 'taqRootAccount');\n\tawait importKey(tezos, key);\n\treturn tezos;\n};\n\nconst configureTezosToolKit = (parsedArgs: Opts, env: Environment.t): Promise<TezosToolkit> => {\n\tconst targetConstraintErrMsg = 'Each environment can only have one target, be it a sandbox or a network';\n\tif (env.sandboxes?.length === 1 && env.networks?.length === 1) return sendAsyncErr(targetConstraintErrMsg);\n\tif (env.sandboxes?.length === 1) return configureToolKitWithSandbox(parsedArgs, env.sandboxes[0]);\n\tif (env.networks?.length === 1) return configureToolKitWithNetwork(parsedArgs, env.networks[0]);\n\treturn sendAsyncErr(targetConstraintErrMsg);\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, tezos: TezosToolkit): Promise<TableRow> => {\n\tconst contract = parsedArgs.contract;\n\treturn {\n\t\tcontractAlias: isContractAddress(contract) ? 'N/A' : contract,\n\t\tcontractAddress: isContractAddress(contract) ? contract : await getAddressOfAlias(env, contract),\n\t\ttezTransfer: parsedArgs.tez ?? '0',\n\t\tparameter: parsedArgs.param ? await getParameter(parsedArgs, parsedArgs.param) : 'Unit',\n\t\tentrypoint: parsedArgs.entrypoint ?? 'default',\n\t\tdestination: tezos.rpc.getRpcUrl(),\n\t};\n};\n\nconst performTransferOp = (tezos: TezosToolkit, contractInfo: TableRow, parsedArgs: Opts): Promise<string> => {\n\treturn tezos.contract\n\t\t.transfer({\n\t\t\tto: contractInfo.contractAddress,\n\t\t\tamount: parseFloat(contractInfo.tezTransfer),\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})\n\t\t.then(op => op.confirmation().then(() => op.hash))\n\t\t.catch(err => {\n\t\t\tif (err instanceof Error) {\n\t\t\t\tif (/empty_implicit_contract/.test(err.message)) {\n\t\t\t\t\tconst result = (err.message).match(/(?<=\"implicit\":\")tz[^\"]+(?=\")/);\n\t\t\t\t\tconst publicKeyHash = result ? result[0] : undefined;\n\t\t\t\t\tif (publicKeyHash) {\n\t\t\t\t\t\treturn sendAsyncErr(\n\t\t\t\t\t\t\t`The account ${publicKeyHash} for the target environment, \"${\n\t\t\t\t\t\t\t\tgetCurrentEnvironment(parsedArgs)\n\t\t\t\t\t\t\t}\", 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\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sendAsyncErr(`Error during transfer operation:\\n${err} ${JSON.stringify(err, null, 2)}`);\n\t\t});\n};\n\nexport const transfer = async (parsedArgs: Opts): Promise<void> => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\tif (!env) return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);\n\ttry {\n\t\tconst tezos = await configureTezosToolKit(parsedArgs, env);\n\t\tconst contractInfo = await getContractInfo(parsedArgs, env, tezos);\n\t\tawait performTransferOp(tezos, contractInfo, parsedArgs);\n\t\treturn sendJsonRes([contractInfo]);\n\t} catch {\n\t\treturn sendAsyncErr('No operations performed.');\n\t}\n};\n\nexport default transfer;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
package/originate.ts CHANGED
@@ -168,11 +168,9 @@ const createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: s
168
168
  if (error.message) {
169
169
  const msg = error.message;
170
170
  if (/ENOTFOUND/.test(msg)) {
171
- sendErr('The RPC URL may be invalid. Check your ./.taq/config.json.\n');
172
- sendErr(msg);
171
+ sendErr(msg + ' - The RPC URL may be invalid. Check ./taq/config.json.\n');
173
172
  } else if (/ECONNREFUSED/.test(msg)) {
174
- sendErr('The RPC URL may be down or the sandbox is not running.\n');
175
- sendErr(msg);
173
+ sendErr(msg + ' - The RPC URL may be down or the sandbox is not running.');
176
174
  } else if (/empty_implicit_contract/.test(msg)) {
177
175
  const result = msg.match(/(?<="implicit":")tz[^"]+(?=")/);
178
176
  const publicKeyHash = result ? result[0] : undefined;
@@ -186,9 +184,9 @@ const createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: s
186
184
  }
187
185
  } else {
188
186
  sendErr(
189
- "There was a problem communicating with the chain. Please check the RPC URL of the network or sandbox you're targeting.\n",
187
+ msg
188
+ + " - There was a problem communicating with the chain. Check the RPC URL of the network or sandbox you're targeting in config.json.\n",
190
189
  );
191
- sendErr(msg);
192
190
  }
193
191
  }
194
192
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-taquito",
3
- "version": "0.21.11",
3
+ "version": "0.21.13",
4
4
  "description": "A taqueria plugin for originating smart contracts using Taquito",
5
5
  "targets": {
6
6
  "default": {
@@ -46,7 +46,7 @@
46
46
  "typescript": "^4.7.2"
47
47
  },
48
48
  "dependencies": {
49
- "@taqueria/node-sdk": "^0.21.11",
49
+ "@taqueria/node-sdk": "^0.21.13",
50
50
  "@taquito/michel-codec": "^13.0.1",
51
51
  "@taquito/signer": "^13.0.1",
52
52
  "@taquito/taquito": "^13.0.1",
package/transfer.ts CHANGED
@@ -39,7 +39,7 @@ const getFirstAccountAlias = (sandboxName: string, opts: Opts) => {
39
39
  return aliases.shift();
40
40
  };
41
41
 
42
- const configureToolKitWithSandbox = (parsedArgs: Opts, sandboxName: string): Promise<TezosToolkit> => {
42
+ const configureToolKitWithSandbox = async (parsedArgs: Opts, sandboxName: string): Promise<TezosToolkit> => {
43
43
  const sandbox = getSandboxConfig(parsedArgs)(sandboxName);
44
44
  if (!sandbox) {
45
45
  return sendAsyncErr(
@@ -65,7 +65,7 @@ const configureToolKitWithSandbox = (parsedArgs: Opts, sandboxName: string): Pro
65
65
  tezos.setProvider({
66
66
  signer: new InMemorySigner((defaultAccount.secretKey as string).replace(/^unencrypted:/, '')),
67
67
  });
68
- return Promise.resolve(tezos);
68
+ return tezos;
69
69
  };
70
70
 
71
71
  const configureToolKitWithNetwork = async (parsedArgs: Opts, networkName: string): Promise<TezosToolkit> => {