Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Upgrade IOV-Core to 0.13 #322

Merged
merged 3 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ module.exports = {
// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],

// The path to a module that runs some code to configure or set up the testing framework before each test
setupTestFrameworkScriptFile: "<rootDir>/config/jest/jest.setup.js",
// A list of paths to modules that run some code to configure or set up the testing framework before each test.
setupFilesAfterEnv: ["<rootDir>/config/jest/jest.setup.js"],

// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@
"surge": "surge"
},
"dependencies": {
"@iov/bns": "^0.12.2",
"@iov/core": "^0.12.2",
"@iov/crypto": "^0.12.2",
"@iov/ethereum": "^0.12.2",
"@iov/faucets": "^0.12.2",
"@iov/keycontrol": "^0.12.2",
"@iov/lisk": "^0.12.2",
"@iov/stream": "^0.12.0",
"@iov/bns": "^0.13.0",
"@iov/core": "^0.13.0",
"@iov/crypto": "^0.13.0",
"@iov/ethereum": "^0.13.0",
"@iov/faucets": "^0.13.0",
"@iov/keycontrol": "^0.13.0",
"@iov/lisk": "^0.13.0",
"@iov/stream": "^0.13.0",
"@material-ui/core": "^3.5.1",
"@material-ui/icons": "^3.0.1",
"@sentry/browser": "4.5.2",
"classnames": "^2.2.6",
"config": "^2.0.1",
"connected-react-router": "^6.0.0",
"encoding-down": "^5.0.4",
"encoding-down": "^6.0.1",
"file-saver": "^2.0.1",
"final-form": "^4.11.0",
"history": "^4.7.2",
"level-js": "^3.0.0",
"levelup": "^3.1.1",
"level-js": "^4.0.0",
"levelup": "^4.0.0",
"lodash": "^4.17.11",
"memdown": "^3.0.0",
"postcss-flexbugs-fixes": "^4.1.0",
Expand Down Expand Up @@ -99,7 +99,7 @@
"babel-loader": "^8.0.4",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"jest": "^23.6.0",
"jest": "^24.5.0",
"mini-css-extract-plugin": "^0.4.3",
"node-sass": "^4.10.0",
"prettier": "^1.14.3",
Expand All @@ -112,7 +112,7 @@
"source-map-support": "^0.5.9",
"surge": "^0.20.1",
"ts-import-plugin": "^1.5.5",
"ts-jest": "^23.10.5",
"ts-jest": "^24.0.0",
"ts-loader": "^4.4.1",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/test/selector.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Amount } from "@iov/bcp-types";
import { Amount } from "@iov/bcp";
import { TokenTicker } from "@iov/core";
import { randomString } from "~/logic/testhelpers";
import { aNewStore } from "~/store";
Expand Down
2 changes: 1 addition & 1 deletion src/components/subComponents/typography/balanceInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
// import styled from "styled-components";

// import { BcpCoin } from "@iov/bcp-types";
// import { BcpCoin } from "@iov/bcp";

// import { coinToString } from "../../../logic";

Expand Down
2 changes: 1 addition & 1 deletion src/logic/account.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Account, Amount, BlockInfoSucceeded, TokenTicker } from "@iov/bcp-types";
import { Account, Amount, BlockInfoSucceeded, TokenTicker } from "@iov/bcp";
import { BnsConnection } from "@iov/bns";
import { MultiChainSigner } from "@iov/core";

