Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v0.0.1 alpha.10 #9

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.1-alpha.10](https://github.com/DIG-Network/dig-cli/compare/v0.0.1-alpha.9...v0.0.1-alpha.10) (2024-09-10)


### Features

* accept username and password as options when using remote peer command ([b593485](https://github.com/DIG-Network/dig-cli/commit/b593485101fb9179d7752178ab4099f5902a4def))

### [0.0.1-alpha.9](https://github.com/DIG-Network/dig-cli/compare/v0.0.1-alpha.8...v0.0.1-alpha.9) (2024-09-09)

### [0.0.1-alpha.8](https://github.com/DIG-Network/dig-cli/compare/v0.0.1-alpha.7...v0.0.1-alpha.8) (2024-09-09)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dignetwork/dig-chia-cli",
"version": "0.0.1-alpha.9",
"version": "0.0.1-alpha.10",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down
59 changes: 43 additions & 16 deletions src/yargs/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,30 +129,58 @@ export function remoteCommand(yargs: Argv<{}>) {
"peer <value>",
"Set a datastore remote peer",
// @ts-ignore
(yargs: Argv<{ value: string }>) => {
return yargs.positional("value", {
type: "string",
describe: "The peer IP address to set",
});
(
yargs: Argv<{ value: string; username: string; password: string }>
) => {
return yargs
.positional("value", {
type: "string",
describe: "The peer IP address to set",
})
.option("username", {
alias: "u",
type: "string",
describe: "The username for the peer",
demandOption: true,
})
.option("password", {
alias: "p",
type: "string",
describe: "The password for the peer",
demandOption: true,
});
},
async (argv: { value: string }) => {
await handlers.setRemote(argv.value);
async (argv: {
value: string;
username: string;
password: string;
}) => {
console.log(
`Setting peer: ${argv.value}, Username: ${argv.username}`
);
await handlers.setRemote(
argv.value,
argv.username,
argv.password
);
}
)
.command(
"seed <seed> [walletName]",
"Set the mnemonic seed on the remote datastore",
// @ts-ignore
(yargs: Argv<{ seed: string }>) => {
return yargs.positional("seed", {
type: "string",
describe: "The seed phrase to set on the remote",
}).positional("walletName", {
describe: "Optional wallet name to perform the action on",
type: "string",
})
return yargs
.positional("seed", {
type: "string",
describe: "The seed phrase to set on the remote",
})
.positional("walletName", {
describe: "Optional wallet name to perform the action on",
type: "string",
});
},
async (argv: { walletName: string, seed: string }) => {
async (argv: { walletName: string; seed: string }) => {
await handlers.setRemoteSeed(argv.walletName, argv.seed);
}
);
Expand Down Expand Up @@ -188,7 +216,6 @@ export function remoteCommand(yargs: Argv<{}>) {
});
},
async (argv: { action: string; storeId: string }) => {
console.log(argv.action, argv.storeId);
if (argv.action === "subscribe") {
await handlers.subscribeToStore(argv.storeId);
} else if (argv.action === "unsubscribe") {
Expand Down
6 changes: 5 additions & 1 deletion src/yargs/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ export const handlers = {
// await removeStore(writer, oracle_fee, admin);
console.log("Store remove executed");
},
setRemote: async (peer: string) => {
setRemote: async (peer: string, username?: string, password?: string) => {
await setRemote(peer);

if (username && password) {
await login(username, password);
}
},
syncRemoteSeed: async (walletName: string = 'default') => {
console.log("Syncing remote seed");
Expand Down
Loading