luniehq / cosmos-ledger Goto Github PK
View Code? Open in Web Editor NEWLibrary for interacting with the Cosmos Ledger Nano app ๐
Home Page: https://lunie.io
Library for interacting with the Cosmos Ledger Nano app ๐
Home Page: https://lunie.io
In order to allow the use of this across different cosmos-sdk chains, we should allow the ability to define HDPATH and behc32 hrp on object instantiation, rather than hardcoding these as constants.
when I do import Ledger from '@lunie/cosmos-ledger';
I don't get the types. I have a red squiggly saying no types found.
I opened the node_modules folder and found the types there and when I do import Ledger from '@lunie/cosmos-ledger/lib/cosmos-ledger';
it works.
You might need to change something to get these loaded by default
Currently when I directly use Ledger()
i.e.
const ledger = await Ledger().connect()
as instructed in readme, I will get the following error about testModeAllowed
.
Property 'testModeAllowed' is missing in type '{}' but required in type '{ testModeAllowed: Boolean; }
Should the config object and testModeAllowed
flag be optional instead for simpler syntax?
Hi,
I'm developing a block explorer with the ability to delegate tokens for the secret network. We forked our code from hubble but the code they were using to connect with a Ledger wallet was not functional. I decided to use this library along with some code taken from the big dipper to connect with the ledger. I also tried using your cosmos-api/cosmos-js library but I had a lot of problems figuring out how to use those libraries with this one. The main error I've been getting comes from the ledger.sign(msg)
method. I've tried passing a few different things to this method that seem to work in other codebases, but I can't figure out what the issue is here. From looking at the library briefly, it seems like it's saying that ledger.hdPath
isn't a buffer, array, etc. but I know it is from the testing I've done. This is the message I'm currently passing to ledger.sign()
:
"msg": [
{
"type": `cosmos-sdk/Send`,
"value": {
"inputs": [
{
"address": this.publicAddress,
"coins": [{ "denom": `STAKE`, "amount": `1` }]
}
],
"outputs": [
{
"address": App.config.validatorOperatorAddress,
"coins": [{ "denom": `STAKE`, "amount": `1` }]
}
]
}
}
],
"fee": { "amount": [{ "denom": ``, "amount": `0` }], "gas": `21906` },
"signatures": null,
"memo": ``
}
const txSkeleton = {
"type": 'auth/StdTx',
"value": {
"msg": msgs,
"fee": '',
"memo": txContext.value.memo || this.MEMO,
"signatures": [{
"signature": 'N/A',
"account_number": txContext.value.account_number.toString(),
"sequence": txContext.value.sequence.toString(),
"pub_key": {
"type": 'tendermint/PubKeySecp256k1',
"value": txContext.pk || 'PK',
},
}],
},
};```
I've been passing this to `ledger.sign()` like this: `ledger.sign(txSkeleton)` and I get `cosmos-ledger.js:658 Uncaught (in promise) Error: Ledger Native Error: TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.` as an error. I decided to put the message in an array (`ledger.sign([txSkeleton])` and I get `cosmos-ledger.js:658 Uncaught (in promise) Error: Ledger Native Error: Data is invalid : JSON. Zero tokens`. I'm kind of at a loss as to what is happening here. Would very much appreciate any help that would put me on the right path
Is your feature request related to a problem? Please describe.
We have been using Yarn because of the lock file for quiet some time. This is not necessary anymore as npm already since a while has this feature as well. Yarn has some syntax advantages, but it doesn't value the weight of another tool.
Describe the solution you'd like
Remove Yarn from this repository:
Describe alternatives you've considered
Additional context
errorr from type script compile ( fairly strict mode)
ERROR {redacted}node_modules/@lunie/cosmos-ledger/lib/cosmos-ledger.d.ts(4,9):
TS2717: Subsequent property declarations must have the same type. Property 'chrome' must be of type 'typeof chrome', but here has type 'any'.
your Chrome type any is wrong on line 4 of cosmos-ledger.d.ts as it affects other modules that later declare more narrow types causing issues turn to typeof chrome
This error happens when the ledger connection wasn't removed before. This should be translated into "Couldn't access Ledger, please refresh browser". Or try to handle it and clear an existing connection.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.