Expand Down
52 changes: 26 additions & 26 deletions src/logic/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import {
BcpConnection,
ChainId,
ConfirmedTransaction,
Fee,
isConfirmedTransaction,
PostTxResponse,
PublicIdentity,
SendTransaction,
TokenTicker,
TxCodec,
} from "@iov/bcp-types";
} from "@iov/bcp";
import { BnsConnection, RegisterUsernameTx } from "@iov/bns";
import { ChainAddressPair } from "@iov/bns/types/types";
import { MultiChainSigner, UserProfile } from "@iov/core";
Expand Down Expand Up @@ -119,31 +120,33 @@ export async function sendTransaction(
amount: Amount,
memo?: string,
): Promise<PostTxResponse> {
const { walletId, identity: signer } = getWalletAndIdentity(profile, chainId);
const gasPrice = {
quantity: "20000000000",
fractionalDigits: 18,
tokenTicker: "ETH" as TokenTicker,
};
const gasLimit = {
quantity: "2100000",
fractionalDigits: 18,
tokenTicker: "ETH" as TokenTicker,
};
const { identity: creator } = getWalletAndIdentity(profile, chainId);

let fee: Fee | undefined;
if (chainId.startsWith("ethereum-")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice trick here.
we really should use getFeeQuote... but I guess this won't be until 0.14?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming after iov-one/iov-core#857 in 0.13.1

fee = {
gasPrice: {
quantity: "20000000000",
fractionalDigits: 18,
tokenTicker: "ETH" as TokenTicker,
},
gasLimit: {
quantity: "2100000",
fractionalDigits: 18,
tokenTicker: "ETH" as TokenTicker,
},
};
}

const unsigned: SendTransaction = {
kind: "bcp/send",
creator: {
chainId: chainId,
pubkey: signer.pubkey,
},
creator: creator,
recipient: recipient,
memo: memo || undefined, // use undefined not "" for compatibility with golang codec
amount,
// TODO: don't set gasPrice/gasLimit for non-Ethereum blockchains
gasPrice: gasPrice,
gasLimit: gasLimit,
fee: fee,
};
return writer.signAndPost(unsigned, walletId);
return writer.signAndPost(unsigned);
}

// registers a new username nft on the bns with the given list of chain-address pairs
Expand All @@ -154,15 +157,12 @@ export async function setName(
username: string,
addresses: ReadonlyArray<ChainAddressPair>,
): Promise<PostTxResponse> {
const { walletId, identity: signer } = getWalletAndIdentity(profile, bnsId);
const { identity: creator } = getWalletAndIdentity(profile, bnsId);
const unsigned: RegisterUsernameTx = {
kind: "bns/register_username",
creator: {
chainId: bnsId,
pubkey: signer.pubkey,
},
creator: creator,
username,
addresses,
};
return writer.signAndPost(unsigned, walletId);
return writer.signAndPost(unsigned);
}
2 changes: 1 addition & 1 deletion src/logic/balances.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TokenTicker } from "@iov/bcp-types";
import { TokenTicker } from "@iov/bcp";

import {
amountToString,
Expand Down
2 changes: 1 addition & 1 deletion src/logic/balances.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Amount, TokenTicker } from "@iov/bcp-types";
import { Amount, TokenTicker } from "@iov/bcp";
import { Omit } from "recompose";

export type Figures = Omit<Amount, "tokenTicker">;
Expand Down
2 changes: 1 addition & 1 deletion src/logic/connection.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BcpTicker } from "@iov/bcp-types";
import { BcpTicker } from "@iov/bcp";
import { MultiChainSigner } from "@iov/core";

import { addBlockchain } from "./connection";
Expand Down
2 changes: 1 addition & 1 deletion src/logic/connection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BcpConnection, ChainConnector, PublicIdentity, TxCodec } from "@iov/bcp-types";
import { BcpConnection, ChainConnector, PublicIdentity, TxCodec } from "@iov/bcp";
import { bnsCodec, bnsConnector } from "@iov/bns";
import { ChainId, MultiChainSigner, UserProfile } from "@iov/core";
import { ethereumCodec, ethereumConnector } from "@iov/ethereum";
Expand Down
2 changes: 1 addition & 1 deletion src/logic/faucet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address } from "@iov/bcp-types";
import { Address } from "@iov/bcp";
import { TokenTicker } from "@iov/core";
import { IovFaucet } from "@iov/faucets";

Expand Down
2 changes: 1 addition & 1 deletion src/logic/name.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address, ChainId, TxReadCodec } from "@iov/bcp-types";
import { Address, ChainId, TxReadCodec } from "@iov/bcp";
import { BnsConnection, BnsUsernameNft } from "@iov/bns";

