@cosmjs/proto-signing
Advanced tools
Comparing version 0.27.1 to 0.28.0-rc1
@@ -5,5 +5,5 @@ import { Coin } from "@cosmjs/amino"; | ||
* | ||
* This is a Stargate ready version of parseCoins from @cosmjs/amino and @cosmjs/launchpad. | ||
* This is a Stargate ready version of parseCoins from @cosmjs/amino. | ||
* It supports more denoms. | ||
*/ | ||
export declare function parseCoins(input: string): Coin[]; |
@@ -8,3 +8,3 @@ "use strict"; | ||
* | ||
* This is a Stargate ready version of parseCoins from @cosmjs/amino and @cosmjs/launchpad. | ||
* This is a Stargate ready version of parseCoins from @cosmjs/amino. | ||
* It supports more denoms. | ||
@@ -11,0 +11,0 @@ */ |
@@ -74,3 +74,6 @@ "use strict"; | ||
const seed = await crypto_1.Bip39.mnemonicToSeed(mnemonicChecked, options.bip39Password); | ||
return new DirectSecp256k1HdWallet(mnemonicChecked, Object.assign(Object.assign({}, options), { seed: seed })); | ||
return new DirectSecp256k1HdWallet(mnemonicChecked, { | ||
...options, | ||
seed: seed, | ||
}); | ||
} | ||
@@ -232,3 +235,3 @@ /** | ||
const { privkey, pubkey } = await this.getKeyPair(hdPath); | ||
const address = encoding_1.Bech32.encode(prefix, (0, amino_1.rawSecp256k1PubkeyToRawAddress)(pubkey)); | ||
const address = (0, encoding_1.toBech32)(prefix, (0, amino_1.rawSecp256k1PubkeyToRawAddress)(pubkey)); | ||
return { | ||
@@ -235,0 +238,0 @@ algo: "secp256k1", |
@@ -30,3 +30,3 @@ "use strict"; | ||
get address() { | ||
return encoding_1.Bech32.encode(this.prefix, (0, amino_1.rawSecp256k1PubkeyToRawAddress)(this.pubkey)); | ||
return (0, encoding_1.toBech32)(this.prefix, (0, amino_1.rawSecp256k1PubkeyToRawAddress)(this.pubkey)); | ||
} | ||
@@ -33,0 +33,0 @@ async getAccounts() { |
@@ -64,15 +64,8 @@ import { TxBody } from "cosmjs-types/cosmos/tx/v1beta1/tx"; | ||
* | ||
* By default, a `new Registry()` constains amost no types. `Coin` and `MsgSend` are in there | ||
* for historic reasons but this does not make a lot of sense. | ||
* If there is no parameter given, a `new Registry()` adds the types `Coin` and `MsgSend` | ||
* for historic reasons. Those can be overriden by customTypes. | ||
* | ||
* There are currently two methods for adding new types: | ||
* 1. Using the `register()` method | ||
* 2. Passing custom types to the constructor. | ||
* This only creates confusion for users. The reason here is historical. | ||
* Using `register()` is recommended and 2. is deprecated because its behaviour | ||
* will change in https://github.com/cosmos/cosmjs/issues/994. | ||
* | ||
* There is currently no way to unregister/override the default types. We should | ||
* change the `customTypes` argument to override the default types if set. | ||
* See https://github.com/cosmos/cosmjs/issues/994 | ||
* 1. Passing types to the constructor. | ||
* 2. Using the `register()` method | ||
*/ | ||
@@ -79,0 +72,0 @@ constructor(customTypes?: Iterable<[string, GeneratedType]>); |
@@ -33,23 +33,17 @@ "use strict"; | ||
* | ||
* By default, a `new Registry()` constains amost no types. `Coin` and `MsgSend` are in there | ||
* for historic reasons but this does not make a lot of sense. | ||
* If there is no parameter given, a `new Registry()` adds the types `Coin` and `MsgSend` | ||
* for historic reasons. Those can be overriden by customTypes. | ||
* | ||
* There are currently two methods for adding new types: | ||
* 1. Using the `register()` method | ||
* 2. Passing custom types to the constructor. | ||
* This only creates confusion for users. The reason here is historical. | ||
* Using `register()` is recommended and 2. is deprecated because its behaviour | ||
* will change in https://github.com/cosmos/cosmjs/issues/994. | ||
* | ||
* There is currently no way to unregister/override the default types. We should | ||
* change the `customTypes` argument to override the default types if set. | ||
* See https://github.com/cosmos/cosmjs/issues/994 | ||
* 1. Passing types to the constructor. | ||
* 2. Using the `register()` method | ||
*/ | ||
constructor(customTypes = []) { | ||
constructor(customTypes) { | ||
const { cosmosCoin, cosmosMsgSend } = defaultTypeUrls; | ||
this.types = new Map([ | ||
[cosmosCoin, coin_1.Coin], | ||
[cosmosMsgSend, tx_1.MsgSend], | ||
...customTypes, | ||
]); | ||
this.types = customTypes | ||
? new Map([...customTypes]) | ||
: new Map([ | ||
[cosmosCoin, coin_1.Coin], | ||
[cosmosMsgSend, tx_1.MsgSend], | ||
]); | ||
} | ||
@@ -114,3 +108,6 @@ register(typeUrl, type) { | ||
const wrappedMessages = txBodyFields.messages.map((message) => this.encodeAsAny(message)); | ||
const txBody = tx_2.TxBody.fromPartial(Object.assign(Object.assign({}, txBodyFields), { messages: wrappedMessages })); | ||
const txBody = tx_2.TxBody.fromPartial({ | ||
...txBodyFields, | ||
messages: wrappedMessages, | ||
}); | ||
return tx_2.TxBody.encode(txBody).finish(); | ||
@@ -133,3 +130,5 @@ } | ||
const decodedTxBody = tx_2.TxBody.decode(txBody); | ||
return Object.assign(Object.assign({}, decodedTxBody), { messages: decodedTxBody.messages.map(({ typeUrl: typeUrl, value }) => { | ||
return { | ||
...decodedTxBody, | ||
messages: decodedTxBody.messages.map(({ typeUrl: typeUrl, value }) => { | ||
if (!typeUrl) { | ||
@@ -142,3 +141,4 @@ throw new Error("Missing type_url in Any"); | ||
return this.decode({ typeUrl, value }); | ||
}) }); | ||
}), | ||
}; | ||
} | ||
@@ -145,0 +145,0 @@ } |
import { OfflineAminoSigner, StdSignature } from "@cosmjs/amino"; | ||
import { SignDoc } from "cosmjs-types/cosmos/tx/v1beta1/tx"; | ||
/** | ||
* This is the same as Algo from @cosmjs/launchpad but those might diverge in the future. | ||
*/ | ||
export declare type Algo = "secp256k1" | "ed25519" | "sr25519"; | ||
/** | ||
* This is the same as AccountData from @cosmjs/launchpad but those might diverge in the future. | ||
*/ | ||
export interface AccountData { | ||
@@ -11,0 +5,0 @@ /** A printable address (typically bech32 encoded) */ |
@@ -29,3 +29,3 @@ "use strict"; | ||
expect(parsedTestTx.authInfo.signerInfos[0].modeInfo.single.mode).toEqual(signing_1.SignMode.SIGN_MODE_DIRECT); | ||
expect(Object.assign({}, parsedTestTx.authInfo.fee.amount[0])).toEqual({ denom: "ucosm", amount: "2000" }); | ||
expect({ ...parsedTestTx.authInfo.fee.amount[0] }).toEqual({ denom: "ucosm", amount: "2000" }); | ||
expect(parsedTestTx.authInfo.fee.gasLimit.toString()).toEqual(gasLimit.toString()); | ||
@@ -32,0 +32,0 @@ expect(parsedTestTx.body.extensionOptions).toEqual([]); |
{ | ||
"name": "@cosmjs/proto-signing", | ||
"version": "0.27.1", | ||
"version": "0.28.0-rc1", | ||
"description": "Utilities for protobuf based signing (Cosmos SDK 0.40+)", | ||
@@ -42,5 +42,5 @@ "contributors": [ | ||
"dependencies": { | ||
"@cosmjs/amino": "0.27.1", | ||
"@cosmjs/crypto": "0.27.1", | ||
"@cosmjs/math": "0.27.1", | ||
"@cosmjs/amino": "0.28.0-rc1", | ||
"@cosmjs/crypto": "0.28.0-rc1", | ||
"@cosmjs/math": "0.28.0-rc1", | ||
"cosmjs-types": "^0.4.0", | ||
@@ -51,4 +51,4 @@ "long": "^4.0.0", | ||
"devDependencies": { | ||
"@cosmjs/encoding": "0.27.1", | ||
"@cosmjs/utils": "0.27.1", | ||
"@cosmjs/encoding": "0.28.0-rc1", | ||
"@cosmjs/utils": "0.28.0-rc1", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
@@ -75,3 +75,3 @@ "@types/eslint-plugin-prettier": "^3", | ||
"jasmine-spec-reporter": "^6", | ||
"karma": "^6.1.1", | ||
"karma": "^6.3.14", | ||
"karma-chrome-launcher": "^3.1.0", | ||
@@ -85,3 +85,2 @@ "karma-firefox-launcher": "^2.1.0", | ||
"source-map-support": "^0.5.19", | ||
"stream-browserify": "^3.0.0", | ||
"ts-node": "^8", | ||
@@ -92,3 +91,4 @@ "typedoc": "^0.22", | ||
"webpack-cli": "^4.6.0" | ||
} | ||
}, | ||
"stableVersion": "0.27.1" | ||
} |
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
37
149935
1905
+ Added@cosmjs/amino@0.28.0-rc1(transitive)
+ Added@cosmjs/crypto@0.28.0-rc1(transitive)
+ Added@cosmjs/encoding@0.28.0-rc1(transitive)
+ Added@cosmjs/math@0.28.0-rc1(transitive)
+ Added@cosmjs/utils@0.28.0-rc1(transitive)
- Removed@cosmjs/amino@0.27.1(transitive)
- Removed@cosmjs/crypto@0.27.1(transitive)
- Removed@cosmjs/encoding@0.27.1(transitive)
- Removed@cosmjs/math@0.27.1(transitive)
- Removed@cosmjs/utils@0.27.1(transitive)
- Removedbip39@3.1.0(transitive)
- Removedhash-base@3.1.0(transitive)
- Removedjs-sha3@0.8.0(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedripemd160@2.0.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsha.js@2.4.11(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updated@cosmjs/amino@0.28.0-rc1
Updated@cosmjs/crypto@0.28.0-rc1
Updated@cosmjs/math@0.28.0-rc1