Skip to content

Commit

Permalink
fix: upgrade to latest types package
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Jul 13, 2021
1 parent c334fd0 commit 7a5eb36
Show file tree
Hide file tree
Showing 25 changed files with 37 additions and 48 deletions.
4 changes: 2 additions & 2 deletions app/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
CoreNodePoxResponse,
CoreNodeInfoResponse,
NetworkBlockTimesResponse,
} from '@blockstack/stacks-blockchain-api-types';
import { AddressTransactionsWithTransfersListResponse } from '@stacks/stacks-blockchain-api-types';
AddressTransactionsWithTransfersListResponse,
} from '@stacks/stacks-blockchain-api-types';
import packageJson from '../../package.json';

const defaultHeaders = [
Expand Down
2 changes: 1 addition & 1 deletion app/components/home/transaction-list/mempool-tx-label.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MempoolTransaction } from '@blockstack/stacks-blockchain-api-types';
import { MempoolTransaction } from '@stacks/stacks-blockchain-api-types';
import { isStackingTx, isDelegateStxTx, isRevokingDelegationTx } from '@utils/tx-utils';

export function getMempoolTxLabel(tx: MempoolTransaction, address: string, contractId: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Transaction } from '@blockstack/stacks-blockchain-api-types';
import { Transaction } from '@stacks/stacks-blockchain-api-types';

import { hasMemo, getRecipientAddress } from '@utils/tx-utils';
import { features } from '../../../constants/index';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC, useRef, useEffect, MutableRefObject } from 'react';
import { useHover, useFocus } from 'use-events';
import { Box, color, Flex, Stack, Text } from '@stacks/ui';
import { MempoolTransaction } from '@blockstack/stacks-blockchain-api-types';
import { MempoolTransaction } from '@stacks/stacks-blockchain-api-types';
import { getTxTypeName } from '@stacks/ui-utils';

import { toHumanReadableStx } from '@utils/unit-convert';
Expand Down
2 changes: 1 addition & 1 deletion app/hooks/use-mempool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useQuery } from 'react-query';
import { selectAddress } from '@store/keys';
import { ApiResource } from '@models';
import { useFetchAccountNonce } from '@hooks/use-fetch-account-nonce';
import { MempoolTransaction } from '@blockstack/stacks-blockchain-api-types';
import { MempoolTransaction } from '@stacks/stacks-blockchain-api-types';
import { useApi } from './use-api';

interface UseMempool {
Expand Down
2 changes: 1 addition & 1 deletion app/hooks/use-transaction-list.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useMemo, useRef } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import * as R from 'ramda';
import { MempoolTransaction } from '@blockstack/stacks-blockchain-api-types';
import { MempoolTransaction } from '@stacks/stacks-blockchain-api-types';
import { useSelector } from 'react-redux';
import { RootState } from '@store/index';
import { selectTransactionList } from '@store/transaction';
Expand Down
2 changes: 1 addition & 1 deletion app/modals/components/transaction-error.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
import { PostCoreNodeTransactionsError } from '@blockstack/stacks-blockchain-api-types';
import { PostCoreNodeTransactionsError } from '@stacks/stacks-blockchain-api-types';

import { TxModalButton, TxModalFooter } from '@modals/send-stx/send-stx-modal-layout';
import { FailedBroadcastError } from '@modals/send-stx/steps/failed-broadcast-error';
Expand Down
2 changes: 1 addition & 1 deletion app/modals/delegated-stacking/delegated-stacking-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useBroadcastTx } from '@hooks/use-broadcast-tx';
import { ContractCallOptions, StacksTransaction } from '@stacks/transactions';
import { useMempool } from '@hooks/use-mempool';

import { PostCoreNodeTransactionsError } from '@blockstack/stacks-blockchain-api-types';
import { PostCoreNodeTransactionsError } from '@stacks/stacks-blockchain-api-types';

import { TxSigningModal } from '@modals/tx-signing-modal/tx-signing-modal';