import { getAddressByName } from "./account";
Expand Down
2 changes: 1 addition & 1 deletion src/logic/profile.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, PublicIdentity } from "@iov/bcp-types";
import { ChainId, PublicIdentity } from "@iov/bcp";
import { UserProfile } from "@iov/keycontrol";

import { createMemDb } from "./db";
Expand Down
4 changes: 2 additions & 2 deletions src/logic/profile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, PublicIdentity } from "@iov/bcp-types";
import { ChainId, PublicIdentity } from "@iov/bcp";
import { Bip39, Random, Slip10RawIndex } from "@iov/crypto";
import { Ed25519HdWallet, HdPaths, Secp256k1HdWallet, UserProfile, WalletId } from "@iov/keycontrol";

Expand Down Expand Up @@ -53,7 +53,7 @@ function selectWalletAndPath(
case "lsk":
return { walletId: edWallet, path: HdPaths.bip44Like(134, 0) };
case "eth":
return { walletId: secWallet, path: HdPaths.metamaskHdKeyTree(0) };
return { walletId: secWallet, path: HdPaths.ethereum(0) };
default:
throw new Error(`unsupported codec: ${codecType}`);
}
Expand Down
13 changes: 4 additions & 9 deletions src/logic/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
SendTransaction,
TxCodec,
UnsignedTransaction,
} from "@iov/bcp-types";
} from "@iov/bcp";
import { BnsConnection, RegisterBlockchainTx } from "@iov/bns";
import { MultiChainSigner, UserProfile } from "@iov/core";
import { ReadonlyDate } from "readonly-date";
Expand Down Expand Up @@ -84,16 +84,11 @@ export async function checkBnsBlockchainNft(
): Promise<void> {
const result = await connection.getBlockchains({ chainId });
if (result.length === 0) {
const registryChainId = await connection.chainId();

const { walletId, identity: signer } = getWalletAndIdentity(profile, connection.chainId());
const { identity: creator } = getWalletAndIdentity(profile, connection.chainId());

const blockchainRegistration: RegisterBlockchainTx = {
kind: "bns/register_blockchain",
creator: {
chainId: registryChainId,
pubkey: signer.pubkey,
},
creator: creator,
chain: {
chainId: chainId,
production: false,
Expand All @@ -104,7 +99,7 @@ export async function checkBnsBlockchainNft(
codecName,
codecConfig: `{ }`,
};
await waitForCommit(writer.signAndPost(blockchainRegistration, walletId));
await waitForCommit(writer.signAndPost(blockchainRegistration));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/reducers/blockchain/actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Account, BcpConnection, BcpTicker, PublicIdentity, TxCodec } from "@iov/bcp-types";
import { Account, BcpConnection, BcpTicker, PublicIdentity, TxCodec } from "@iov/bcp";
import { ChainId, MultiChainSigner } from "@iov/core";
import { UserProfile } from "@iov/keycontrol";

Expand Down
2 changes: 1 addition & 1 deletion src/reducers/blockchain/state.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Account, Address, BcpConnection, BcpTicker, TokenTicker, TxCodec } from "@iov/bcp-types";
import { Account, Address, BcpConnection, BcpTicker, TokenTicker, TxCodec } from "@iov/bcp";
import { BnsUsernameNft } from "@iov/bns";
import { ChainId, MultiChainSigner } from "@iov/core";
import { ChainTicker } from "~/selectors";
Expand Down
2 changes: 1 addition & 1 deletion src/routes/balance/components/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BcpCoin, TokenTicker } from "@iov/bcp-types";
import { BcpCoin, TokenTicker } from "@iov/bcp";
import { storiesOf } from "@storybook/react";
import * as React from "react";
import PageMenu from "~/components/pages/PageMenu";
Expand Down
2 changes: 1 addition & 1 deletion src/routes/balance/components/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BcpCoin } from "@iov/bcp-types";
import { BcpCoin } from "@iov/bcp";
import { createStyles, withStyles, WithStyles } from "@material-ui/core";
import * as React from "react";
import Block from "~/components/layout/Block";
Expand Down
2 changes: 1 addition & 1 deletion src/routes/balance/container/selector.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BcpCoin } from "@iov/bcp-types";
import { BcpCoin } from "@iov/bcp";
import { createSelector, createStructuredSelector, Selector } from "reselect";
import { RootState } from "~/reducers";
import { accountNameSelector, ChainAccount, getAllAccounts } from "~/selectors";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address, BcpTicker } from "@iov/bcp-types";
import { Address, BcpTicker } from "@iov/bcp";
import { ChainId } from "@iov/core";
import { storiesOf } from "@storybook/react";
import * as React from "react";
Expand Down
2 changes: 1 addition & 1 deletion src/routes/sendPayment/components/FillPayment/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BcpCoin } from "@iov/bcp-types";
import { BcpCoin } from "@iov/bcp";
import { createStyles, withStyles, WithStyles } from "@material-ui/core";
import { FormState } from "final-form";
import * as React from "react";
Expand Down
2 changes: 1 addition & 1 deletion src/routes/sendPayment/container/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BcpCoin, TokenTicker } from "@iov/bcp-types";
import { BcpCoin, TokenTicker } from "@iov/bcp";
import { ChainId } from "@iov/core";
import { storiesOf } from "@storybook/react";
import * as React from "react";
Expand Down
2 changes: 1 addition & 1 deletion src/routes/sendPayment/container/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Amount, BcpCoin } from "@iov/bcp-types";
import { Amount, BcpCoin } from "@iov/bcp";
import * as React from "react";
import { connect } from "react-redux";
import { RouteComponentProps } from "react-router";
Expand Down
2 changes: 1 addition & 1 deletion src/routes/sendPayment/container/selector.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createSelector, createStructuredSelector, Selector } from "reselect";

