-
Notifications
You must be signed in to change notification settings - Fork 18
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
Implement Cosmos connection #1285
Conversation
4ef8e69
to
600ac92
Compare
CI is currently failing in browsers because CORS is not enabled on the Cosmos Gaia REST server. See cosmos/cosmos-sdk#4622 Edit: Working with hack - 3c82059 |
0e92c2b
to
a2d1e01
Compare
b293643
to
e40f964
Compare
fac84ab
to
0af02ad
Compare
52c3c0b
to
e234967
Compare
@willclarktech can you please update this PR? |
e234967
to
0af441d
Compare
@@ -94,6 +94,10 @@ export class HdPaths { | |||
return HdPaths.bip44(HdPaths.coinTypes.eth, 0, 0, account); | |||
} | |||
|
|||
public static cosmos(account: number): readonly Slip10RawIndex[] { | |||
return HdPaths.bip44(HdPaths.coinTypes.atom, 0, 0, account); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a documentation link for this path? My usual source (https://github.com/trezor/trezor-firmware/blob/master/core/docs/misc/coins-bip44-paths.md) does not list Cosmos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Coin type is listed here: https://github.com/satoshilabs/slips/blob/master/slip-0044.md
- Account we're choosing to set to 0 for simplicity.
- Change address doesn't apply (so 0).
account
is really address index.
See https://github.com/cosmos/cosmos-sdk/blob/2c96bbb/crypto/keys/types.go#L34-L36
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That cosmos SDK link is very helpful. There however, a two dimentional space is create (account
and index
but let's ignore the naming of the axes for now). In https://github.com/cosmos/cosmos-sdk/blob/v0.37.4/client/keys/add.go#L39-L259 it looks like both dimensions are used.
It would be interesting to find out what wallets typically do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Cosmostation uses the same but only uses 0 for address index: https://github.com/cosmostation/cosmosjs/blob/master/src/index.js#L20
- As does Lunie: https://github.com/luniehq/cosmos-keys/blob/7fe5bb4b85d40b6272cfccc12f1ff3a5f0ee380e/src/cosmos-keys.ts#L8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally a confirmation here! cosmos/cosmos-sdk#4278 (comment)
Part 2 of #1220
Merge after #1284
Connection methods not implemented:
getToken
/getAllTokens
: no obvious (documented) way to query for these via the REST API