@taqueria/plugin-taquito 0.20.2 → 0.21.11
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 +35 -25
- package/index.js.map +1 -1
- package/originate.ts +24 -22
- package/package.json +2 -2
- package/transfer.ts +24 -15
package/index.js
CHANGED
|
@@ -59,6 +59,7 @@ const $806c5c6032403442$var$getValidContracts = async (parsedArgs)=>{
|
|
|
59
59
|
};
|
|
60
60
|
const $806c5c6032403442$var$mapOpToContract = async (parsedArgs, contracts, op, destination)=>{
|
|
61
61
|
const results = await op.operationResults();
|
|
62
|
+
const originationResults = results.filter((result)=>result.kind === "origination").map((result)=>result);
|
|
62
63
|
return contracts.reduce((retval, contract)=>{
|
|
63
64
|
// If initial storage was provided for the contract
|
|
64
65
|
// then we submitted an operation to originate that contract
|
|
@@ -66,7 +67,7 @@ const $806c5c6032403442$var$mapOpToContract = async (parsedArgs, contracts, op,
|
|
|
66
67
|
// WARNING - using side effect here.
|
|
67
68
|
// For each iteration of reduce, results array is being modified-in-place.
|
|
68
69
|
// TODO: Adjust to use recursion to avoid side-effect.
|
|
69
|
-
const result =
|
|
70
|
+
const result = originationResults.shift();
|
|
70
71
|
const address = result && result.metadata.operation_result.originated_contracts ? result.metadata.operation_result.originated_contracts.join(",") : "Error";
|
|
71
72
|
const alias = parsedArgs.alias ?? (0, $iVZbm$path.basename)(contract.filename, (0, $iVZbm$path.extname)(contract.filename));
|
|
72
73
|
if (address !== "Error") (0, $iVZbm$taquerianodesdk.updateAddressAlias)(parsedArgs, alias, address);
|
|
@@ -104,16 +105,18 @@ const $806c5c6032403442$var$createBatch = async (parsedArgs, tezos, destination)
|
|
|
104
105
|
if (error.message) {
|
|
105
106
|
const msg = error.message;
|
|
106
107
|
if (/ENOTFOUND/.test(msg)) {
|
|
107
|
-
(0, $iVZbm$taquerianodesdk.sendErr)("The RPC URL may be invalid. Check your
|
|
108
|
+
(0, $iVZbm$taquerianodesdk.sendErr)("The RPC URL may be invalid. Check your ./.taq/config.json.\n");
|
|
108
109
|
(0, $iVZbm$taquerianodesdk.sendErr)(msg);
|
|
109
110
|
} else if (/ECONNREFUSED/.test(msg)) {
|
|
110
111
|
(0, $iVZbm$taquerianodesdk.sendErr)("The RPC URL may be down or the sandbox is not running.\n");
|
|
111
112
|
(0, $iVZbm$taquerianodesdk.sendErr)(msg);
|
|
112
113
|
} else if (/empty_implicit_contract/.test(msg)) {
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
const result = msg.match(/(?<="implicit":")tz[^"]+(?=")/);
|
|
115
|
+
const publicKeyHash = result ? result[0] : undefined;
|
|
116
|
+
if (!publicKeyHash) (0, $iVZbm$taquerianodesdk.sendErr)(msg);
|
|
117
|
+
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)`);
|
|
115
118
|
} else {
|
|
116
|
-
(0, $iVZbm$taquerianodesdk.sendErr)("There was a problem communicating with the chain.
|
|
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");
|
|
117
120
|
(0, $iVZbm$taquerianodesdk.sendErr)(msg);
|
|
118
121
|
}
|
|
119
122
|
}
|
|
@@ -145,18 +148,17 @@ const $806c5c6032403442$var$originateToNetworks = (parsedArgs, currentEnv)=>curr
|
|
|
145
148
|
const network = (0, $iVZbm$taquerianodesdk.getNetworkConfig)(parsedArgs)(networkName);
|
|
146
149
|
if (network) {
|
|
147
150
|
if (network.rpcUrl) {
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
} else (0, $iVZbm$taquerianodesdk.sendErr)(`Network "${networkName} is missing an RPC url in config.json."`);
|
|
151
|
+
const result = (async ()=>{
|
|
152
|
+
const tezos = new (0, $iVZbm$taquitotaquito.TezosToolkit)(network.rpcUrl);
|
|
153
|
+
const key = await (0, $iVZbm$taquerianodesdk.getAccountPrivateKey)(parsedArgs, network, "taqRootAccount");
|
|
154
|
+
await (0, $iVZbm$taquitosigner.importKey)(tezos, key);
|
|
155
|
+
return await $806c5c6032403442$var$createBatch(parsedArgs, tezos, networkName);
|
|
156
|
+
})();
|
|
157
|
+
return [
|
|
158
|
+
...retval,
|
|
159
|
+
result
|
|
160
|
+
];
|
|
161
|
+
} else (0, $iVZbm$taquerianodesdk.sendErr)(`Network "${networkName}" is missing an RPC url in config.json.`);
|
|
160
162
|
} else (0, $iVZbm$taquerianodesdk.sendErr)(`The current environment is configured to use a network called '${networkName}'; however, no network of this name has been configured in .taq/config.json.`);
|
|
161
163
|
return retval;
|
|
162
164
|
}, []) : [];
|
|
@@ -216,7 +218,7 @@ const $944e64d99e99b46e$var$getFirstAccountAlias = (sandboxName, opts)=>{
|
|
|
216
218
|
const aliases = (0, $iVZbm$taquerianodesdk.getSandboxAccountNames)(opts)(sandboxName);
|
|
217
219
|
return aliases.shift();
|
|
218
220
|
};
|
|
219
|
-
const $944e64d99e99b46e$var$configureToolKitWithSandbox =
|
|
221
|
+
const $944e64d99e99b46e$var$configureToolKitWithSandbox = (parsedArgs, sandboxName)=>{
|
|
220
222
|
const sandbox = (0, $iVZbm$taquerianodesdk.getSandboxConfig)(parsedArgs)(sandboxName);
|
|
221
223
|
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.`);
|
|
222
224
|
let defaultAccount = (0, $iVZbm$taquerianodesdk.getDefaultAccount)(parsedArgs)(sandboxName);
|
|
@@ -232,15 +234,14 @@ const $944e64d99e99b46e$var$configureToolKitWithSandbox = async (parsedArgs, san
|
|
|
232
234
|
tezos.setProvider({
|
|
233
235
|
signer: new (0, $iVZbm$taquitosigner.InMemorySigner)(defaultAccount.secretKey.replace(/^unencrypted:/, ""))
|
|
234
236
|
});
|
|
235
|
-
return tezos;
|
|
237
|
+
return Promise.resolve(tezos);
|
|
236
238
|
};
|
|
237
239
|
const $944e64d99e99b46e$var$configureToolKitWithNetwork = async (parsedArgs, networkName)=>{
|
|
238
240
|
const network = (0, $iVZbm$taquerianodesdk.getNetworkConfig)(parsedArgs)(networkName);
|
|
239
241
|
if (!network) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`The current environment is configured to use a network called '${networkName}'; however, no network of this name has been configured in .taq/config.json.`);
|
|
240
|
-
const faucet = network.faucet;
|
|
241
|
-
if (!faucet) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`Network ${networkName} requires a valid faucet in config.json.`);
|
|
242
242
|
const tezos = new (0, $iVZbm$taquitotaquito.TezosToolkit)(network.rpcUrl);
|
|
243
|
-
await (0, $iVZbm$
|
|
243
|
+
const key = await (0, $iVZbm$taquerianodesdk.getAccountPrivateKey)(parsedArgs, network, "taqRootAccount");
|
|
244
|
+
await (0, $iVZbm$taquitosigner.importKey)(tezos, key);
|
|
244
245
|
return tezos;
|
|
245
246
|
};
|
|
246
247
|
const $944e64d99e99b46e$var$configureTezosToolKit = (parsedArgs, env)=>{
|
|
@@ -262,7 +263,7 @@ const $944e64d99e99b46e$var$getContractInfo = async (parsedArgs, env, tezos)=>{
|
|
|
262
263
|
destination: tezos.rpc.getRpcUrl()
|
|
263
264
|
};
|
|
264
265
|
};
|
|
265
|
-
const $944e64d99e99b46e$var$performTransferOp = (tezos, contractInfo)=>{
|
|
266
|
+
const $944e64d99e99b46e$var$performTransferOp = (tezos, contractInfo, parsedArgs)=>{
|
|
266
267
|
return tezos.contract.transfer({
|
|
267
268
|
to: contractInfo.contractAddress,
|
|
268
269
|
amount: parseFloat(contractInfo.tezTransfer),
|
|
@@ -270,7 +271,16 @@ const $944e64d99e99b46e$var$performTransferOp = (tezos, contractInfo)=>{
|
|
|
270
271
|
entrypoint: contractInfo.entrypoint,
|
|
271
272
|
value: new (0, $iVZbm$taquitomichelcodec.Parser)().parseMichelineExpression(contractInfo.parameter)
|
|
272
273
|
}
|
|
273
|
-
}).then((op)=>op.confirmation().then(()=>op.hash)).catch((err)=>
|
|
274
|
+
}).then((op)=>op.confirmation().then(()=>op.hash)).catch((err)=>{
|
|
275
|
+
if (err instanceof Error) {
|
|
276
|
+
if (/empty_implicit_contract/.test(err.message)) {
|
|
277
|
+
const result = err.message.match(/(?<="implicit":")tz[^"]+(?=")/);
|
|
278
|
+
const publicKeyHash = result ? result[0] : undefined;
|
|
279
|
+
if (publicKeyHash) return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`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)`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return (0, $iVZbm$taquerianodesdk.sendAsyncErr)(`Error during transfer operation:\n${err} ${JSON.stringify(err, null, 2)}`);
|
|
283
|
+
});
|
|
274
284
|
};
|
|
275
285
|
const $944e64d99e99b46e$export$c9b234447cf4ef7c = async (parsedArgs)=>{
|
|
276
286
|
const env = (0, $iVZbm$taquerianodesdk.getCurrentEnvironmentConfig)(parsedArgs);
|
|
@@ -278,7 +288,7 @@ const $944e64d99e99b46e$export$c9b234447cf4ef7c = async (parsedArgs)=>{
|
|
|
278
288
|
try {
|
|
279
289
|
const tezos = await $944e64d99e99b46e$var$configureTezosToolKit(parsedArgs, env);
|
|
280
290
|
const contractInfo = await $944e64d99e99b46e$var$getContractInfo(parsedArgs, env, tezos);
|
|
281
|
-
await $944e64d99e99b46e$var$performTransferOp(tezos, contractInfo);
|
|
291
|
+
await $944e64d99e99b46e$var$performTransferOp(tezos, contractInfo, parsedArgs);
|
|
282
292
|
return (0, $iVZbm$taquerianodesdk.sendJsonRes)([
|
|
283
293
|
contractInfo
|
|
284
294
|
]);
|
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;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,oB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ACF;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\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;;;;;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,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AAE;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":"../"}
|
package/originate.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
getAccountPrivateKey,
|
|
2
3
|
getCurrentEnvironment,
|
|
3
4
|
getCurrentEnvironmentConfig,
|
|
4
5
|
getDefaultAccount,
|
|
@@ -100,6 +101,8 @@ const mapOpToContract = async (
|
|
|
100
101
|
destination: string,
|
|
101
102
|
) => {
|
|
102
103
|
const results = await op.operationResults();
|
|
104
|
+
const originationResults = results.filter(result => result.kind === 'origination')
|
|
105
|
+
.map(result => result as OperationContentsAndResultOrigination);
|
|
103
106
|
|
|
104
107
|
return contracts.reduce(
|
|
105
108
|
(retval, contract) => {
|
|
@@ -109,7 +112,7 @@ const mapOpToContract = async (
|
|
|
109
112
|
// WARNING - using side effect here.
|
|
110
113
|
// For each iteration of reduce, results array is being modified-in-place.
|
|
111
114
|
// TODO: Adjust to use recursion to avoid side-effect.
|
|
112
|
-
const result =
|
|
115
|
+
const result = originationResults.shift();
|
|
113
116
|
const address = result && result.metadata.operation_result.originated_contracts
|
|
114
117
|
? result.metadata.operation_result.originated_contracts.join(',')
|
|
115
118
|
: 'Error';
|
|
@@ -165,19 +168,25 @@ const createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: s
|
|
|
165
168
|
if (error.message) {
|
|
166
169
|
const msg = error.message;
|
|
167
170
|
if (/ENOTFOUND/.test(msg)) {
|
|
168
|
-
sendErr('The RPC URL may be invalid. Check your
|
|
171
|
+
sendErr('The RPC URL may be invalid. Check your ./.taq/config.json.\n');
|
|
169
172
|
sendErr(msg);
|
|
170
173
|
} else if (/ECONNREFUSED/.test(msg)) {
|
|
171
174
|
sendErr('The RPC URL may be down or the sandbox is not running.\n');
|
|
172
175
|
sendErr(msg);
|
|
173
176
|
} else if (/empty_implicit_contract/.test(msg)) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
);
|
|
177
|
-
|
|
177
|
+
const result = msg.match(/(?<="implicit":")tz[^"]+(?=")/);
|
|
178
|
+
const publicKeyHash = result ? result[0] : undefined;
|
|
179
|
+
if (!publicKeyHash) sendErr(msg);
|
|
180
|
+
else {
|
|
181
|
+
sendErr(
|
|
182
|
+
`The account ${publicKeyHash} for the target environment, "${
|
|
183
|
+
getCurrentEnvironment(parsedArgs)
|
|
184
|
+
}", 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)`,
|
|
185
|
+
);
|
|
186
|
+
}
|
|
178
187
|
} else {
|
|
179
188
|
sendErr(
|
|
180
|
-
"There was a problem communicating with the chain.
|
|
189
|
+
"There was a problem communicating with the chain. Please check the RPC URL of the network or sandbox you're targeting.\n",
|
|
181
190
|
);
|
|
182
191
|
sendErr(msg);
|
|
183
192
|
}
|
|
@@ -230,22 +239,15 @@ const originateToNetworks = (parsedArgs: Opts, currentEnv: Protocol.Environment.
|
|
|
230
239
|
const network = getNetworkConfig(parsedArgs)(networkName);
|
|
231
240
|
if (network) {
|
|
232
241
|
if (network.rpcUrl) {
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
network.faucet.password,
|
|
240
|
-
network.faucet.mnemonic.join(' '),
|
|
241
|
-
network.faucet.activation_code,
|
|
242
|
-
);
|
|
243
|
-
return await createBatch(parsedArgs, tezos, networkName);
|
|
244
|
-
})();
|
|
242
|
+
const result = (async () => {
|
|
243
|
+
const tezos = new TezosToolkit(network.rpcUrl as string);
|
|
244
|
+
const key = await getAccountPrivateKey(parsedArgs, network, 'taqRootAccount');
|
|
245
|
+
await importKey(tezos, key);
|
|
246
|
+
return await createBatch(parsedArgs, tezos, networkName);
|
|
247
|
+
})();
|
|
245
248
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
} else sendErr(`Network "${networkName} is missing an RPC url in config.json."`);
|
|
249
|
+
return [...retval, result];
|
|
250
|
+
} else sendErr(`Network "${networkName}" is missing an RPC url in config.json.`);
|
|
249
251
|
} else {
|
|
250
252
|
sendErr(
|
|
251
253
|
`The current environment is configured to use a network called '${networkName}'; however, no network of this name has been configured in .taq/config.json.`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-taquito",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.11",
|
|
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.
|
|
49
|
+
"@taqueria/node-sdk": "^0.21.11",
|
|
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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
getAccountPrivateKey,
|
|
2
3
|
getAddressOfAlias,
|
|
4
|
+
getCurrentEnvironment,
|
|
3
5
|
getCurrentEnvironmentConfig,
|
|
4
6
|
getDefaultAccount,
|
|
5
7
|
getNetworkConfig,
|
|
@@ -37,7 +39,7 @@ const getFirstAccountAlias = (sandboxName: string, opts: Opts) => {
|
|
|
37
39
|
return aliases.shift();
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
const configureToolKitWithSandbox =
|
|
42
|
+
const configureToolKitWithSandbox = (parsedArgs: Opts, sandboxName: string): Promise<TezosToolkit> => {
|
|
41
43
|
const sandbox = getSandboxConfig(parsedArgs)(sandboxName);
|
|
42
44
|
if (!sandbox) {
|
|
43
45
|
return sendAsyncErr(
|
|
@@ -63,7 +65,7 @@ const configureToolKitWithSandbox = async (parsedArgs: Opts, sandboxName: string
|
|
|
63
65
|
tezos.setProvider({
|
|
64
66
|
signer: new InMemorySigner((defaultAccount.secretKey as string).replace(/^unencrypted:/, '')),
|
|
65
67
|
});
|
|
66
|
-
return tezos;
|
|
68
|
+
return Promise.resolve(tezos);
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
const configureToolKitWithNetwork = async (parsedArgs: Opts, networkName: string): Promise<TezosToolkit> => {
|
|
@@ -74,17 +76,9 @@ const configureToolKitWithNetwork = async (parsedArgs: Opts, networkName: string
|
|
|
74
76
|
);
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
const faucet = network.faucet;
|
|
78
|
-
if (!faucet) return sendAsyncErr(`Network ${networkName} requires a valid faucet in config.json.`);
|
|
79
|
-
|
|
80
79
|
const tezos = new TezosToolkit(network.rpcUrl as string);
|
|
81
|
-
await
|
|
82
|
-
|
|
83
|
-
network.faucet.email ?? '',
|
|
84
|
-
network.faucet.password,
|
|
85
|
-
network.faucet.mnemonic.join(' '),
|
|
86
|
-
network.faucet.activation_code,
|
|
87
|
-
);
|
|
80
|
+
const key = await getAccountPrivateKey(parsedArgs, network, 'taqRootAccount');
|
|
81
|
+
await importKey(tezos, key);
|
|
88
82
|
return tezos;
|
|
89
83
|
};
|
|
90
84
|
|
|
@@ -111,7 +105,7 @@ const getContractInfo = async (parsedArgs: Opts, env: Environment.t, tezos: Tezo
|
|
|
111
105
|
};
|
|
112
106
|
};
|
|
113
107
|
|
|
114
|
-
const performTransferOp = (tezos: TezosToolkit, contractInfo: TableRow): Promise<string> => {
|
|
108
|
+
const performTransferOp = (tezos: TezosToolkit, contractInfo: TableRow, parsedArgs: Opts): Promise<string> => {
|
|
115
109
|
return tezos.contract
|
|
116
110
|
.transfer({
|
|
117
111
|
to: contractInfo.contractAddress,
|
|
@@ -122,7 +116,22 @@ const performTransferOp = (tezos: TezosToolkit, contractInfo: TableRow): Promise
|
|
|
122
116
|
},
|
|
123
117
|
})
|
|
124
118
|
.then(op => op.confirmation().then(() => op.hash))
|
|
125
|
-
.catch(err =>
|
|
119
|
+
.catch(err => {
|
|
120
|
+
if (err instanceof Error) {
|
|
121
|
+
if (/empty_implicit_contract/.test(err.message)) {
|
|
122
|
+
const result = (err.message).match(/(?<="implicit":")tz[^"]+(?=")/);
|
|
123
|
+
const publicKeyHash = result ? result[0] : undefined;
|
|
124
|
+
if (publicKeyHash) {
|
|
125
|
+
return sendAsyncErr(
|
|
126
|
+
`The account ${publicKeyHash} for the target environment, "${
|
|
127
|
+
getCurrentEnvironment(parsedArgs)
|
|
128
|
+
}", 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)`,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return sendAsyncErr(`Error during transfer operation:\n${err} ${JSON.stringify(err, null, 2)}`);
|
|
134
|
+
});
|
|
126
135
|
};
|
|
127
136
|
|
|
128
137
|
export const transfer = async (parsedArgs: Opts): Promise<void> => {
|
|
@@ -131,7 +140,7 @@ export const transfer = async (parsedArgs: Opts): Promise<void> => {
|
|
|
131
140
|
try {
|
|
132
141
|
const tezos = await configureTezosToolKit(parsedArgs, env);
|
|
133
142
|
const contractInfo = await getContractInfo(parsedArgs, env, tezos);
|
|
134
|
-
await performTransferOp(tezos, contractInfo);
|
|
143
|
+
await performTransferOp(tezos, contractInfo, parsedArgs);
|
|
135
144
|
return sendJsonRes([contractInfo]);
|
|
136
145
|
} catch {
|
|
137
146
|
return sendAsyncErr('No operations performed.');
|