import { BcpCoin } from "@iov/bcp-types";
import { BcpCoin } from "@iov/bcp";
import { BnsConnection } from "@iov/bns";
import { MultiChainSigner } from "@iov/core";

Expand Down
2 changes: 1 addition & 1 deletion src/routes/sendPayment/store/actions/sendTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Amount } from "@iov/bcp-types";
import { Amount } from "@iov/bcp";
import { ChainId } from "@iov/core";
import { sendTransactionSequence } from "~/sequences";

Expand Down
2 changes: 1 addition & 1 deletion src/routes/sendPayment/test/sendPayment.dom.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BcpCoin } from "@iov/bcp-types";
import { BcpCoin } from "@iov/bcp";
import TestUtils from "react-dom/test-utils";
import { Store } from "redux";
import { mayTestBns, randomString } from "~/logic/testhelpers";
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/genRandomAccount.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from "@iov/bcp-types";
import { ChainId } from "@iov/bcp";
import { bnsCodec } from "@iov/bns";
import { Bip39, Random, Slip10RawIndex } from "@iov/crypto";
import { Bech32, Encoding } from "@iov/encoding";
Expand Down
2 changes: 1 addition & 1 deletion src/selectors/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createSelector } from "reselect";

import { Account, BcpTicker } from "@iov/bcp-types";
import { Account, BcpTicker } from "@iov/bcp";
import { BnsConnection } from "@iov/bns";
import { Address, ChainId } from "@iov/core";

Expand Down
2 changes: 1 addition & 1 deletion src/sequences/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
isConfirmedTransaction,
PublicIdentity,
TxCodec,
} from "@iov/bcp-types";
} from "@iov/bcp";
import { bnsCodec, BnsConnection } from "@iov/bns";
import { MultiChainSigner } from "@iov/core";

Expand Down
2 changes: 1 addition & 1 deletion src/sequences/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Amount, ChainId } from "@iov/bcp-types";
import { Amount, ChainId } from "@iov/bcp";

import {
addressToCodec,
Expand Down
2 changes: 1 addition & 1 deletion src/store/notifications/state.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReadonlyDate } from "readonly-date";

import { Amount } from "@iov/bcp-types";
import { Amount } from "@iov/bcp";

export interface Tx {
readonly id: string;
Expand Down
Loading