-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #275 from Emurgo/develop
Version 1.2.1 Mainnet Release
- Loading branch information
Showing
21 changed files
with
482 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ production-key.pem | |
build/ | ||
dev/ | ||
dll/ | ||
screenshots/ | ||
|
||
*.zip | ||
*.xpi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* eslint-disable camelcase */ | ||
// @flow | ||
import './lib/test-config'; | ||
import { | ||
Wallet, | ||
} from 'rust-cardano-crypto'; | ||
import { | ||
getCryptoDaedalusWalletFromMnemonics, | ||
} from './lib/cardanoCrypto/cryptoWallet'; | ||
import { | ||
decodeRustTx, | ||
} from './lib/utils'; | ||
import cbor from 'cbor'; | ||
import bs58 from 'bs58'; | ||
import { SHA3 } from 'sha3'; | ||
import blake2b from 'blake2b'; | ||
|
||
test('Daedalus transfer from old invalid address', () => { | ||
const words = 'note park thrive ignore spare latin common balance clap soup school tiny'; | ||
const address = 'DdzFFzCqrhsmcx7z25PRkdbeUNqNNW4brhznpVxbm1EknAahjaCFEjYXg9KJRqkixjgGyz8D9GSX3CFDRoNrZyfJsi61N2FxCnq9yWBy'; | ||
const txId = '915f2e6865fb31cc93410efb6c0e580ca74862374b3da461e20135c01f312e7c'; | ||
const txIndex = 0; | ||
const wallet = getCryptoDaedalusWalletFromMnemonics(words); | ||
const input = [{ | ||
ptr: { id: txId, index: txIndex }, | ||
value: '1000000', | ||
addressing: [2147483648, 1316836692] | ||
}]; | ||
const outAddress = 'Ae2tdPwUPEZ4Gg5gmqwW2t7ottKBMjWunmPt7DwKkAGsxx9XNSfWqrE1Gbk'; | ||
const { result: { cbor_encoded_tx, fee } } = Wallet.move(wallet, input, outAddress); | ||
const { tx: { tx: { inputs, outputs }, witnesses } } = decodeRustTx(cbor_encoded_tx); | ||
expect(inputs.length).toEqual(1); | ||
expect(outputs.length).toEqual(1); | ||
expect(witnesses.length).toEqual(1); | ||
expect(inputs[0].id).toEqual(txId); | ||
expect(inputs[0].index).toEqual(txIndex); | ||
expect(outputs[0].address).toEqual(outAddress); | ||
expect(1000000 - parseInt(outputs[0].value, 10)).toEqual(parseInt(fee, 10)); | ||
expect('PkWitness' in witnesses[0]).toEqual(true); | ||
const [pub] = witnesses[0].PkWitness; | ||
const [addressRoot, addressAttr] = cbor.decode(cbor.decode(bs58.decode(address))[0].value); | ||
const addressRootHex = addressRoot.toString('hex'); | ||
const ext = [0, [0, Buffer.from(pub, 'hex')], addressAttr]; | ||
const hash = new SHA3(256); | ||
hash.update(cbor.encode(ext)); | ||
const calculatedRootHex = blake2b(28).update(hash.digest()).digest('hex'); | ||
expect(calculatedRootHex).toEqual(addressRootHex); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule js-cardano-wasm
updated
29 files
+1 −1 | build | |
+11 −0 | cardano-wallet/.appveyor.yml | |
+3 −0 | cardano-wallet/.gitignore | |
+69 −0 | cardano-wallet/.travis.yml | |
+47 −0 | cardano-wallet/Cargo.toml | |
+176 −0 | cardano-wallet/LICENSE_APACHE | |
+25 −0 | cardano-wallet/LICENSE_MIT | |
+46 −0 | cardano-wallet/README.md | |
+16 −0 | cardano-wallet/package.json | |
+1,194 −0 | cardano-wallet/src/lib.rs | |
+17 −0 | cardano-wallet/src/utils.rs | |
+30 −0 | cardano-wallet/tests/index.js | |
+68 −0 | cardano-wallet/tests/paperwallet.rs | |
+52 −0 | cardano-wallet/tests/password_encrypted_data.rs | |
+40 −0 | cardano-wallet/tests/redeem.rs | |
+41 −0 | cardano-wallet/tests/wallet.rs | |
+21 −0 | cardano-wallet/webpack.config.js | |
+62 −0 | js/Redemption.js | |
+1 −1 | js/Wallet.js | |
+2 −0 | js/index.js | |
+4 −5 | js/tests/from-seed.js | |
+82 −0 | js/tests/redemption.js | |
+86 −0 | package-lock.json | |
+4 −1 | package.json | |
+1 −1 | rust | |
+0 −1 | rust-toolchain | |
+22 −6 | wallet-wasm/Cargo.lock | |
+2 −2 | wallet-wasm/Cargo.toml | |
+508 −271 | wallet-wasm/src/lib.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.