Skip to content

Commit

Permalink
refactor: replace use fingerprint from API
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyslbw committed Mar 19, 2021
1 parent 3ec4f46 commit 2b5ca7c
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 49 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
}
},
"dependencies": {
"@emurgo/cip14-js": "^2.0.0",
"@types/react-addons-css-transition-group": "15.0.5",
"bignumber.js": "9.0.1",
"browser-update": "3.3.9",
Expand Down
Binary file removed packages-cache/@emurgo-cip14-js-2.0.0.tgz
Binary file not shown.
Binary file removed packages-cache/bech32-2.0.0.tgz
Binary file not shown.
Binary file removed packages-cache/blake2b-2.1.3.tgz
Binary file not shown.
Binary file removed packages-cache/blake2b-wasm-1.1.7.tgz
Binary file not shown.
Binary file removed packages-cache/nanoassert-1.1.0.tgz
Binary file not shown.
3 changes: 1 addition & 2 deletions source/features/address/api/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
} from '../../../../generated/typings/graphql-schema';
import { sortTokensDesc } from '../../../lib/arrays';
import { isDefined } from '../../../lib/types';
import { assetFingerprintFromToken } from '../../transactions/helpers';
import { IPaymentAddressSummary, IStakeAddressSummary } from '../types';

export const paymentAddressDetailTransformer = (
Expand All @@ -24,7 +23,7 @@ export const paymentAddressDetailTransformer = (
.map((t) => ({
...t,
asset: {
fingerprint: assetFingerprintFromToken(t as Token),
fingerprint: t.asset.fingerprint,
}
}))
.sort(sortTokensDesc) || [],
Expand Down
1 change: 1 addition & 0 deletions source/features/search/api/searchForPaymentAddress.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ query searchForPaymentAddress(
assetBalances {
asset {
assetName
fingerprint
policyId
}
quantity
Expand Down
3 changes: 3 additions & 0 deletions source/features/transactions/api/TransactionDetails.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fragment TransactionDetails on Transaction {
mint {
asset {
assetName
fingerprint
policyId
}
quantity
Expand All @@ -24,6 +25,7 @@ fragment TransactionDetails on Transaction {
tokens {
asset {
assetName
fingerprint
policyId
}
quantity
Expand All @@ -40,6 +42,7 @@ fragment TransactionDetails on Transaction {
tokens {
asset {
assetName
fingerprint
policyId
}
quantity
Expand Down
11 changes: 5 additions & 6 deletions source/features/transactions/api/transformers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Currency } from 'cardano-js';
import { Token, TransactionDetailsFragment } from '../../../../generated/typings/graphql-schema';
import { TransactionDetailsFragment } from '../../../../generated/typings/graphql-schema';
import { sortTokensDesc } from '../../../lib/arrays';
import { isDefined } from '../../../lib/types';
import { assetFingerprintFromToken } from '../helpers';
import { ITransactionDetails } from '../types';

export const transactionDetailsTransformer = (
Expand All @@ -19,7 +18,7 @@ export const transactionDetailsTransformer = (
.map((t) => ({
...t,
asset: {
fingerprint: assetFingerprintFromToken(t as Token)
fingerprint: t.asset.fingerprint
},
quantity: t.quantity.substring(1),
}))
Expand All @@ -35,7 +34,7 @@ export const transactionDetailsTransformer = (
.map((t) => ({
...t,
asset: {
fingerprint: assetFingerprintFromToken(t as Token)
fingerprint: t.asset.fingerprint
}
}))
.sort(sortTokensDesc),
Expand All @@ -51,7 +50,7 @@ export const transactionDetailsTransformer = (
.map((t) => ({
...t,
asset: {
fingerprint: assetFingerprintFromToken(t as Token)
fingerprint: t.asset.fingerprint
}
}))
.sort(sortTokensDesc) || [],
Expand All @@ -61,7 +60,7 @@ export const transactionDetailsTransformer = (
.map((t) => ({
...t,
asset: {
fingerprint: assetFingerprintFromToken(t as Token)
fingerprint: t.asset.fingerprint
}
}))
.sort(sortTokensDesc),
Expand Down
7 changes: 0 additions & 7 deletions source/features/transactions/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import AssetFingerprint from '@emurgo/cip14-js';
import { Token } from '../../../generated/typings/graphql-schema';
import { BLOCK_SEARCH_RESULT_PATH } from '../blocks/config';
import { EPOCH_SEARCH_RESULT_PATH } from '../epochs/config';
import { TRANSACTION_SEARCH_RESULT_PATH } from './config';
Expand All @@ -13,8 +11,3 @@ export const getEpochRoute = (epoch: number) =>
export const getBlockRoute = (blockId: string) =>
`${BLOCK_SEARCH_RESULT_PATH}?id=${blockId}`;

export const assetFingerprintFromToken = (token: Token) =>
new AssetFingerprint(
Buffer.from(token.asset.policyId, 'hex'),
token.asset.assetName ? Buffer.from(token.asset.assetName.substr(2), 'hex') : undefined)
.fingerprint()
33 changes: 0 additions & 33 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1614,14 +1614,6 @@
resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46"
integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==

"@emurgo/cip14-js@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@emurgo/cip14-js/-/cip14-js-2.0.0.tgz#6ef78ddac8a35f2725e9ccebfd5ae114716c4b48"
integrity sha512-EvjgTs4NCqH1j0wxXqWCj31P7NmTzl3aR+9am0OLSsf3NA9GsdKH5QNyXJrvSZILM4yWzlZNum3y8S5PfdM1aA==
dependencies:
bech32 "2.0.0"
blake2b "2.1.3"

"@graphql-codegen/[email protected]":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@graphql-codegen/cli/-/cli-1.2.0.tgz#5a67c817559783c0d2e68199ab98f9003188f911"
Expand Down Expand Up @@ -4250,11 +4242,6 @@ bcrypt-pbkdf@^1.0.0:
dependencies:
tweetnacl "^0.14.3"

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/bech32/-/bech32-2.0.0.tgz#078d3686535075c8c79709f054b1b226a133b355"
integrity sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==

bech32@^1.1.3:
version "1.1.4"
resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9"
Expand Down Expand Up @@ -4307,21 +4294,6 @@ bindings@^1.5.0:
dependencies:
file-uri-to-path "1.0.0"

blake2b-wasm@^1.1.0:
version "1.1.7"
resolved "https://registry.yarnpkg.com/blake2b-wasm/-/blake2b-wasm-1.1.7.tgz#e4d075da10068e5d4c3ec1fb9accc4d186c55d81"
integrity sha512-oFIHvXhlz/DUgF0kq5B1CqxIDjIJwh9iDeUUGQUcvgiGz7Wdw03McEO7CfLBy7QKGdsydcMCgO9jFNBAFCtFcA==
dependencies:
nanoassert "^1.0.0"

[email protected]:
version "2.1.3"
resolved "https://registry.yarnpkg.com/blake2b/-/blake2b-2.1.3.tgz#f5388be424768e7c6327025dad0c3c6d83351bca"
integrity sha512-pkDss4xFVbMb4270aCyGD3qLv92314Et+FsKzilCLxDz5DuZ2/1g3w4nmBbu6nKApPspnjG7JcwTjGZnduB1yg==
dependencies:
blake2b-wasm "^1.1.0"
nanoassert "^1.0.0"

[email protected]:
version "3.7.1"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.1.tgz#df70e302b471d7473489acf26a93d63b53f874de"
Expand Down Expand Up @@ -10347,11 +10319,6 @@ nan@^2.12.1:
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01"
integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==

nanoassert@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-1.1.0.tgz#4f3152e09540fde28c76f44b19bbcd1d5a42478d"
integrity sha1-TzFS4JVA/eKMdvRLGbvNHVpCR40=

nanomatch@^1.2.9:
version "1.2.13"
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119"
Expand Down

0 comments on commit 2b5ca7c

Please sign in to comment.