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

sendbid - Possible to specify account? #82

Closed
wi-ski opened this issue Dec 16, 2018 · 6 comments
Closed

sendbid - Possible to specify account? #82

wi-ski opened this issue Dec 16, 2018 · 6 comments

Comments

@wi-ski
Copy link
Contributor

wi-ski commented Dec 16, 2018

Hi there - love the project!

TL;DR - Reading through the source code and tinkering, is it possible to sendbid and specify the account to send the bid from?

Edit: More details. I'm using hs-client to sendbids. Looks like:

      const bid = await walletClient.execute("sendbid", [
        newName,
        bidAmount,
        lockupAmount,
      ]);

In the source for hsd - this repo - the rpc module doesn't appear to accept any more params (like the account name) for sendbid.

hsd/lib/wallet/rpc.js

Lines 1896 to 1918 in e0d5775

async sendBid(args, help) {
if (help || args.length !== 3)
throw new RPCError(errs.MISC_ERROR, 'sendbid "name" bid value');
const wallet = this.wallet;
const valid = new Validator(args);
const name = valid.str(0);
const bid = valid.ufixed(1, EXP);
const value = valid.ufixed(2, EXP);
if (!name || !rules.verifyName(name))
throw new RPCError(errs.TYPE_ERROR, 'Invalid name.');
if (bid == null || value == null)
throw new RPCError(errs.TYPE_ERROR, 'Invalid values.');
if (bid > value)
throw new RPCError(errs.TYPE_ERROR, 'Invalid bid.');
const tx = await wallet.sendBid(name, bid, value);
return tx.getJSON(this.network);
}

However...

The interface for the wallet seems to expect the account as an optional param - see:

hsd/lib/wallet/wallet.js

Lines 1668 to 1673 in 592b276

async createBid(name, value, lockup, options) {
const acct = options ? options.account || 0 : 0;
const mtx = await this.makeBid(name, value, lockup, acct);
await this.fill(mtx, options);
return this.finalize(mtx, options);
}

🕵️‍♂️ If that's the whole picture - whats the best way to specify a bid's account?

Would a patch be necessary/helpful? It would have to be across two libs I suppose... hsd and hs-client.

@hschoenburg
Copy link

Here is an example from the hsw-cli tool that might be helpful
https://github.com/handshake-org/hs-client/blob/master/bin/hsw-cli#L49

@wi-ski
Copy link
Contributor Author

wi-ski commented Dec 18, 2018

Thank you for the pointer :) What specifically were you trying to illustrate?

Apologies if I am being a complete idiot 🙏

@wi-ski wi-ski closed this as completed Dec 18, 2018
@wi-ski wi-ski reopened this Dec 18, 2018
@wi-ski
Copy link
Contributor Author

wi-ski commented Dec 24, 2018

☝️ Apologies for that spam - I hit the "Close and comment" button, that thing is my cryptonite.

@wi-ski
Copy link
Contributor Author

wi-ski commented Jan 3, 2019

This PR: #86 does stuff. I can pass the accountIndex as a param.

It doesn't feel right honestly. Like, exposing the notion of account indices in the hs-client? Halp me.

@wi-ski
Copy link
Contributor Author

wi-ski commented Jan 4, 2019

Alt Text
☝️ How I feel right now. Braving the wilds of FOSS

...but lets face it...

Im really more like...
Alt Text

@pinheadmz
Copy link
Member

pinheadmz commented Mar 30, 2020

closed by.... something, not sure what. But you can do this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants