@taqueria/plugin-taquito 0.19.3 → 0.19.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -37
- package/index.js.map +1 -1
- package/index.ts +1 -2
- package/originate.ts +5 -49
- package/package.json +2 -2
- package/transfer.ts +1 -1
package/index.js
CHANGED
|
@@ -103,44 +103,13 @@ const $806c5c6032403442$var$createBatch = async (parsedArgs, tezos, destination)
|
|
|
103
103
|
const error = err;
|
|
104
104
|
if (error.message) {
|
|
105
105
|
const msg = error.message;
|
|
106
|
-
if (/ENOTFOUND/.test(msg))
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} else if (/ECONNREFUSED/.test(msg)) {
|
|
110
|
-
(0, $iVZbm$taquerianodesdk.sendErr)("The RPC URL may be down or the sandbox is not running.\n");
|
|
111
|
-
(0, $iVZbm$taquerianodesdk.sendErr)(msg);
|
|
112
|
-
} else if (/empty_implicit_contract/.test(msg)) {
|
|
113
|
-
(0, $iVZbm$taquerianodesdk.sendErr)("Your account does not have sufficient funds to perform this operation. If targeting a testnet you may get funds from a faucet at https://teztnets.xyz/.\n");
|
|
114
|
-
(0, $iVZbm$taquerianodesdk.sendErr)(msg);
|
|
115
|
-
} else {
|
|
116
|
-
(0, $iVZbm$taquerianodesdk.sendErr)("There was a problem communicating with the chain. Perhaps review your RPC URL of the network or sandbox you're targeting.\n");
|
|
117
|
-
(0, $iVZbm$taquerianodesdk.sendErr)(msg);
|
|
118
|
-
}
|
|
106
|
+
if (/ENOTFOUND/.test(msg)) (0, $iVZbm$taquerianodesdk.sendErr)(msg + " - The RPC URL may be invalid. Check your ./taq/config.json.");
|
|
107
|
+
else if (/ECONNREFUSED/.test(msg)) (0, $iVZbm$taquerianodesdk.sendErr)(msg + " - The RPC URL may be down or the sandbox is not running.");
|
|
108
|
+
else (0, $iVZbm$taquerianodesdk.sendErr)(msg + " - There was a problem communicating with the chain. Perhaps review your RPC URL of the network or sandbox you're targeting.");
|
|
119
109
|
}
|
|
120
110
|
return undefined;
|
|
121
111
|
}
|
|
122
112
|
};
|
|
123
|
-
async function $806c5c6032403442$export$e4c4fcd791db1d6b(toolkit, privateKeyOrEmail, passphrase, mnemonic, secret) {
|
|
124
|
-
if (privateKeyOrEmail && passphrase && mnemonic && secret) return await (0, $iVZbm$taquitosigner.importKey)(toolkit, privateKeyOrEmail, passphrase, mnemonic, secret);
|
|
125
|
-
else if (mnemonic) {
|
|
126
|
-
const signer = (0, $iVZbm$taquitosigner.InMemorySigner).fromFundraiser(privateKeyOrEmail ?? "", passphrase ?? "", mnemonic);
|
|
127
|
-
toolkit.setProvider({
|
|
128
|
-
signer: signer
|
|
129
|
-
});
|
|
130
|
-
const pkh = await signer.publicKeyHash();
|
|
131
|
-
let op;
|
|
132
|
-
try {
|
|
133
|
-
op = await toolkit.tz.activate(pkh, secret ?? "");
|
|
134
|
-
if (op) await op.confirmation();
|
|
135
|
-
} catch (ex) {}
|
|
136
|
-
} else if (privateKeyOrEmail) {
|
|
137
|
-
// Fallback to regular import
|
|
138
|
-
const signer = await (0, $iVZbm$taquitosigner.InMemorySigner).fromSecretKey(privateKeyOrEmail, passphrase);
|
|
139
|
-
toolkit.setProvider({
|
|
140
|
-
signer: signer
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
113
|
const $806c5c6032403442$var$originateToNetworks = (parsedArgs, currentEnv)=>currentEnv.networks ? currentEnv.networks.reduce((retval, networkName)=>{
|
|
145
114
|
const network = (0, $iVZbm$taquerianodesdk.getNetworkConfig)(parsedArgs)(networkName);
|
|
146
115
|
if (network) {
|
|
@@ -148,7 +117,7 @@ const $806c5c6032403442$var$originateToNetworks = (parsedArgs, currentEnv)=>curr
|
|
|
148
117
|
if (network.faucet) {
|
|
149
118
|
const result = (async ()=>{
|
|
150
119
|
const tezos = new (0, $iVZbm$taquitotaquito.TezosToolkit)(network.rpcUrl);
|
|
151
|
-
await $
|
|
120
|
+
await (0, $iVZbm$taquitosigner.importKey)(tezos, network.faucet.email, network.faucet.password, network.faucet.mnemonic.join(" "), network.faucet.activation_code);
|
|
152
121
|
return await $806c5c6032403442$var$createBatch(parsedArgs, tezos, networkName);
|
|
153
122
|
})();
|
|
154
123
|
return [
|
|
@@ -240,7 +209,7 @@ const $944e64d99e99b46e$var$configureToolKitWithNetwork = async (parsedArgs, net
|
|
|
240
209
|
const faucet = network.faucet;
|
|
241
210
|
if (!faucet) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`Network ${networkName} requires a valid faucet in config.json.`);
|
|
242
211
|
const tezos = new (0, $iVZbm$taquitotaquito.TezosToolkit)(network.rpcUrl);
|
|
243
|
-
await (0, $iVZbm$taquitosigner.importKey)(tezos, network.faucet.email
|
|
212
|
+
await (0, $iVZbm$taquitosigner.importKey)(tezos, network.faucet.email, network.faucet.password, network.faucet.mnemonic.join(" "), network.faucet.activation_code);
|
|
244
213
|
return tezos;
|
|
245
214
|
};
|
|
246
215
|
const $944e64d99e99b46e$var$configureTezosToolKit = (parsedArgs, env)=>{
|
|
@@ -343,7 +312,7 @@ var $e6ed693f861ac256$export$2e2bcd8739ae039 = $e6ed693f861ac256$export$71d25adf
|
|
|
343
312
|
}),
|
|
344
313
|
(0, $iVZbm$taquerianodesdk.Option).create({
|
|
345
314
|
flag: "param",
|
|
346
|
-
description: "
|
|
315
|
+
description: "Parameter to invoke the smart contract",
|
|
347
316
|
required: false
|
|
348
317
|
}),
|
|
349
318
|
(0, $iVZbm$taquerianodesdk.Option).create({
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA;ACAA;ACAA;;;;;AA2CA,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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C5J,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\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\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 = results.shift() as OperationContentsAndResultOrigination;\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\tsendErr(\n\t\t\t\t\t'Your account does not have sufficient funds to perform this operation. If targeting a testnet you may get funds from a faucet at https://teztnets.xyz/.\\n',\n\t\t\t\t);\n\t\t\t\tsendErr(msg);\n\t\t\t} else {\n\t\t\t\tsendErr(\n\t\t\t\t\t\"There was a problem communicating with the chain. Perhaps review your 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\tif (network.faucet) {\n\t\t\t\t\t\t\tconst result = (async () => {\n\t\t\t\t\t\t\t\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\t\t\t\t\t\t\t\tawait importFaucet(\n\t\t\t\t\t\t\t\t\ttezos,\n\t\t\t\t\t\t\t\t\tnetwork.faucet.email,\n\t\t\t\t\t\t\t\t\tnetwork.faucet.password,\n\t\t\t\t\t\t\t\t\tnetwork.faucet.mnemonic.join(' '),\n\t\t\t\t\t\t\t\t\tnetwork.faucet.activation_code,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn await createBatch(parsedArgs, tezos, networkName);\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(`Network ${networkName} requires a valid faucet in config.json.`);\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\tgetAddressOfAlias,\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 faucet = network.faucet;\n\tif (!faucet) return sendAsyncErr(`Network ${networkName} requires a valid faucet in config.json.`);\n\n\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\tawait importKey(\n\t\ttezos,\n\t\tnetwork.faucet.email ?? '',\n\t\tnetwork.faucet.password,\n\t\tnetwork.faucet.mnemonic.join(' '),\n\t\tnetwork.faucet.activation_code,\n\t);\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): 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 => sendAsyncErr(`Error during transfer operation:\\n${err} ${JSON.stringify(err, null, 2)}`));\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);\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;;;;;AA2CA,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,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ChB,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,EAAE,wCAAwC;wBACrD,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: 'Parameter to invoke the smart 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\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\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 = results.shift() as OperationContentsAndResultOrigination;\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 your ./taq/config.json.');\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 {\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. Perhaps review your RPC URL of the network or sandbox you're targeting.\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\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\tif (network.faucet) {\n\t\t\t\t\t\t\tconst result = (async () => {\n\t\t\t\t\t\t\t\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\t\t\t\t\t\t\t\tawait importKey(\n\t\t\t\t\t\t\t\t\ttezos,\n\t\t\t\t\t\t\t\t\tnetwork.faucet.email,\n\t\t\t\t\t\t\t\t\tnetwork.faucet.password,\n\t\t\t\t\t\t\t\t\tnetwork.faucet.mnemonic.join(' '),\n\t\t\t\t\t\t\t\t\tnetwork.faucet.activation_code,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn await createBatch(parsedArgs, tezos, networkName);\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(`Network ${networkName} requires a valid faucet in config.json.`);\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\tgetAddressOfAlias,\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 faucet = network.faucet;\n\tif (!faucet) return sendAsyncErr(`Network ${networkName} requires a valid faucet in config.json.`);\n\n\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\tawait importKey(\n\t\ttezos,\n\t\tnetwork.faucet.email,\n\t\tnetwork.faucet.password,\n\t\tnetwork.faucet.mnemonic.join(' '),\n\t\tnetwork.faucet.activation_code,\n\t);\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): 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 => sendAsyncErr(`Error during transfer operation:\\n${err} ${JSON.stringify(err, null, 2)}`));\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);\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/index.ts
CHANGED
|
@@ -40,8 +40,7 @@ Plugin.create(_i18n => ({
|
|
|
40
40
|
}),
|
|
41
41
|
Option.create({
|
|
42
42
|
flag: 'param',
|
|
43
|
-
description:
|
|
44
|
-
'Name of the parameter file that contains the parameter value as a Michelson expression, in the artifacts directory, used for invoking a deployed contract',
|
|
43
|
+
description: 'Parameter to invoke the smart contract',
|
|
45
44
|
required: false,
|
|
46
45
|
}),
|
|
47
46
|
Option.create({
|
package/originate.ts
CHANGED
|
@@ -165,64 +165,20 @@ const createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: s
|
|
|
165
165
|
if (error.message) {
|
|
166
166
|
const msg = error.message;
|
|
167
167
|
if (/ENOTFOUND/.test(msg)) {
|
|
168
|
-
sendErr('The RPC URL may be invalid. Check your ./taq/config.json
|
|
169
|
-
sendErr(msg);
|
|
168
|
+
sendErr(msg + ' - The RPC URL may be invalid. Check your ./taq/config.json.');
|
|
170
169
|
} else if (/ECONNREFUSED/.test(msg)) {
|
|
171
|
-
sendErr('The RPC URL may be down or the sandbox is not running
|
|
172
|
-
sendErr(msg);
|
|
173
|
-
} else if (/empty_implicit_contract/.test(msg)) {
|
|
174
|
-
sendErr(
|
|
175
|
-
'Your account does not have sufficient funds to perform this operation. If targeting a testnet you may get funds from a faucet at https://teztnets.xyz/.\n',
|
|
176
|
-
);
|
|
177
|
-
sendErr(msg);
|
|
170
|
+
sendErr(msg + ' - The RPC URL may be down or the sandbox is not running.');
|
|
178
171
|
} else {
|
|
179
172
|
sendErr(
|
|
180
|
-
|
|
173
|
+
msg
|
|
174
|
+
+ " - There was a problem communicating with the chain. Perhaps review your RPC URL of the network or sandbox you're targeting.",
|
|
181
175
|
);
|
|
182
|
-
sendErr(msg);
|
|
183
176
|
}
|
|
184
177
|
}
|
|
185
178
|
return undefined;
|
|
186
179
|
}
|
|
187
180
|
};
|
|
188
181
|
|
|
189
|
-
/**
|
|
190
|
-
* @description Import a key to sign operation with the side-effect of setting the Tezos instance to use the InMemorySigner provider
|
|
191
|
-
*
|
|
192
|
-
* @param toolkit The toolkit instance to attach a signer
|
|
193
|
-
* @param privateKeyOrEmail Key to load in memory
|
|
194
|
-
* @param passphrase If the key is encrypted passphrase to decrypt it
|
|
195
|
-
* @param mnemonic Faucet mnemonic
|
|
196
|
-
* @param secret Faucet secret
|
|
197
|
-
*/
|
|
198
|
-
export async function importFaucet(
|
|
199
|
-
toolkit: TezosToolkit,
|
|
200
|
-
privateKeyOrEmail?: string,
|
|
201
|
-
passphrase?: string,
|
|
202
|
-
mnemonic?: string,
|
|
203
|
-
secret?: string,
|
|
204
|
-
) {
|
|
205
|
-
if (privateKeyOrEmail && passphrase && mnemonic && secret) {
|
|
206
|
-
return await importKey(toolkit, privateKeyOrEmail, passphrase, mnemonic, secret);
|
|
207
|
-
} else if (mnemonic) {
|
|
208
|
-
const signer = InMemorySigner.fromFundraiser(privateKeyOrEmail ?? '', passphrase ?? '', mnemonic);
|
|
209
|
-
toolkit.setProvider({ signer });
|
|
210
|
-
const pkh = await signer.publicKeyHash();
|
|
211
|
-
let op;
|
|
212
|
-
try {
|
|
213
|
-
op = await toolkit.tz.activate(pkh, secret ?? '');
|
|
214
|
-
if (op) {
|
|
215
|
-
await op.confirmation();
|
|
216
|
-
}
|
|
217
|
-
} catch (ex: any) {
|
|
218
|
-
}
|
|
219
|
-
} else if (privateKeyOrEmail) {
|
|
220
|
-
// Fallback to regular import
|
|
221
|
-
const signer = await InMemorySigner.fromSecretKey(privateKeyOrEmail, passphrase);
|
|
222
|
-
toolkit.setProvider({ signer });
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
182
|
const originateToNetworks = (parsedArgs: Opts, currentEnv: Protocol.Environment.t) =>
|
|
227
183
|
currentEnv.networks
|
|
228
184
|
? currentEnv.networks.reduce(
|
|
@@ -233,7 +189,7 @@ const originateToNetworks = (parsedArgs: Opts, currentEnv: Protocol.Environment.
|
|
|
233
189
|
if (network.faucet) {
|
|
234
190
|
const result = (async () => {
|
|
235
191
|
const tezos = new TezosToolkit(network.rpcUrl as string);
|
|
236
|
-
await
|
|
192
|
+
await importKey(
|
|
237
193
|
tezos,
|
|
238
194
|
network.faucet.email,
|
|
239
195
|
network.faucet.password,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-taquito",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.4",
|
|
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.19.
|
|
49
|
+
"@taqueria/node-sdk": "^0.19.4",
|
|
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
|
@@ -80,7 +80,7 @@ const configureToolKitWithNetwork = async (parsedArgs: Opts, networkName: string
|
|
|
80
80
|
const tezos = new TezosToolkit(network.rpcUrl as string);
|
|
81
81
|
await importKey(
|
|
82
82
|
tezos,
|
|
83
|
-
network.faucet.email
|
|
83
|
+
network.faucet.email,
|
|
84
84
|
network.faucet.password,
|
|
85
85
|
network.faucet.mnemonic.join(' '),
|
|
86
86
|
network.faucet.activation_code,
|