@taqueria/plugin-taquito 0.1.2 → 0.3.0
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 +115 -135
- package/index.js.map +1 -1
- package/index.ts +3 -2
- package/originate.ts +162 -166
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -14,152 +14,131 @@ function $parcel$interopDefault(a) {
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
|
|
17
18
|
const $806c5c6032403442$var$getContractAbspath = (contractFilename, parsedArgs)=>$iVZbm$path.join(parsedArgs.artifactsDir, /\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`)
|
|
18
19
|
;
|
|
19
|
-
const $806c5c6032403442$var$
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (secretKey) {
|
|
26
|
-
tezos.setProvider({
|
|
27
|
-
signer: new $iVZbm$taquitosigner.InMemorySigner(secretKey)
|
|
28
|
-
});
|
|
29
|
-
const contractData = await $iVZbm$fspromises.readFile(contractAbspath, "utf-8");
|
|
30
|
-
return tezos.contract.originate({
|
|
31
|
-
code: contractData,
|
|
32
|
-
storage: storage
|
|
33
|
-
}).then((operation)=>({
|
|
34
|
-
contract: contractFilename,
|
|
35
|
-
address: operation.contractAddress,
|
|
36
|
-
destination: sandboxName
|
|
37
|
-
})
|
|
38
|
-
);
|
|
39
|
-
} else return Promise.reject({
|
|
40
|
-
errCode: "E_INVALID_SANDBOX_ACCOUNT",
|
|
41
|
-
errMsg: `Please configure a default account for the ${sandboxName} to be used for origination.`,
|
|
42
|
-
context: sandbox
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return Promise.reject({
|
|
46
|
-
errCode: "E_INVALID_SANDBOX_URL",
|
|
47
|
-
errMsg: 'The sandbox configuration is invalid and missing the RPC url',
|
|
48
|
-
context: sandbox
|
|
49
|
-
});
|
|
50
|
-
} catch (err) {
|
|
51
|
-
return Promise.reject({
|
|
52
|
-
errCode: "E_ORIGINATE",
|
|
53
|
-
errMsg: "An unexpected error occured when trying to originate a contract",
|
|
54
|
-
previous: err
|
|
20
|
+
const $806c5c6032403442$var$addOrigination = (parsedArgs, batch)=>async (mapping)=>{
|
|
21
|
+
const contractAbspath = $806c5c6032403442$var$getContractAbspath(mapping.filename, parsedArgs);
|
|
22
|
+
const contractData = await $iVZbm$fspromises.readFile(contractAbspath, "utf-8");
|
|
23
|
+
return (await batch).withOrigination({
|
|
24
|
+
code: contractData,
|
|
25
|
+
storage: mapping.storage
|
|
55
26
|
});
|
|
56
27
|
}
|
|
28
|
+
;
|
|
29
|
+
const $806c5c6032403442$var$getValidContracts = async (parsedArgs)=>{
|
|
30
|
+
const contracts = parsedArgs.contract ? [
|
|
31
|
+
parsedArgs.contract
|
|
32
|
+
] : await ($parcel$interopDefault($iVZbm$fastglob))("**/*.tz", {
|
|
33
|
+
cwd: parsedArgs.artifactsDir
|
|
34
|
+
});
|
|
35
|
+
return contracts.reduce((retval, filename)=>{
|
|
36
|
+
const storage = $iVZbm$taquerianodesdk.getInitialStorage(parsedArgs)(filename);
|
|
37
|
+
if (!storage) throw `No initial storage provided for ${filename}`;
|
|
38
|
+
return [
|
|
39
|
+
...retval,
|
|
40
|
+
{
|
|
41
|
+
filename: filename,
|
|
42
|
+
storage: storage
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
}, []);
|
|
57
46
|
};
|
|
58
|
-
const $806c5c6032403442$var$
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} else return Promise.reject({
|
|
76
|
-
errCode: "E_INVALID_NETWORK_FAUCET",
|
|
77
|
-
errMsg: `Please configure a faucet for the ${network} network to be used for origination.`,
|
|
78
|
-
context: network
|
|
79
|
-
});
|
|
47
|
+
const $806c5c6032403442$var$mapOpToContract = async (contracts, op, destination)=>{
|
|
48
|
+
debugger;
|
|
49
|
+
const results = await op.operationResults();
|
|
50
|
+
return contracts.reduce((retval, contract)=>{
|
|
51
|
+
// If initial storage was provided for the contract
|
|
52
|
+
// then we submitted an operation to originate that contract
|
|
53
|
+
if (contract.storage) {
|
|
54
|
+
const result = results.pop();
|
|
55
|
+
const address = result && result.metadata.operation_result.originated_contracts ? result.metadata.operation_result.originated_contracts.join(',') : 'Error';
|
|
56
|
+
return [
|
|
57
|
+
...retval,
|
|
58
|
+
{
|
|
59
|
+
contract: contract.filename,
|
|
60
|
+
address: address,
|
|
61
|
+
destination: destination
|
|
62
|
+
}
|
|
63
|
+
];
|
|
80
64
|
}
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
previous: err
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const $806c5c6032403442$var$getNetworkConfig = (networkName, config)=>{
|
|
95
|
-
return !config.network[networkName] ? undefined : config.network[networkName];
|
|
65
|
+
return [
|
|
66
|
+
...retval,
|
|
67
|
+
{
|
|
68
|
+
contract: contract.filename,
|
|
69
|
+
address: "Error",
|
|
70
|
+
destination: destination
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
}, []);
|
|
96
74
|
};
|
|
97
|
-
const $806c5c6032403442$var$
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
|
|
75
|
+
const $806c5c6032403442$var$createBatch = async (parsedArgs, tezos, destination)=>{
|
|
76
|
+
const contracts = await $806c5c6032403442$var$getValidContracts(parsedArgs);
|
|
77
|
+
const batch1 = await contracts.reduce((batch, contractMapping)=>contractMapping.storage ? $806c5c6032403442$var$addOrigination(parsedArgs, batch)(contractMapping) : batch
|
|
78
|
+
, Promise.resolve(tezos.wallet.batch()));
|
|
79
|
+
try {
|
|
80
|
+
const op = await batch1.send();
|
|
81
|
+
const confirmed = await op.confirmation();
|
|
82
|
+
return await $806c5c6032403442$var$mapOpToContract(contracts, op, destination);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
const error = err;
|
|
85
|
+
if (error.message) $iVZbm$taquerianodesdk.sendErr(error.message);
|
|
86
|
+
return undefined;
|
|
105
87
|
}
|
|
106
|
-
return undefined;
|
|
107
88
|
};
|
|
108
|
-
const $806c5c6032403442$var$
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
] : retval
|
|
126
|
-
, []);
|
|
127
|
-
const allProcesses = !env.sandboxes ? [] : env.sandboxes.reduce((retval, sandbox)=>$806c5c6032403442$var$getSandboxConfig(sandbox, parsedArgs.config) ? [
|
|
128
|
-
...retval,
|
|
129
|
-
$806c5c6032403442$var$originateContractToSandbox(contractFilename, parsedArgs, env.storage[contractFilename], sandbox, $806c5c6032403442$var$getSandboxConfig(sandbox, parsedArgs.config))
|
|
130
|
-
] : retval
|
|
131
|
-
, networkProcesses);
|
|
132
|
-
return Promise.all(allProcesses);
|
|
133
|
-
}
|
|
89
|
+
const $806c5c6032403442$var$originateToNetworks = (parsedArgs, currentEnv)=>currentEnv.networks ? currentEnv.networks.reduce((retval, networkName)=>{
|
|
90
|
+
const network = $iVZbm$taquerianodesdk.getNetworkConfig(parsedArgs)(networkName);
|
|
91
|
+
if (network.rpcUrl) {
|
|
92
|
+
if (network.faucet) {
|
|
93
|
+
const result = (async ()=>{
|
|
94
|
+
const tezos = new $iVZbm$taquitotaquito.TezosToolkit(network.rpcUrl);
|
|
95
|
+
await $iVZbm$taquitosigner.importKey(tezos, network.faucet.email, network.faucet.password, network.faucet.mnemonic.join(' '), network.faucet.activation_code);
|
|
96
|
+
return await $806c5c6032403442$var$createBatch(parsedArgs, tezos, networkName);
|
|
97
|
+
})();
|
|
98
|
+
return [
|
|
99
|
+
...retval,
|
|
100
|
+
result
|
|
101
|
+
];
|
|
102
|
+
} else $iVZbm$taquerianodesdk.sendErr(`Network ${networkName} requires a valid faucet in config.json.`);
|
|
103
|
+
} else $iVZbm$taquerianodesdk.sendErr(`Network "${networkName} is missing an RPC url in config.json."`);
|
|
104
|
+
return retval;
|
|
105
|
+
}, []) : []
|
|
134
106
|
;
|
|
135
|
-
const $806c5c6032403442$var$
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
107
|
+
const $806c5c6032403442$var$originateToSandboxes = (parsedArgs, currentEnv)=>currentEnv.sandboxes ? currentEnv.sandboxes.reduce((retval, sandboxName)=>{
|
|
108
|
+
const sandbox = $iVZbm$taquerianodesdk.getSandboxConfig(parsedArgs)(sandboxName);
|
|
109
|
+
if (sandbox.rpcUrl) {
|
|
110
|
+
const secretKey = $iVZbm$taquerianodesdk.getDefaultAccount(parsedArgs)(sandboxName)?.keys?.secretKey;
|
|
111
|
+
if (secretKey) {
|
|
112
|
+
const result = (async ()=>{
|
|
113
|
+
const tezos = new $iVZbm$taquitotaquito.TezosToolkit(sandbox.rpcUrl);
|
|
114
|
+
tezos.setProvider({
|
|
115
|
+
signer: new $iVZbm$taquitosigner.InMemorySigner(secretKey.replace(/^unencrypted:/, ''))
|
|
116
|
+
});
|
|
117
|
+
return await $806c5c6032403442$var$createBatch(parsedArgs, tezos, sandboxName);
|
|
118
|
+
})();
|
|
119
|
+
return [
|
|
120
|
+
...retval,
|
|
121
|
+
result
|
|
122
|
+
];
|
|
123
|
+
} else $iVZbm$taquerianodesdk.sendErr(`Sandbox ${sandboxName}'s default account is missing keys in config.json.`);
|
|
124
|
+
} else $iVZbm$taquerianodesdk.sendErr(`Sandbox "${sandboxName} is missing an RPC url in config.json."`);
|
|
125
|
+
return retval;
|
|
126
|
+
}, []) : []
|
|
140
127
|
;
|
|
141
128
|
const $806c5c6032403442$export$acf571c34911f824 = (parsedArgs)=>{
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
stderr: err.errMsg,
|
|
156
|
-
previous: err
|
|
157
|
-
}) : Promise.resolve({
|
|
158
|
-
status: 'failed',
|
|
159
|
-
stderr: err.getMessage(),
|
|
160
|
-
stdout: '',
|
|
161
|
-
previous: err
|
|
162
|
-
})
|
|
129
|
+
const env = $iVZbm$taquerianodesdk.getCurrentEnvironmentConfig(parsedArgs);
|
|
130
|
+
if (!env) return $iVZbm$taquerianodesdk.sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);
|
|
131
|
+
const jobs1 = [
|
|
132
|
+
...$806c5c6032403442$var$originateToNetworks(parsedArgs, env),
|
|
133
|
+
...$806c5c6032403442$var$originateToSandboxes(parsedArgs, env)
|
|
134
|
+
];
|
|
135
|
+
return Promise.all(jobs1).then((jobs)=>jobs.reduce((retval, originations)=>{
|
|
136
|
+
return originations ? [
|
|
137
|
+
...retval,
|
|
138
|
+
...originations
|
|
139
|
+
] : retval;
|
|
140
|
+
}, [])
|
|
141
|
+
).then((results)=>results && results.length > 0 ? $iVZbm$taquerianodesdk.sendJsonRes(results) : $iVZbm$taquerianodesdk.sendErr(`No contracts originated.`)
|
|
163
142
|
);
|
|
164
143
|
};
|
|
165
144
|
var $806c5c6032403442$export$2e2bcd8739ae039 = $806c5c6032403442$export$acf571c34911f824;
|
|
@@ -178,7 +157,8 @@ $iVZbm$taquerianodesdk.Plugin.create((i18n)=>({
|
|
|
178
157
|
aliases: [
|
|
179
158
|
"originate"
|
|
180
159
|
],
|
|
181
|
-
handler: "proxy"
|
|
160
|
+
handler: "proxy",
|
|
161
|
+
encoding: "application/json"
|
|
182
162
|
}),
|
|
183
163
|
],
|
|
184
164
|
proxy: $806c5c6032403442$export$2e2bcd8739ae039
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;ACSA,KAAK,CAAC,wCAAkB,IAAI,gBAAwB,EAAE,UAAgB,GAClE,gBAAI,CAAC,UAAU,CAAC,YAAY,UAAU,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,MAAM,gBAAgB,CAAC,GAAG;;AAG7G,KAAK,CAAC,gDAA0B,UAAU,gBAAwB,EAAE,UAAgB,EAAE,OAAgB,EAAE,WAAmB,EAAE,OAAkC,GAAK,CAAC;IACjK,GAAG,CAAC,CAAC;QACD,EAAE,EAAE,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YAC5B,KAAK,CAAC,eAAe,GAAG,wCAAkB,CAAC,gBAAgB,EAAE,UAAU;YACvE,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,kCAAY,CAAC,OAAO,CAAC,MAAM;YAC7C,KAAK,CAAC,SAAS,GAAG,yCAAmB,CAAC,OAAO;YAC7C,EAAE,EAAE,SAAS,EAAE,CAAC;gBACZ,KAAK,CAAC,WAAW,CAAC,CAAC;oBACf,MAAM,EAAE,GAAG,CAAC,mCAAc,CAAC,SAAS;gBACxC,CAAC;gBAED,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,0BAAQ,CAAC,eAAe,EAAE,CAAO;gBAC5D,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;oBAC7B,IAAI,EAAE,YAAY;oBAClB,OAAO,EAAE,OAAO;gBACpB,CAAC,EACA,IAAI,EAAC,SAAS,IAAK,CAAC;wBACjB,QAAQ,EAAE,gBAAgB;wBAC1B,OAAO,EAAE,SA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taqueria/node-sdk'\nimport type { i18n} from '@taqueria/node-sdk/types'\nimport originate from './originate'\n\nPlugin.create((i18n: i18n) => ({\n alias: \"taquito\",\n schema: \"1.0\",\n version: \"0.1\",\n tasks: [\n Task.create({\n task: \"deploy\",\n command: \"deploy [contract]\",\n description: \"Deploy a smart contract to a particular environment\",\n options: [\n ],\n aliases: [\"originate\"],\n handler: \"proxy\"\n }),\n ],\n proxy: originate\n}), process.argv)\n","import { SanitizedArgs, PluginResponse, AccountDetails, Failure, LikeAPromise, Config, NetworkConfig, SandboxConfig, ProxyAction} from \"@taqueria/node-sdk/types\";\nimport glob from 'fast-glob'\nimport {join} from 'path'\nimport { TezosToolkit } from '@taquito/taquito';\nimport {readFile} from 'fs/promises'\nimport { InMemorySigner, importKey } from '@taquito/signer';\n\ntype Opts = SanitizedArgs & Record<string, unknown>\n\nconst getContractAbspath = (contractFilename: string, parsedArgs: Opts) => \n join(parsedArgs.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`)\n\n\nconst originateContractToSandbox = async (contractFilename: string, parsedArgs: Opts, storage: unknown, sandboxName: string, sandbox: SandboxConfig | undefined) => {\n try {\n if (sandbox && sandbox.rpcUrl) {\n const contractAbspath = getContractAbspath(contractFilename, parsedArgs)\n const tezos = new TezosToolkit(sandbox.rpcUrl)\n const secretKey = getAccountSecretKey(sandbox)\n if (secretKey) {\n tezos.setProvider({\n signer: new InMemorySigner(secretKey),\n });\n\n const contractData = await readFile(contractAbspath, \"utf-8\")\n return tezos.contract.originate({\n code: contractData,\n storage: storage\n })\n .then(operation => ({\n contract: contractFilename,\n address: operation.contractAddress,\n destination: sandboxName\n }))\n }\n else {\n return Promise.reject({\n errCode: \"E_INVALID_SANDBOX_ACCOUNT\",\n errMsg: `Please configure a default account for the ${sandboxName} to be used for origination.`,\n context: sandbox\n })\n }\n }\n return Promise.reject({\n errCode: \"E_INVALID_SANDBOX_URL\",\n errMsg: 'The sandbox configuration is invalid and missing the RPC url',\n context: sandbox\n })\n }\n catch (err) {\n return Promise.reject({\n errCode: \"E_ORIGINATE\",\n errMsg: \"An unexpected error occured when trying to originate a contract\",\n previous: err\n })\n }\n}\n\nconst originateContractToNetwork = async (contractFilename: string, parsedArgs: Opts, storage: unknown, networkName: string, network: NetworkConfig|undefined) => {\n try {\n if (network && network.rpcUrl) {\n const contractAbspath = getContractAbspath(contractFilename, parsedArgs)\n const tezos = new TezosToolkit(network.rpcUrl)\n if (network.faucet) {\n await importKey(tezos, network.faucet.email, network.faucet.password, network.faucet.mnemonic.join(' '), network.faucet.activation_code)\n\n const contractData = await readFile(contractAbspath, \"utf-8\")\n return tezos.contract.originate({\n code: contractData,\n storage: storage\n })\n .then(operation => ({\n contract: contractFilename,\n address: operation.contractAddress,\n destination: networkName\n }))\n }\n else {\n return Promise.reject({\n errCode: \"E_INVALID_NETWORK_FAUCET\",\n errMsg: `Please configure a faucet for the ${network} network to be used for origination.`,\n context: network\n })\n }\n }\n return Promise.reject({\n errCode: \"E_INVALID_NETWORK_URL\",\n errMsg: 'The network configuration is invalid and missing the RPC url',\n context: network\n })\n }\n catch (err) {\n return Promise.reject({\n errCode: \"E_ORIGINATE\",\n errMsg: \"An unexpected error occured when trying to originate a contract\",\n previous: err\n })\n }\n}\n\nconst getNetworkConfig = (networkName: string, config: Config) => {\n return !config.network[networkName]\n ? undefined\n : config.network[networkName]\n}\n\nconst getSandboxConfig = (sandboxName: string, config: Config) => {\n return !config.sandbox[sandboxName]\n ? undefined\n : config.sandbox[sandboxName]\n}\n\nconst getAccountSecretKey = (sandbox: SandboxConfig) => {\n if (sandbox.accounts && sandbox.accounts.default) {\n const accountName = (sandbox.accounts.default as string);\n const accountDetails = sandbox.accounts[accountName] as AccountDetails\n if (accountDetails.keys) return accountDetails.keys.secretKey.replace(/unencrypted:/, '')\n }\n\n return undefined \n}\n\nconst originateContract = (parsedArgs: Opts) => (contractFilename: string) : Promise<unknown[]> => {\n // TODO: Should getting the default environment be provided by the SDK or the framework?\n const currentEnv = parsedArgs.env\n ? (parsedArgs.env as string)\n : (\n parsedArgs.config.environment\n ? parsedArgs.config.environment.default\n : 'development'\n )\n const env = parsedArgs.config.environment && parsedArgs.config.environment[currentEnv]\n ? parsedArgs.config.environment[currentEnv]\n : undefined\n\n if (!env) {\n return Promise.reject({\n errCode: \"E_INVALID_ENV\",\n errMsg: `No environment configured in your configuration file called ${parsedArgs.env}`,\n context: parsedArgs.config\n }) \n }\n\n if (!env.storage || !env.storage[contractFilename]) {\n return Promise.reject({\n errCode: \"E_INVALID_STORAGE\",\n errMsg: `No storage configured in your configuration file for ${contractFilename}`,\n context: env\n })\n }\n\n const networkProcesses = !env.networks ? [] : env.networks.reduce(\n (retval: Promise<unknown>[], network) => \n getNetworkConfig(network, parsedArgs.config)\n ? [...retval, originateContractToNetwork(contractFilename, parsedArgs, env.storage[contractFilename], network, getNetworkConfig(network, parsedArgs.config))]\n : retval,\n []\n )\n\n const allProcesses = !env.sandboxes ? [] : env.sandboxes.reduce(\n (retval: Promise<unknown>[], sandbox) => getSandboxConfig(sandbox, parsedArgs.config)\n ? [...retval, originateContractToSandbox(contractFilename, parsedArgs, env.storage[contractFilename], sandbox, getSandboxConfig(sandbox, parsedArgs.config))]\n : retval \n ,\n networkProcesses\n )\n \n return Promise.all(allProcesses)\n}\n\nconst originateAll = (parsedArgs: Opts) : Promise<unknown[]> =>\n glob(\"**/*.tz\", {cwd: parsedArgs.artifactsDir})\n .then(files => Promise.all(files.map(originateContract(parsedArgs))))\n .then(results => results.flat(1))\n\nexport const originate = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\n const p = parsedArgs.contract\n ? originateContract(parsedArgs) (parsedArgs.contract as string)\n .then(result => [result])\n : originateAll(parsedArgs)\n\n return p.then(data => ({\n status: 'success',\n stdout: data,\n stderr: \"\",\n render: 'table'\n }))\n .catch(err => err.errCode\n ? Promise.resolve({status: 'failed', stdout: '', stderr: err.errMsg, previous: err})\n : Promise.resolve({status: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B,EAAE,UAAU,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAA;IAGhG,MAAM,KAAI,GAAG;WACN,yCAAmB,CAAC,UAAU,EAAE,GAAG,CAAC;WACpC,0CAAoB,CAAC,UAAU,EAAE,GAAG,CAAC;KAC3C;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,KAAI,CAAC,CACnB,IAAI,CAAC,CAAA,IAAI,GAAI,IAAI,CAAC,MAAM,CACrB,CAAC,MAAM,EAAE,YAAY,GAAK;YACtB,OAAO,YAAY,GACb;mBAAI,MAAM;mBAA4B,YAAY;aAAC,GACnD,MAAM,CAAA;SACf,EACD,EAAE,CACL;IAAA,CAAC,CACD,IAAI,CAAC,CAAA,OAAO,GAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,kCAAW,CAAC,OAAO,CAAC,GAAE,8BAAO,CAAC,CAAC,wBAAwB,CAAC,CAAC;IAAA,CAAC,CAAA;CAClH;IAED,wCAAwB,GAAT,yCAAS;;;ADzLxB,6BAAM,CAAC,MAAM,CAAC,CAAC,IAAU,GAAM,CAAA;QAC3B,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACH,2BAAI,CAAC,MAAM,CAAC;gBACR,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,mBAAmB;gBAC5B,WAAW,EAAE,qDAAqD;gBAClE,OAAO,EAAE,EACR;gBACD,OAAO,EAAE;oBAAC,WAAW;iBAAC;gBACtB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,kBAAkB;aAC/B,CAAC;SACL;QACD,KAAK,EAAE,wCAAS;KACnB,CAAA;AAAC,EAAE,OAAO,CAAC,IAAI,CAAC","sources":["taqueria-plugin-taquito/index.ts","taqueria-plugin-taquito/originate.ts"],"sourcesContent":["import {Plugin, Task} from '@taqueria/node-sdk'\nimport type { i18n} from '@taqueria/node-sdk/types'\nimport originate from './originate'\n\nPlugin.create((i18n: i18n) => ({\n alias: \"taquito\",\n schema: \"1.0\",\n version: \"0.1\",\n tasks: [\n Task.create({\n task: \"deploy\",\n command: \"deploy [contract]\",\n description: \"Deploy a smart contract to a particular environment\",\n options: [\n ],\n aliases: [\"originate\"],\n handler: \"proxy\",\n encoding: \"application/json\"\n }),\n ],\n proxy: originate\n}), process.argv)\n","import { SanitizedArgs, PluginResponse, AccountDetails, Failure, LikeAPromise, Config, NetworkConfig, SandboxConfig, EnvironmentConfig} from \"@taqueria/node-sdk/types\";\nimport glob from 'fast-glob'\nimport {join} from 'path'\nimport { TezosToolkit, OriginateParams, WalletOperationBatch } from '@taquito/taquito';\nimport {readFile} from 'fs/promises'\nimport { InMemorySigner, importKey } from '@taquito/signer';\nimport { sendAsyncJsonRes, getCurrentEnvironmentConfig, getNetworkConfig, getSandboxAccountConfig, getInitialStorage, sendErr, getSandboxConfig, getDefaultAccount, sendJsonRes, sendAsyncErr } from \"@taqueria/node-sdk\";\nimport { BatchWalletOperation } from \"@taquito/taquito/dist/types/wallet/batch-operation\";\nimport { OperationContentsAndResultOrigination } from \"@taquito/rpc\";\n\ntype Opts = SanitizedArgs & Record<string, unknown>\n\ninterface ContractStorageMapping {\n filename: string,\n storage?: unknown\n}\n\ninterface OriginationResult {\n contract: string\n address: string\n destination: string\n}\n\nconst getContractAbspath = (contractFilename: string, parsedArgs: Opts) => \n join(parsedArgs.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`)\n\nconst addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) => async (mapping: ContractStorageMapping) => {\n const contractAbspath = getContractAbspath(mapping.filename, parsedArgs)\n const contractData = await readFile(contractAbspath, \"utf-8\")\n return (await batch).withOrigination({\n code: contractData,\n storage: mapping.storage,\n \n })\n}\n\nconst getValidContracts = async (parsedArgs: Opts) => {\n const contracts = parsedArgs.contract\n ? [parsedArgs.contract as string]\n : (await glob(\"**/*.tz\", {cwd: parsedArgs.artifactsDir})) as string[] \n\n return contracts.reduce(\n (retval, filename) => {\n const storage = getInitialStorage(parsedArgs) (filename)\n if (!storage) throw(`No initial storage provided for ${filename}`)\n return [...retval, {filename, storage}]\n },\n [] as ContractStorageMapping[]\n ) \n}\n\nconst mapOpToContract = async (contracts: ContractStorageMapping[], op: BatchWalletOperation, destination: string) => {\n debugger\n const results = await op.operationResults()\n\n return contracts.reduce(\n (retval, contract) => {\n\n // If initial storage was provided for the contract\n // then we submitted an operation to originate that contract\n if (contract.storage) {\n const result = results.pop() as OperationContentsAndResultOrigination\n const address = result && result.metadata.operation_result.originated_contracts\n ? result.metadata.operation_result.originated_contracts.join(',')\n : 'Error'\n\n return [\n ...retval, {\n contract: contract.filename,\n address,\n destination\n }\n ]\n }\n\n return [\n ...retval, {\n contract: contract.filename,\n address: \"Error\",\n destination\n }\n ]\n },\n [] as OriginationResult[]\n )\n}\n\n\nconst createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: string) => {\n const contracts = await getValidContracts (parsedArgs) \n \n const batch = await contracts.reduce(\n (batch, contractMapping) => \n contractMapping.storage\n ? addOrigination(parsedArgs, batch) (contractMapping)\n : batch,\n Promise.resolve(tezos.wallet.batch())\n )\n \n try {\n const op = await batch.send()\n const confirmed = await op.confirmation()\n return await mapOpToContract(contracts, op, destination)\n }\n catch (err) {\n const error = (err as {message: string})\n if (error.message) sendErr(error.message)\n return undefined\n }\n}\n\nconst originateToNetworks = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>\n currentEnv.networks\n ? currentEnv.networks.reduce(\n (retval, networkName) => {\n const network = getNetworkConfig (parsedArgs) (networkName)\n if (network.rpcUrl) {\n if (network.faucet) {\n const result = (async () => {\n const tezos = new TezosToolkit(network.rpcUrl as string)\n await importKey(tezos, network.faucet.email, network.faucet.password, network.faucet.mnemonic.join(' '), network.faucet.activation_code)\n return await createBatch(parsedArgs, tezos, networkName)\n })()\n\n return [...retval, result]\n }\n else sendErr(`Network ${networkName} requires a valid faucet in config.json.`)\n }\n else sendErr(`Network \"${networkName} is missing an RPC url in config.json.\"`)\n return retval\n },\n [] as Promise<OriginationResult[]|undefined>[]\n )\n : []\n\nconst originateToSandboxes = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>\n currentEnv.sandboxes\n ? currentEnv.sandboxes.reduce(\n (retval, sandboxName) => {\n const sandbox = getSandboxConfig (parsedArgs) (sandboxName)\n if (sandbox.rpcUrl) {\n const secretKey = getDefaultAccount(parsedArgs) (sandboxName) ?.keys?.secretKey\n if (secretKey) {\n const result = (async () => {\n const tezos = new TezosToolkit(sandbox.rpcUrl as string)\n tezos.setProvider({\n signer: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),\n });\n return await createBatch(parsedArgs, tezos, sandboxName)\n })()\n \n return [...retval, result]\n }\n else sendErr(`Sandbox ${sandboxName}'s default account is missing keys in config.json.`)\n }\n else sendErr(`Sandbox \"${sandboxName} is missing an RPC url in config.json.\"`)\n\n return retval\n },\n [] as Promise<OriginationResult[]|undefined>[]\n )\n : []\n \n \n\nexport const originate = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\n const env = getCurrentEnvironmentConfig(parsedArgs)\n\n if (!env) {\n return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`)\n }\n\n const jobs = [\n ...originateToNetworks(parsedArgs, env),\n ...originateToSandboxes(parsedArgs, env)\n ]\n\n return Promise.all(jobs)\n .then(jobs => jobs.reduce(\n (retval, originations) => {\n return originations\n ? [...retval as OriginationResult[], ...originations]\n : retval\n },\n []\n ))\n .then(results => results && results.length > 0 ? sendJsonRes(results): sendErr(`No contracts originated.`))\n}\n\nexport default originate\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
|
package/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Plugin, Task
|
|
1
|
+
import {Plugin, Task} from '@taqueria/node-sdk'
|
|
2
2
|
import type { i18n} from '@taqueria/node-sdk/types'
|
|
3
3
|
import originate from './originate'
|
|
4
4
|
|
|
@@ -14,7 +14,8 @@ Plugin.create((i18n: i18n) => ({
|
|
|
14
14
|
options: [
|
|
15
15
|
],
|
|
16
16
|
aliases: ["originate"],
|
|
17
|
-
handler: "proxy"
|
|
17
|
+
handler: "proxy",
|
|
18
|
+
encoding: "application/json"
|
|
18
19
|
}),
|
|
19
20
|
],
|
|
20
21
|
proxy: originate
|
package/originate.ts
CHANGED
|
@@ -1,194 +1,190 @@
|
|
|
1
|
-
import { SanitizedArgs, PluginResponse, AccountDetails, Failure, LikeAPromise, Config, NetworkConfig, SandboxConfig,
|
|
1
|
+
import { SanitizedArgs, PluginResponse, AccountDetails, Failure, LikeAPromise, Config, NetworkConfig, SandboxConfig, EnvironmentConfig} from "@taqueria/node-sdk/types";
|
|
2
2
|
import glob from 'fast-glob'
|
|
3
3
|
import {join} from 'path'
|
|
4
|
-
import { TezosToolkit } from '@taquito/taquito';
|
|
4
|
+
import { TezosToolkit, OriginateParams, WalletOperationBatch } from '@taquito/taquito';
|
|
5
5
|
import {readFile} from 'fs/promises'
|
|
6
6
|
import { InMemorySigner, importKey } from '@taquito/signer';
|
|
7
|
+
import { sendAsyncJsonRes, getCurrentEnvironmentConfig, getNetworkConfig, getSandboxAccountConfig, getInitialStorage, sendErr, getSandboxConfig, getDefaultAccount, sendJsonRes, sendAsyncErr } from "@taqueria/node-sdk";
|
|
8
|
+
import { BatchWalletOperation } from "@taquito/taquito/dist/types/wallet/batch-operation";
|
|
9
|
+
import { OperationContentsAndResultOrigination } from "@taquito/rpc";
|
|
7
10
|
|
|
8
11
|
type Opts = SanitizedArgs & Record<string, unknown>
|
|
9
12
|
|
|
13
|
+
interface ContractStorageMapping {
|
|
14
|
+
filename: string,
|
|
15
|
+
storage?: unknown
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface OriginationResult {
|
|
19
|
+
contract: string
|
|
20
|
+
address: string
|
|
21
|
+
destination: string
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
const getContractAbspath = (contractFilename: string, parsedArgs: Opts) =>
|
|
11
25
|
join(parsedArgs.artifactsDir, /\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`)
|
|
12
26
|
|
|
27
|
+
const addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) => async (mapping: ContractStorageMapping) => {
|
|
28
|
+
const contractAbspath = getContractAbspath(mapping.filename, parsedArgs)
|
|
29
|
+
const contractData = await readFile(contractAbspath, "utf-8")
|
|
30
|
+
return (await batch).withOrigination({
|
|
31
|
+
code: contractData,
|
|
32
|
+
storage: mapping.storage,
|
|
33
|
+
|
|
34
|
+
})
|
|
35
|
+
}
|
|
13
36
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
code: contractData,
|
|
28
|
-
storage: storage
|
|
29
|
-
})
|
|
30
|
-
.then(operation => ({
|
|
31
|
-
contract: contractFilename,
|
|
32
|
-
address: operation.contractAddress,
|
|
33
|
-
destination: sandboxName
|
|
34
|
-
}))
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
return Promise.reject({
|
|
38
|
-
errCode: "E_INVALID_SANDBOX_ACCOUNT",
|
|
39
|
-
errMsg: `Please configure a default account for the ${sandboxName} to be used for origination.`,
|
|
40
|
-
context: sandbox
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return Promise.reject({
|
|
45
|
-
errCode: "E_INVALID_SANDBOX_URL",
|
|
46
|
-
errMsg: 'The sandbox configuration is invalid and missing the RPC url',
|
|
47
|
-
context: sandbox
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
return Promise.reject({
|
|
52
|
-
errCode: "E_ORIGINATE",
|
|
53
|
-
errMsg: "An unexpected error occured when trying to originate a contract",
|
|
54
|
-
previous: err
|
|
55
|
-
})
|
|
56
|
-
}
|
|
37
|
+
const getValidContracts = async (parsedArgs: Opts) => {
|
|
38
|
+
const contracts = parsedArgs.contract
|
|
39
|
+
? [parsedArgs.contract as string]
|
|
40
|
+
: (await glob("**/*.tz", {cwd: parsedArgs.artifactsDir})) as string[]
|
|
41
|
+
|
|
42
|
+
return contracts.reduce(
|
|
43
|
+
(retval, filename) => {
|
|
44
|
+
const storage = getInitialStorage(parsedArgs) (filename)
|
|
45
|
+
if (!storage) throw(`No initial storage provided for ${filename}`)
|
|
46
|
+
return [...retval, {filename, storage}]
|
|
47
|
+
},
|
|
48
|
+
[] as ContractStorageMapping[]
|
|
49
|
+
)
|
|
57
50
|
}
|
|
58
51
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
errMsg: `Please configure a faucet for the ${network} network to be used for origination.`,
|
|
82
|
-
context: network
|
|
83
|
-
})
|
|
52
|
+
const mapOpToContract = async (contracts: ContractStorageMapping[], op: BatchWalletOperation, destination: string) => {
|
|
53
|
+
debugger
|
|
54
|
+
const results = await op.operationResults()
|
|
55
|
+
|
|
56
|
+
return contracts.reduce(
|
|
57
|
+
(retval, contract) => {
|
|
58
|
+
|
|
59
|
+
// If initial storage was provided for the contract
|
|
60
|
+
// then we submitted an operation to originate that contract
|
|
61
|
+
if (contract.storage) {
|
|
62
|
+
const result = results.pop() as OperationContentsAndResultOrigination
|
|
63
|
+
const address = result && result.metadata.operation_result.originated_contracts
|
|
64
|
+
? result.metadata.operation_result.originated_contracts.join(',')
|
|
65
|
+
: 'Error'
|
|
66
|
+
|
|
67
|
+
return [
|
|
68
|
+
...retval, {
|
|
69
|
+
contract: contract.filename,
|
|
70
|
+
address,
|
|
71
|
+
destination
|
|
72
|
+
}
|
|
73
|
+
]
|
|
84
74
|
}
|
|
85
|
-
}
|
|
86
|
-
return Promise.reject({
|
|
87
|
-
errCode: "E_INVALID_NETWORK_URL",
|
|
88
|
-
errMsg: 'The network configuration is invalid and missing the RPC url',
|
|
89
|
-
context: network
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
return Promise.reject({
|
|
94
|
-
errCode: "E_ORIGINATE",
|
|
95
|
-
errMsg: "An unexpected error occured when trying to originate a contract",
|
|
96
|
-
previous: err
|
|
97
|
-
})
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
75
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
76
|
+
return [
|
|
77
|
+
...retval, {
|
|
78
|
+
contract: contract.filename,
|
|
79
|
+
address: "Error",
|
|
80
|
+
destination
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
[] as OriginationResult[]
|
|
85
|
+
)
|
|
105
86
|
}
|
|
106
87
|
|
|
107
|
-
const getSandboxConfig = (sandboxName: string, config: Config) => {
|
|
108
|
-
return !config.sandbox[sandboxName]
|
|
109
|
-
? undefined
|
|
110
|
-
: config.sandbox[sandboxName]
|
|
111
|
-
}
|
|
112
88
|
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
89
|
+
const createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: string) => {
|
|
90
|
+
const contracts = await getValidContracts (parsedArgs)
|
|
91
|
+
|
|
92
|
+
const batch = await contracts.reduce(
|
|
93
|
+
(batch, contractMapping) =>
|
|
94
|
+
contractMapping.storage
|
|
95
|
+
? addOrigination(parsedArgs, batch) (contractMapping)
|
|
96
|
+
: batch,
|
|
97
|
+
Promise.resolve(tezos.wallet.batch())
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
const op = await batch.send()
|
|
102
|
+
const confirmed = await op.confirmation()
|
|
103
|
+
return await mapOpToContract(contracts, op, destination)
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
const error = (err as {message: string})
|
|
107
|
+
if (error.message) sendErr(error.message)
|
|
108
|
+
return undefined
|
|
118
109
|
}
|
|
119
|
-
|
|
120
|
-
return undefined
|
|
121
110
|
}
|
|
122
111
|
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
112
|
+
const originateToNetworks = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>
|
|
113
|
+
currentEnv.networks
|
|
114
|
+
? currentEnv.networks.reduce(
|
|
115
|
+
(retval, networkName) => {
|
|
116
|
+
const network = getNetworkConfig (parsedArgs) (networkName)
|
|
117
|
+
if (network.rpcUrl) {
|
|
118
|
+
if (network.faucet) {
|
|
119
|
+
const result = (async () => {
|
|
120
|
+
const tezos = new TezosToolkit(network.rpcUrl as string)
|
|
121
|
+
await importKey(tezos, network.faucet.email, network.faucet.password, network.faucet.mnemonic.join(' '), network.faucet.activation_code)
|
|
122
|
+
return await createBatch(parsedArgs, tezos, networkName)
|
|
123
|
+
})()
|
|
124
|
+
|
|
125
|
+
return [...retval, result]
|
|
126
|
+
}
|
|
127
|
+
else sendErr(`Network ${networkName} requires a valid faucet in config.json.`)
|
|
128
|
+
}
|
|
129
|
+
else sendErr(`Network "${networkName} is missing an RPC url in config.json."`)
|
|
130
|
+
return retval
|
|
131
|
+
},
|
|
132
|
+
[] as Promise<OriginationResult[]|undefined>[]
|
|
131
133
|
)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
: []
|
|
135
|
+
|
|
136
|
+
const originateToSandboxes = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>
|
|
137
|
+
currentEnv.sandboxes
|
|
138
|
+
? currentEnv.sandboxes.reduce(
|
|
139
|
+
(retval, sandboxName) => {
|
|
140
|
+
const sandbox = getSandboxConfig (parsedArgs) (sandboxName)
|
|
141
|
+
if (sandbox.rpcUrl) {
|
|
142
|
+
const secretKey = getDefaultAccount(parsedArgs) (sandboxName) ?.keys?.secretKey
|
|
143
|
+
if (secretKey) {
|
|
144
|
+
const result = (async () => {
|
|
145
|
+
const tezos = new TezosToolkit(sandbox.rpcUrl as string)
|
|
146
|
+
tezos.setProvider({
|
|
147
|
+
signer: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),
|
|
148
|
+
});
|
|
149
|
+
return await createBatch(parsedArgs, tezos, sandboxName)
|
|
150
|
+
})()
|
|
151
|
+
|
|
152
|
+
return [...retval, result]
|
|
153
|
+
}
|
|
154
|
+
else sendErr(`Sandbox ${sandboxName}'s default account is missing keys in config.json.`)
|
|
155
|
+
}
|
|
156
|
+
else sendErr(`Sandbox "${sandboxName} is missing an RPC url in config.json."`)
|
|
157
|
+
|
|
158
|
+
return retval
|
|
159
|
+
},
|
|
160
|
+
[] as Promise<OriginationResult[]|undefined>[]
|
|
161
|
+
)
|
|
162
|
+
: []
|
|
163
|
+
|
|
164
|
+
|
|
135
165
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
errCode: "E_INVALID_ENV",
|
|
139
|
-
errMsg: `No environment configured in your configuration file called ${parsedArgs.env}`,
|
|
140
|
-
context: parsedArgs.config
|
|
141
|
-
})
|
|
142
|
-
}
|
|
166
|
+
export const originate = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {
|
|
167
|
+
const env = getCurrentEnvironmentConfig(parsedArgs)
|
|
143
168
|
|
|
144
|
-
if (!env
|
|
145
|
-
return
|
|
146
|
-
errCode: "E_INVALID_STORAGE",
|
|
147
|
-
errMsg: `No storage configured in your configuration file for ${contractFilename}`,
|
|
148
|
-
context: env
|
|
149
|
-
})
|
|
169
|
+
if (!env) {
|
|
170
|
+
return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`)
|
|
150
171
|
}
|
|
151
172
|
|
|
152
|
-
const
|
|
153
|
-
(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return Promise.all(allProcesses)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const originateAll = (parsedArgs: Opts) : Promise<unknown[]> =>
|
|
172
|
-
glob("**/*.tz", {cwd: parsedArgs.artifactsDir})
|
|
173
|
-
.then(files => Promise.all(files.map(originateContract(parsedArgs))))
|
|
174
|
-
.then(results => results.flat(1))
|
|
175
|
-
|
|
176
|
-
export const originate = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {
|
|
177
|
-
const p = parsedArgs.contract
|
|
178
|
-
? originateContract(parsedArgs) (parsedArgs.contract as string)
|
|
179
|
-
.then(result => [result])
|
|
180
|
-
: originateAll(parsedArgs)
|
|
181
|
-
|
|
182
|
-
return p.then(data => ({
|
|
183
|
-
status: 'success',
|
|
184
|
-
stdout: data,
|
|
185
|
-
stderr: "",
|
|
186
|
-
render: 'table'
|
|
187
|
-
}))
|
|
188
|
-
.catch(err => err.errCode
|
|
189
|
-
? Promise.resolve({status: 'failed', stdout: '', stderr: err.errMsg, previous: err})
|
|
190
|
-
: Promise.resolve({status: 'failed', stderr: err.getMessage(), stdout: '', previous: err})
|
|
191
|
-
)
|
|
173
|
+
const jobs = [
|
|
174
|
+
...originateToNetworks(parsedArgs, env),
|
|
175
|
+
...originateToSandboxes(parsedArgs, env)
|
|
176
|
+
]
|
|
177
|
+
|
|
178
|
+
return Promise.all(jobs)
|
|
179
|
+
.then(jobs => jobs.reduce(
|
|
180
|
+
(retval, originations) => {
|
|
181
|
+
return originations
|
|
182
|
+
? [...retval as OriginationResult[], ...originations]
|
|
183
|
+
: retval
|
|
184
|
+
},
|
|
185
|
+
[]
|
|
186
|
+
))
|
|
187
|
+
.then(results => results && results.length > 0 ? sendJsonRes(results): sendErr(`No contracts originated.`))
|
|
192
188
|
}
|
|
193
189
|
|
|
194
|
-
export default originate
|
|
190
|
+
export default originate
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-taquito",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A taqueria plugin for originating smart contracts using Taquito",
|
|
5
5
|
"targets": {
|
|
6
6
|
"default": {
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/ecadlabs/taqueria#readme",
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"parcel": "^2.0
|
|
45
|
+
"parcel": "^2.4.0",
|
|
46
46
|
"typescript": "4.5.4"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@
|
|
50
|
-
"@taquito/
|
|
51
|
-
"
|
|
52
|
-
"
|
|
49
|
+
"@taqueria/node-sdk": "^0.3.0",
|
|
50
|
+
"@taquito/signer": "^12.1.0",
|
|
51
|
+
"@taquito/taquito": "^12.1.0",
|
|
52
|
+
"fast-glob": "^3.2.10"
|
|
53
53
|
}
|
|
54
54
|
}
|