@cosmjs/ledger-amino
Advanced tools
Comparing version 0.25.0-alpha.1 to 0.25.0-alpha.2
@@ -1,2 +0,2 @@ | ||
import { StdSignature } from "@cosmjs/launchpad"; | ||
import { StdSignature } from "@cosmjs/amino"; | ||
import { LedgerSigner } from "../ledgersigner"; | ||
@@ -3,0 +3,0 @@ export declare function createSigner(): Promise<LedgerSigner>; |
@@ -8,4 +8,4 @@ "use strict"; | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
const amino_1 = require("@cosmjs/amino"); | ||
const encoding_1 = require("@cosmjs/encoding"); | ||
const launchpad_1 = require("@cosmjs/launchpad"); | ||
const hw_transport_node_hid_1 = __importDefault(require("@ledgerhq/hw-transport-node-hid")); | ||
@@ -25,3 +25,3 @@ const ledgersigner_1 = require("../ledgersigner"); | ||
testModeAllowed: true, | ||
hdPaths: [launchpad_1.makeCosmoshubPath(0), launchpad_1.makeCosmoshubPath(1), launchpad_1.makeCosmoshubPath(2), launchpad_1.makeCosmoshubPath(10)], | ||
hdPaths: [amino_1.makeCosmoshubPath(0), amino_1.makeCosmoshubPath(1), amino_1.makeCosmoshubPath(2), amino_1.makeCosmoshubPath(10)], | ||
}); | ||
@@ -51,3 +51,3 @@ } | ||
]; | ||
const signDoc = launchpad_1.makeSignDoc(msgs, defaultFee, defaultChainId, defaultMemo, accountNumber, defaultSequence); | ||
const signDoc = amino_1.makeSignDoc(msgs, defaultFee, defaultChainId, defaultMemo, accountNumber, defaultSequence); | ||
const { signature } = await signer.signAmino(fromAddress, signDoc); | ||
@@ -54,0 +54,0 @@ return signature; |
@@ -6,4 +6,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const amino_1 = require("@cosmjs/amino"); | ||
const encoding_1 = require("@cosmjs/encoding"); | ||
const launchpad_1 = require("@cosmjs/launchpad"); | ||
const math_1 = require("@cosmjs/math"); | ||
@@ -64,3 +64,3 @@ const utils_1 = require("@cosmjs/utils"); | ||
testModeAllowed: true, | ||
hdPaths: [launchpad_1.makeCosmoshubPath(0), launchpad_1.makeCosmoshubPath(1), launchpad_1.makeCosmoshubPath(2)], | ||
hdPaths: [amino_1.makeCosmoshubPath(0), amino_1.makeCosmoshubPath(1), amino_1.makeCosmoshubPath(2)], | ||
}); | ||
@@ -67,0 +67,0 @@ }; |
@@ -7,5 +7,5 @@ "use strict"; | ||
exports.LaunchpadLedger = void 0; | ||
const amino_1 = require("@cosmjs/amino"); | ||
const crypto_1 = require("@cosmjs/crypto"); | ||
const encoding_1 = require("@cosmjs/encoding"); | ||
const launchpad_1 = require("@cosmjs/launchpad"); | ||
const utils_1 = require("@cosmjs/utils"); | ||
@@ -18,3 +18,3 @@ const ledger_cosmos_js_1 = __importDefault(require("ledger-cosmos-js")); | ||
} | ||
const cosmosHdPath = launchpad_1.makeCosmoshubPath(0); | ||
const cosmosHdPath = amino_1.makeCosmoshubPath(0); | ||
const cosmosBech32Prefix = "cosmos"; | ||
@@ -21,0 +21,0 @@ const requiredCosmosAppVersion = "1.5.3"; |
/// <reference types="ledgerhq__hw-transport" /> | ||
import { AccountData, OfflineSigner, StdSignDoc } from "@cosmjs/launchpad"; | ||
import { AminoSignResponse } from "@cosmjs/launchpad"; | ||
import { AccountData, AminoSignResponse, OfflineAminoSigner, StdSignDoc } from "@cosmjs/amino"; | ||
import Transport from "@ledgerhq/hw-transport"; | ||
import { LaunchpadLedgerOptions } from "./launchpadledger"; | ||
export declare class LedgerSigner implements OfflineSigner { | ||
export declare class LedgerSigner implements OfflineAminoSigner { | ||
private readonly ledger; | ||
@@ -8,0 +7,0 @@ private readonly hdPaths; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LedgerSigner = void 0; | ||
const launchpad_1 = require("@cosmjs/launchpad"); | ||
const launchpad_2 = require("@cosmjs/launchpad"); | ||
const amino_1 = require("@cosmjs/amino"); | ||
const launchpadledger_1 = require("./launchpadledger"); | ||
class LedgerSigner { | ||
constructor(transport, options = {}) { | ||
this.hdPaths = options.hdPaths || [launchpad_1.makeCosmoshubPath(0)]; | ||
this.hdPaths = options.hdPaths || [amino_1.makeCosmoshubPath(0)]; | ||
this.ledger = new launchpadledger_1.LaunchpadLedger(transport, options); | ||
@@ -29,3 +28,3 @@ } | ||
} | ||
const message = launchpad_2.serializeSignDoc(signDoc); | ||
const message = amino_1.serializeSignDoc(signDoc); | ||
const accountForAddress = accounts[accountIndex]; | ||
@@ -36,3 +35,3 @@ const hdPath = this.hdPaths[accountIndex]; | ||
signed: signDoc, | ||
signature: launchpad_1.encodeSecp256k1Signature(accountForAddress.pubkey, signature), | ||
signature: amino_1.encodeSecp256k1Signature(accountForAddress.pubkey, signature), | ||
}; | ||
@@ -39,0 +38,0 @@ } |
@@ -23,2 +23,3 @@ "use strict"; | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
const amino_1 = require("@cosmjs/amino"); | ||
const crypto_1 = require("@cosmjs/crypto"); | ||
@@ -50,3 +51,3 @@ const encoding_1 = require("@cosmjs/encoding"); | ||
const defaultFee = { | ||
amount: launchpad_1.coins(100, "ucosm"), | ||
amount: amino_1.coins(100, "ucosm"), | ||
gas: "250", | ||
@@ -61,5 +62,5 @@ }; | ||
if (testutils_spec_1.simappEnabled()) { | ||
const wallet = await launchpad_1.Secp256k1HdWallet.fromMnemonic(testutils_spec_1.faucet.mnemonic); | ||
const wallet = await amino_1.Secp256k1HdWallet.fromMnemonic(testutils_spec_1.faucet.mnemonic); | ||
const client = await stargate_1.SigningStargateClient.connectWithSigner(testutils_spec_1.simapp.endpoint, wallet); | ||
const amount = launchpad_1.coins(226644, "ucosm"); | ||
const amount = amino_1.coins(226644, "ucosm"); | ||
const memo = "Ensure chain has my pubkey"; | ||
@@ -85,3 +86,3 @@ const sendResult = await client.sendTokens(testutils_spec_1.faucet.address, defaultLedgerAddress, amount, memo); | ||
testModeAllowed: true, | ||
hdPaths: [launchpad_1.makeCosmoshubPath(0), launchpad_1.makeCosmoshubPath(1), launchpad_1.makeCosmoshubPath(10)], | ||
hdPaths: [amino_1.makeCosmoshubPath(0), amino_1.makeCosmoshubPath(1), amino_1.makeCosmoshubPath(10)], | ||
}); | ||
@@ -118,3 +119,3 @@ const accounts = await signer.getAccounts(); | ||
testModeAllowed: true, | ||
hdPaths: [launchpad_1.makeCosmoshubPath(0), launchpad_1.makeCosmoshubPath(1), launchpad_1.makeCosmoshubPath(10)], | ||
hdPaths: [amino_1.makeCosmoshubPath(0), amino_1.makeCosmoshubPath(1), amino_1.makeCosmoshubPath(10)], | ||
}); | ||
@@ -126,3 +127,3 @@ const [firstAccount] = await signer.getAccounts(); | ||
value: { | ||
amount: launchpad_1.coins(1234567, "ucosm"), | ||
amount: amino_1.coins(1234567, "ucosm"), | ||
from_address: firstAccount.address, | ||
@@ -133,6 +134,6 @@ to_address: defaultLedgerAddress, | ||
]; | ||
const signDoc = launchpad_1.makeSignDoc(msgs, defaultFee, defaultChainId, defaultMemo, defaultAccountNumber, defaultSequence); | ||
const signDoc = amino_1.makeSignDoc(msgs, defaultFee, defaultChainId, defaultMemo, defaultAccountNumber, defaultSequence); | ||
const { signed, signature } = await signer.signAmino(firstAccount.address, signDoc); | ||
expect(signed).toEqual(signDoc); | ||
const valid = await crypto_1.Secp256k1.verifySignature(crypto_1.Secp256k1Signature.fromFixedLength(encoding_1.fromBase64(signature.signature)), crypto_1.sha256(launchpad_1.serializeSignDoc(signed)), firstAccount.pubkey); | ||
const valid = await crypto_1.Secp256k1.verifySignature(crypto_1.Secp256k1Signature.fromFixedLength(encoding_1.fromBase64(signature.signature)), crypto_1.sha256(amino_1.serializeSignDoc(signed)), firstAccount.pubkey); | ||
expect(valid).toEqual(true); | ||
@@ -145,7 +146,7 @@ }, interactiveTimeout); | ||
testModeAllowed: true, | ||
hdPaths: [launchpad_1.makeCosmoshubPath(0), launchpad_1.makeCosmoshubPath(1), launchpad_1.makeCosmoshubPath(10)], | ||
hdPaths: [amino_1.makeCosmoshubPath(0), amino_1.makeCosmoshubPath(1), amino_1.makeCosmoshubPath(10)], | ||
}); | ||
const [firstAccount] = await signer.getAccounts(); | ||
const client = new launchpad_1.SigningCosmosClient(testutils_spec_1.launchpad.endpoint, firstAccount.address, signer); | ||
const result = await client.sendTokens(defaultLedgerAddress, launchpad_1.coins(1234567, "ucosm")); | ||
const result = await client.sendTokens(defaultLedgerAddress, amino_1.coins(1234567, "ucosm")); | ||
launchpad_1.assertIsBroadcastTxSuccess(result); | ||
@@ -158,7 +159,7 @@ }, interactiveTimeout); | ||
testModeAllowed: true, | ||
hdPaths: [launchpad_1.makeCosmoshubPath(0), launchpad_1.makeCosmoshubPath(1), launchpad_1.makeCosmoshubPath(10)], | ||
hdPaths: [amino_1.makeCosmoshubPath(0), amino_1.makeCosmoshubPath(1), amino_1.makeCosmoshubPath(10)], | ||
}); | ||
const [firstAccount] = await signer.getAccounts(); | ||
const client = await stargate_1.SigningStargateClient.connectWithSigner(testutils_spec_1.simapp.endpoint, signer); | ||
const result = await client.sendTokens(firstAccount.address, defaultLedgerAddress, launchpad_1.coins(1234, "ucosm")); | ||
const result = await client.sendTokens(firstAccount.address, defaultLedgerAddress, amino_1.coins(1234, "ucosm")); | ||
stargate_1.assertIsBroadcastTxSuccess(result); | ||
@@ -165,0 +166,0 @@ }, interactiveTimeout); |
{ | ||
"name": "@cosmjs/ledger-amino", | ||
"version": "0.25.0-alpha.1", | ||
"version": "0.25.0-alpha.2", | ||
"description": "A library for signing Amino-encoded transactions using Ledger devices", | ||
@@ -40,4 +40,4 @@ "contributors": [ | ||
"dependencies": { | ||
"@cosmjs/launchpad": "^0.25.0-alpha.1", | ||
"@cosmjs/utils": "^0.25.0-alpha.1", | ||
"@cosmjs/amino": "^0.25.0-alpha.2", | ||
"@cosmjs/utils": "^0.25.0-alpha.2", | ||
"ledger-cosmos-js": "^2.1.8", | ||
@@ -47,3 +47,4 @@ "semver": "^7.3.2" | ||
"devDependencies": { | ||
"@cosmjs/stargate": "^0.25.0-alpha.1", | ||
"@cosmjs/launchpad": "^0.25.0-alpha.2", | ||
"@cosmjs/stargate": "^0.25.0-alpha.2", | ||
"@ledgerhq/hw-transport": "^5.25.0", | ||
@@ -56,3 +57,3 @@ "@ledgerhq/hw-transport-node-hid": "^5.25.0", | ||
}, | ||
"gitHead": "906b259dd0b179e7acd7b05b22f7671e87d77796" | ||
"gitHead": "76f107db0f0995f09e728f07ac67a02aaa673c6a" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60067
8
620
- Removed@cosmjs/launchpad@^0.25.0-alpha.1
- Removed@cosmjs/launchpad@0.25.6(transitive)
- Removedaxios@0.21.4(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfollow-redirects@1.15.9(transitive)