-
Notifications
You must be signed in to change notification settings - Fork 96
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
Thorchain client refactor #997
Conversation
export function makeClientPath(fullDerivationPath: string): HdPath { | ||
const out = new Array<Slip10RawIndex>() | ||
let path = `/${fullDerivationPath}` | ||
while (path) { | ||
const match = path.match(/^\/([0-9]+)('?)/) | ||
if (!match) throw new Error('Syntax error while reading path component') | ||
const [fullMatch, numberString, apostrophe] = match | ||
const value = Uint53.fromString(numberString).toNumber() | ||
if (value >= 2 ** 31) throw new Error('Component value too high. Must not exceed 2**31-1.') | ||
if (apostrophe) out.push(Slip10RawIndex.hardened(value)) | ||
else out.push(Slip10RawIndex.normal(value)) | ||
path = path.slice(fullMatch.length) | ||
} | ||
return out | ||
} |
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.
Why don't use function form official package ? https://cosmos.github.io/cosmjs/latest/crypto/modules.html#stringToPath
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.
It can be used, but the default value of the rootDerivationPath has to be changed to 'm' format
With this new commit, client uses the cosmjs function and it is compatible with old packages versions |
Thorchain client migration to use the cosmos-sdk package as its foundation:
Breaking changes:
getPrivateKey
is now async and response is Uint8Array typegetPubKey
is now async and response is Uint8Array typegetDepositTransaction
is deprecated in favour ofgetTransactionData
fetchTransaction
removedsetClientUrl
removedgetClientUrl
removedsetExplorerUrls
removedgetCosmosClient
removedsetNetwork
removedsetChainId
removedgetChainId
removed