Skip to content

Commit

Permalink
chore: Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanpaudel93 committed May 5, 2024
1 parent ab49681 commit ef56fa6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 27 deletions.
40 changes: 16 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![JSDocs][jsdocs-src]][jsdocs-href]
[![License][license-src]][license-href]

A package to deploy AO contracts.
A package for deploying AO contracts.

## Installation

Expand Down Expand Up @@ -52,32 +52,26 @@ Options:
-w, --wallet [wallet] Path to the wallet JWK file.
-l, --lua-path [luaPath] Specify the Lua modules path seperated by semicolon.
-d, --deploy [deploy] List of deployment configuration names, separated by commas.
-s, --scheduler [scheduler] Scheduler to use for the process. (default: "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA")
-s, --scheduler [scheduler] Scheduler to be used for the process. (default: "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA")
-m, --module [module] Module source for spawning the process.
-c, --cron [interval] Cron interval for the process (e.g. 1-minute, 5-minutes).
-t, --tags [tags...] Additional tags for spawning the process.
-p, --process-id [processId] Process Id of existing process.
-p, --process-id [processId] Specify process Id of existing process.
--concurrency [limit] Concurrency limit for deploying multiple processes. (default: "5")
--retry-count [count] Number of retries for deploying contract. (default: "10")
--retry-delay [delay] Delay between retries in milliseconds. (default: "3000")
-h, --help display help for command
```

#### CLI Example
#### CLI Examples

```sh
ao-deploy process.lua -n tictactoe -w wallet.json --tags name1:value1 name2:value2
```

OR,
##### Deployment with configuration

```sh
aod process.lua -n tictactoe -w wallet.json --tags name1:value1 name2:value2
```

#### CLI Example with Deployment configuration

Here is an example of a deployment configuration.
Here is an example using a deployment configuration:

```ts
// aod.config.ts
Expand Down Expand Up @@ -110,13 +104,13 @@ const config = defineConfig({
export default config
```

You can deploy all the contracts using the above config file with the following command:
Deploy all specified contracts:

```sh
ao-deploy aod.config.ts
```

You can deploy particular contracts using the above config file with the following command:
Deploy specific contracts:

```sh
ao-deploy aod.config.ts --deploy=contract_1,contract_3
Expand All @@ -125,17 +119,17 @@ ao-deploy aod.config.ts --deploy=contract_1,contract_3
> [!Note]
A wallet is generated and saved if not passed.

Run this command to get the generated wallet path:
Retrieve the generated wallet path:

```sh
node -e "const path = require('path'); const os = require('os'); console.log(path.resolve(os.homedir(), '.aos.json'));"
```

### Code
### API Usage

To deploy a contract, you need to import and call the `deployContract` function from your script. Here is a basic example:

#### Example: deployConfig
#### Example: deployContract

```ts
import { deployContract } from 'ao-deploy'
Expand All @@ -159,8 +153,7 @@ async function main() {
console.log(`\nDeployed Process: ${processUrl} \nDeployment Message: ${messageUrl}`)
}
catch (error: any) {
console.log('Deployment failed!')
console.log(error?.message ?? 'Failed to deploy contract!')
console.log(`Deployment failed!: ${error?.message ?? 'Failed to deploy contract!'}\n`)
}
}

Expand Down Expand Up @@ -213,24 +206,23 @@ async function main() {
delay: 3000,
},
}
]
],
2
)
results.forEach((result, idx) => {
const configName = deployConfigs[idx].configName!
if (result.status === 'fulfilled') {
const { processId, messageId } = result.value
const processUrl = `https://ao_marton.g8way.io/#/process/${processId}`
const messageUrl = `${processUrl}/${messageId}`
console.log(`\nDeployed Process: ${processUrl} \nDeployment Message: ${messageUrl}`)
}
else {
console.log(`Failed to deploy contract!: ${result.reason}`)
console.log(`Failed to deploy contract!: ${result.reason}\n`)
}
})
}
catch (error: any) {
console.log('Deployment failed!')
console.log(error?.message ?? 'Failed to deploy contract!')
console.log(`Deployment failed!: ${error?.message ?? 'Failed to deploy contract!'}\n`)
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "module",
"version": "0.1.4",
"packageManager": "[email protected]",
"description": "A package to deploy AO contracts",
"description": "A package for deploying AO contracts",
"author": "Pawan Paudel <[email protected]>",
"license": "MIT",
"funding": "https://github.com/sponsors/pawanpaudel93",
Expand Down
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ program
.option('-w, --wallet [wallet]', 'Path to the wallet JWK file.')
.option('-l, --lua-path [luaPath]', 'Specify the Lua modules path seperated by semicolon.')
.option('-d, --deploy [deploy]', 'List of deployment configuration names, separated by commas.')
.option('-s, --scheduler [scheduler]', 'Scheduler to use for the process.', '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA')
.option('-s, --scheduler [scheduler]', 'Scheduler to be used for the process.', '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA')
.option('-m, --module [module]', 'Module source for spawning the process.')
.option('-c, --cron [interval]', 'Cron interval for the process (e.g. 1-minute, 5-minutes).')
.option('-t, --tags [tags...]', 'Additional tags for spawning the process.')
.option('-p, --process-id [processId]', 'Process Id of existing process.')
.option('-p, --process-id [processId]', 'Specify process Id of an existing process.')
.option('--concurrency [limit]', 'Concurrency limit for deploying multiple processes.', '5')
.option('--retry-count [count]', 'Number of retries for deploying contract.', '10')
.option('--retry-delay [delay]', 'Delay between retries in milliseconds.', '3000')
Expand Down

0 comments on commit ef56fa6

Please sign in to comment.