Expand Down
2 changes: 1 addition & 1 deletion app/modals/revoke-delegation/revoke-delegation-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ContractCallOptions, StacksTransaction } from '@stacks/transactions';
import { useHotkeys } from 'react-hotkeys-hook';

import { selectPoxInfo } from '@store/stacking';
import { PostCoreNodeTransactionsError } from '@blockstack/stacks-blockchain-api-types';
import { PostCoreNodeTransactionsError } from '@stacks/stacks-blockchain-api-types';

import { safeAwait } from '@utils/safe-await';
import { homeActions } from '@store/home';
Expand Down
2 changes: 1 addition & 1 deletion app/modals/send-stx/send-stx-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useQueryClient } from 'react-query';
import { useFormik } from 'formik';
import * as yup from 'yup';
import BN from 'bn.js';
import { PostCoreNodeTransactionsError } from '@blockstack/stacks-blockchain-api-types';
import { PostCoreNodeTransactionsError } from '@stacks/stacks-blockchain-api-types';
import { BigNumber } from 'bignumber.js';
import { Modal } from '@modals/components/base-modal';
import {
Expand Down
2 changes: 1 addition & 1 deletion app/modals/send-stx/steps/failed-broadcast-error.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { FC } from 'react';
import { Flex, Box, Text, color } from '@stacks/ui';
import { PostCoreNodeTransactionsError } from '@blockstack/stacks-blockchain-api-types';
import { PostCoreNodeTransactionsError } from '@stacks/stacks-blockchain-api-types';

import failedCrossSvg from '../../../assets/images/failed-cross.svg';
import { ExplainerTooltip } from '@components/tooltip';
Expand Down
2 changes: 1 addition & 1 deletion app/modals/stacking/stacking-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { safeAwait } from '@utils/safe-await';
import { watchForNewTxToAppear } from '@api/watch-tx-to-appear-in-api';
import { useBroadcastTx } from '@hooks/use-broadcast-tx';
import { useMempool } from '@hooks/use-mempool';
import { PostCoreNodeTransactionsError } from '@blockstack/stacks-blockchain-api-types';
import { PostCoreNodeTransactionsError } from '@stacks/stacks-blockchain-api-types';
import { TxSigningModal } from '@modals/tx-signing-modal/tx-signing-modal';

interface StackingModalProps {
Expand Down
2 changes: 1 addition & 1 deletion app/modals/tx-signing-modal/tx-signing-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
import { Modal } from '@stacks/ui';
import BN from 'bn.js';
import { PostCoreNodeTransactionsError } from '@blockstack/stacks-blockchain-api-types';
import { PostCoreNodeTransactionsError } from '@stacks/stacks-blockchain-api-types';

import { SignTransaction } from '@components/tx-signing/sign-transaction';
import { useLatestNonce } from '@hooks/use-latest-nonce';
Expand Down
2 changes: 1 addition & 1 deletion app/store/address/address.actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Dispatch, GetState } from '../index';
import { createAction } from '@reduxjs/toolkit';
import { AddressStxBalanceResponse } from '@blockstack/stacks-blockchain-api-types';
import { AddressStxBalanceResponse } from '@stacks/stacks-blockchain-api-types';
import { safeAwait } from '@stacks/ui';

import { Api } from '../../api/api';
Expand Down
2 changes: 1 addition & 1 deletion app/store/address/address.reducer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AddressStxBalanceResponse } from '@blockstack/stacks-blockchain-api-types';
import { AddressStxBalanceResponse } from '@stacks/stacks-blockchain-api-types';
import { createReducer, createSelector } from '@reduxjs/toolkit';
import BigNumber from 'bignumber.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

import { RootState } from '..';
import { fetchTransactionsDone, pendingTransactionSuccessful } from '../transaction';
import { MempoolTransaction, Transaction } from '@blockstack/stacks-blockchain-api-types';
import { MempoolTransaction, Transaction } from '@stacks/stacks-blockchain-api-types';

export type PendingTransactionState = EntityState<MempoolTransaction>;

