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

Add http handlers for createclaim/sendclaim #830

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
32 changes: 32 additions & 0 deletions lib/wallet/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,38 @@

return res.json(200, json);
});

// Create Claim
this.get('/wallet/:id/createclaim/:name', async (req, res) => {
const valid = Validator.fromRequest(req);
const name = valid.str('name');

Check failure on line 1447 in lib/wallet/http.js

View workflow job for this annotation

GitHub Actions / Lint & Doc

Trailing spaces not allowed
Comment on lines +1446 to +1447
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const name = valid.str('name');
const name = valid.str('name');

enforce(name, 'Must pass name.');
enforce(rules.verifyName(name), 'Must pass valid name.');

const claim = await req.wallet.createClaim(name);
return res.json(200, {
name: claim.name,
target: claim.target,
value: claim.value,
size: claim.size,
fee: claim.fee,
address: claim.address.toString(this.network),
txt: claim.txt
});
});

// Send Claim
this.post('/wallet/:id/sendclaim/:name', async (req, res) => {
const valid = Validator.fromRequest(req);
const name = valid.str('name');

Check failure on line 1467 in lib/wallet/http.js

View workflow job for this annotation

GitHub Actions / Lint & Doc

Trailing spaces not allowed
Comment on lines +1466 to +1467
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const name = valid.str('name');
const name = valid.str('name');

enforce(name, 'Must pass name.');
enforce(rules.verifyName(name), 'Must pass valid name.');

const claim = await req.wallet.sendClaim(name);
return res.json(200, claim.getJSON(this.network));
});
}

/**
Expand Down
Loading