@taqueria/plugin-taquito 0.0.0-pr-575-e34f9ec4 → 0.0.0-pr-704-db506596
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/README.md +18 -26
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/_readme.eta +0 -44
package/README.md
CHANGED
|
@@ -1,42 +1,34 @@
|
|
|
1
1
|
# Taqueria Taquito Plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is a plugin developed for Taqueria built using TypeScript for NodeJS using the Taqueria Node SDK
|
|
4
4
|
|
|
5
|
-
## Requirements
|
|
6
|
-
|
|
7
|
-
The Taquito plugin has no additional requirements
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
```shell
|
|
13
|
-
taq install @taqueria/plugin-taquito
|
|
14
|
-
```
|
|
6
|
+
This is a plugin developed for Taqueria built using TypeScript for NodeJS using the Taqueria Node SDK and distributed via NPM
|
|
15
7
|
|
|
16
|
-
|
|
8
|
+
The Taquito plugin exposes a compile task in Taqueria which can target one, or all the Taquito contracts in the contracts folder and compile them to Michelson code output to the artifacts folder
|
|
17
9
|
|
|
18
|
-
|
|
10
|
+
## Tasks
|
|
19
11
|
|
|
20
|
-
|
|
12
|
+
The Taquito plugin provides the following tasks to Taqueria:
|
|
13
|
+
- `originate`
|
|
21
14
|
|
|
22
|
-
|
|
15
|
+
## Requirements
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
- Taqueria v0.0.6 or later
|
|
18
|
+
- Node.js v16 or later
|
|
19
|
+
- Docker v0.8.4 or later
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
## Installation
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
The Taquito plugin is distributed as an NPM package that can be installed and uninstalled on a project from the Taqueria CLI
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
To install the LIGO plugin on a Taqueria project, navigate to the project folder and run:
|
|
26
|
+
```shell
|
|
27
|
+
taq install @taqueria/plugin-taquito
|
|
28
|
+
```
|
|
31
29
|
|
|
32
30
|
## Plugin Architecture
|
|
33
31
|
|
|
34
|
-
This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK
|
|
35
|
-
|
|
36
|
-
The plugin provides a single task `originate`, used for originating Michelson contracts to a Tezos network:
|
|
32
|
+
This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK and distributed via NPM
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|------------|:-------------------------|
|
|
40
|
-
| task | 'deploy' |
|
|
41
|
-
| command | 'deploy [contract]` |
|
|
42
|
-
| aliases | ['originate'] |
|
|
34
|
+
For detailed usage and configuration information, view the LIGO plugin documentation on the Taqueria website [here](https://taqueria.io/docs/plugins/plugin-taquito)
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;ACAA;;;;;;AAuBA,MAAM,wCAAkB,GAAG,CAAC,gBAAwB,EAAE,UAAgB,GAClE,gBAAI,CAAC,UAAU,CAAC,YAAY,EAAE,QAAQ,IAAI,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAAA;AAE/G,MAAM,oCAAc,GAAG,CAAC,UAAgB,EAAE,KAAoC,GAAK,OAAO,OAA+B,GAAK;QAC1H,MAAM,eAAe,GAAG,wCAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC;QACxE,MAAM,YAAY,GAAG,MAAM,0BAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;QAC7D,OAAO,AAAC,CAAA,MAAM,KAAK,CAAA,CAAE,eAAe,CAAC;YACjC,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,OAAO,CAAC,OAAO;SAE3B,CAAC,CAAA;KACL;AAAA;AAED,MAAM,uCAAiB,GAAG,OAAO,UAAgB,GAAK;IAClD,MAAM,SAAS,GAAG,UA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b,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":"../"}
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;ACAA;;;;;;AAuBA,MAAM,wCAAkB,GAAG,CAAC,gBAAwB,EAAE,UAAgB,GAClE,gBAAI,CAAC,UAAU,CAAC,YAAY,EAAE,QAAQ,IAAI,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAAA;AAE/G,MAAM,oCAAc,GAAG,CAAC,UAAgB,EAAE,KAAoC,GAAK,OAAO,OAA+B,GAAK;QAC1H,MAAM,eAAe,GAAG,wCAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC;QACxE,MAAM,YAAY,GAAG,MAAM,0BAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;QAC7D,OAAO,AAAC,CAAA,MAAM,KAAK,CAAA,CAAE,eAAe,CAAC;YACjC,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,OAAO,CAAC,OAAO;SAE3B,CAAC,CAAA;KACL;AAAA;AAED,MAAM,uCAAiB,GAAG,OAAO,UAAgB,GAAK;IAClD,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,GAC/B;QAAC,UAAU,CAAC,QAAQ;KAAW,GAC9B,MAAM,yCAAI,CAAC,SAAS,EAAE;QAAC,GAAG,EAAE,UAAU,CAAC,YAAY;KAAC,CAAC,AAAa;IAEzE,OAAO,SAAS,CAAC,MAAM,CACnB,CAAC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,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/package.json
CHANGED
package/_readme.eta
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<% if (it.output == "github") { %>
|
|
2
|
-
# Taqueria Taquito Plugin
|
|
3
|
-
<% } %>
|
|
4
|
-
|
|
5
|
-
The Taquito plugin provides a task to originate a smart contract to a Tezos network
|
|
6
|
-
|
|
7
|
-
## Requirements
|
|
8
|
-
|
|
9
|
-
The Taquito plugin has no additional requirements
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
To install the Taquito plugin on a Taqueria project, navigate to the project folder and run:
|
|
14
|
-
```shell
|
|
15
|
-
taq install @taqueria/plugin-taquito
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Configuration
|
|
19
|
-
|
|
20
|
-
***Coming soon***
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
The Taquito plugin exposes an `originate` task in Taqueria which will originate the specified Michelson contract to the configured network
|
|
25
|
-
|
|
26
|
-
### Originating a Michelson Contract
|
|
27
|
-
|
|
28
|
-
***Coming soon***
|
|
29
|
-
|
|
30
|
-
### Examples
|
|
31
|
-
|
|
32
|
-
***Coming soon***
|
|
33
|
-
|
|
34
|
-
## Plugin Architecture
|
|
35
|
-
|
|
36
|
-
This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK
|
|
37
|
-
|
|
38
|
-
The plugin provides a single task `originate`, used for originating Michelson contracts to a Tezos network:
|
|
39
|
-
|
|
40
|
-
| attribute | value |
|
|
41
|
-
|------------|:-------------------------|
|
|
42
|
-
| task | 'deploy' |
|
|
43
|
-
| command | 'deploy [contract]` |
|
|
44
|
-
| aliases | ['originate'] |
|