Expand Down
2 changes: 1 addition & 1 deletion app/store/stacking/stacking.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
CoreNodePoxResponse,
CoreNodeInfoResponse,
NetworkBlockTimesResponse,
} from '@blockstack/stacks-blockchain-api-types';
} from '@stacks/stacks-blockchain-api-types';
import { createSlice, PayloadAction, createSelector } from '@reduxjs/toolkit';

import { RootState } from '..';
Expand Down
6 changes: 4 additions & 2 deletions app/store/transaction/transaction.actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { createAction } from '@reduxjs/toolkit';
import { safeAwait } from '@stacks/ui';
import { PostCoreNodeTransactionsError } from '@blockstack/stacks-blockchain-api-types';
import { AddressTransactionWithTransfers } from '@stacks/stacks-blockchain-api-types';
import {
PostCoreNodeTransactionsError,
AddressTransactionWithTransfers,
} from '@stacks/stacks-blockchain-api-types';

import urljoin from 'url-join';
import { StacksTransaction, TxBroadcastResult } from '@stacks/transactions';
Expand Down
4 changes: 1 addition & 3 deletions app/tests/transaction-form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describeOnlyTestnet('Transaction flow', () => {
await app.close();
});

test('Transaction form', async done => {
test('Transaction form', async () => {
await initSoftwareWallet(page)(SEED_PHRASE, PASSWORD);
const globalFeature = createGlobalFeature(page);

Expand Down Expand Up @@ -106,7 +106,5 @@ describeOnlyTestnet('Transaction flow', () => {
expect(memo).toEqual(TX_MEMO);
expect(recipient).toEqual(TX_RECIPIENT);
expect(amount).toEqual(stxToMicroStx(TX_AMOUNT).toString());

done();
}, 120_0000);
});
2 changes: 1 addition & 1 deletion app/utils/get-stx-transfer-direction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Transaction, MempoolTransaction } from '@blockstack/stacks-blockchain-api-types';
import { Transaction, MempoolTransaction } from '@stacks/stacks-blockchain-api-types';
import { c32addressDecode } from 'c32check';

export type StxTxDirection = 'sent' | 'received';
Expand Down
11 changes: 6 additions & 5 deletions app/utils/sum-stx-tx-total.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Transaction, TransactionEvent } from '@blockstack/stacks-blockchain-api-types';
import type { Transaction, TransactionEvent } from '@stacks/stacks-blockchain-api-types';
import BigNumber from 'bignumber.js';
import { getStxTxDirection } from './get-stx-transfer-direction';
import { isStackingTx } from './tx-utils';
import { MempoolTransaction } from '@blockstack/stacks-blockchain-api-types';
import { isMempoolTx, isStackingTx } from './tx-utils';
import { MempoolTransaction } from '@stacks/stacks-blockchain-api-types';

export function sumStxTxTotal(
address: string,
Expand All @@ -16,8 +16,8 @@ export function sumStxTxTotal(
if (
tx.tx_type === 'coinbase' ||
tx.tx_type === 'poison_microblock' ||
(tx.tx_type === 'contract_call' && tx.tx_status === 'pending') ||
(tx.tx_type === 'smart_contract' && tx.tx_status === 'pending')
(tx.tx_type === 'contract_call' && isMempoolTx(tx)) ||
(tx.tx_type === 'smart_contract' && isMempoolTx(tx))
) {
return new BigNumber(tx.fee_rate);
}
Expand All @@ -36,5 +36,6 @@ export function sumStxTxTotal(
current.event_type === 'stx_asset' && current.asset.asset_event_type === 'transfer'
? new BigNumber(current.asset.amount || 0).plus(prev)
: initialValue;

return tx.events.reduce(sumEventTransferHandler, initialValue).plus(tx.fee_rate);
}
2 changes: 1 addition & 1 deletion app/utils/tx-utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sumTxsTotalSpentByAddress } from './tx-utils';
import { MempoolTransaction } from '@blockstack/stacks-blockchain-api-types';
import { MempoolTransaction } from '@stacks/stacks-blockchain-api-types';

const mempoolTxs: MempoolTransaction[] = [
{
Expand Down
2 changes: 1 addition & 1 deletion app/utils/tx-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
Transaction,
MempoolTransaction,
ContractCallTransaction,
} from '@blockstack/stacks-blockchain-api-types';
} from '@stacks/stacks-blockchain-api-types';
import { SEND_MANY_CONTACT_ID } from '@constants/index';
import BigNumber from 'bignumber.js';
import { StxTxDirection } from './get-stx-transfer-direction';
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,13 @@
"@babel/preset-react": "7.14.5",
"@babel/preset-typescript": "7.14.5",
"@babel/register": "7.14.5",
"@blockstack/prettier-config": "0.0.6",
"@blockstack/stacks-blockchain-api-types": "0.44",
"@commitlint/cli": "12.1.4",
"@commitlint/config-conventional": "12.1.4",
"@octokit/types": "6.18.1",
"@pmmmwh/react-refresh-webpack-plugin": "0.4.3",
"@stacks/eslint-config": "1.0.9",
"@stacks/prettier-config": "0.0.8",
"@stacks/stacks-blockchain-api-types": "0.61.0",
"@stacks/stacks-blockchain-api-types": "0.56.0",
"@types/argon2-browser": "1.18.1",
"@types/bcryptjs": "2.4.2",
"@types/bn.js": "5.1.0",
Expand Down
18 changes: 4 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1391,16 +1391,6 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@blockstack/[email protected]":
version "0.0.6"
resolved "https://registry.yarnpkg.com/@blockstack/prettier-config/-/prettier-config-0.0.6.tgz#8a41cd378ba061b79770987f2a6ad0c92b64bd72"
integrity sha512-ke0MdyblmoUqSJBEutsG8/6G7KAjCB+uOcgZHPJvJr4R+i5yRhT4GSe5nV/wREINuK0jj2GvaA6qlx4PQTKQUA==

"@blockstack/[email protected]":
version "0.44.0"
resolved "https://registry.yarnpkg.com/@blockstack/stacks-blockchain-api-types/-/stacks-blockchain-api-types-0.44.0.tgz#d6f35dc5c793e81095a829f9dd4de09a610dbab7"
integrity sha512-C+8i3OQpZQzB+booZ/C6NsUSdB+GpNKToRh7WPu23XOK471nuETYdWACVLho79LxNWn+t5qNN8Ge3UIsYHYzag==

"@blockstack/stacks-blockchain-api-types@^0.34.1":
version "0.34.2"
resolved "https://registry.yarnpkg.com/@blockstack/stacks-blockchain-api-types/-/stacks-blockchain-api-types-0.34.2.tgz#de65f6556f8b988784718aca0d8e14284a81d914"
Expand Down Expand Up @@ -2801,10 +2791,10 @@
dependencies:
prettier "^2.3.0"

"@stacks/stacks-blockchain-api-types@0.61.0":
version "0.61.0"
resolved "https://registry.yarnpkg.com/@stacks/stacks-blockchain-api-types/-/stacks-blockchain-api-types-0.61.0.tgz#f8bc61ad7781fdc0d9e9db711580db984f164e93"
integrity sha512-yPOfTUboo5eA9BZL/hqMcM71GstrFs9YWzOrJFPeP4cOO1wgYvAcckgBRbgiE3NqeX0A7SLZLDAXLZbATuRq9w==
"@stacks/stacks-blockchain-api-types@0.56.0":
version "0.56.0"
resolved "https://registry.yarnpkg.com/@stacks/stacks-blockchain-api-types/-/stacks-blockchain-api-types-0.56.0.tgz#240718dd935de10b57bb75fd7e57524f85c53a00"
integrity sha512-TsFD8Of3c4/VqSLHa0oICI2R2zr4erRcNC0ejfg3jTU5WktC7ueJw942S5+wGIzvuCCJH9zdBHh3wdaCwM/rLw==

"@stacks/transactions@^1.0.1":
version "1.4.1"
Expand Down

0 comments on commit 7a5eb36

Please sign in to comment.