Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
fess-v committed Sep 27, 2023
1 parent 77a6942 commit d05300c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/common/signature/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ export function getStructuredDataPayloadFromToken(requestToken: string) {
return {
...(result as unknown as CommonSignaturePayload),
message: deserializeCV(Buffer.from(result.message, 'hex')),
domain: deserializeCV(Buffer.from(result.domain, 'hex')),
domain: deserializeCV(Buffer.from(result.domain, 'hex')) as StructuredMessageDataDomain,
};
}
2 changes: 1 addition & 1 deletion src/app/common/transactions/stacks/is-sip-10-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ContractCallPayload, StacksTransaction } from '@stacks/transactions';

export function isSip10Transfer(tx: StacksTransaction) {
if (!tx.payload || !('functionName' in tx.payload)) return false;
const payload = tx.payload;
const payload = tx.payload as ContractCallPayload;
return (
payload.functionName.content === 'transfer' &&
(payload.functionArgs.length === 3 || payload.functionArgs.length === 4)
Expand Down
6 changes: 4 additions & 2 deletions src/app/query/stacks/bns/bns.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ async function fetchBnsxName(client: StacksClient, address: string): Promise<str
});
if (!res.okay || !res.result) return null;
const { result } = res;
const cv = deserializeCV(result);
const cv = deserializeCV(result) as OptionalCV<
TupleCV<{ name: BufferCV; namespace: BufferCV }>
>;
if (cv.type === ClarityType.OptionalNone) return null;
const { name, namespace } = cv.value.data;
const fullName = `${bytesToAscii(name.buffer)}.${bytesToAscii(namespace.buffer)}`;
Expand Down Expand Up @@ -81,7 +83,7 @@ async function fetchBnsxOwner(client: StacksClient, fqn: string): Promise<string

if (!res.okay || !res.result) return null;
const { result } = res;
const cv = deserializeCV(result);
const cv = deserializeCV(result) as OptionalCV<TupleCV<{ owner: PrincipalCV; id: UIntCV }>>;
if (cv.type === ClarityType.OptionalNone) return null;
const ownerCV = cv.value.data.owner;
return principalToString(ownerCV);
Expand Down
2 changes: 1 addition & 1 deletion src/app/query/stacks/nonce/account-nonces.query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function fetchAccountNonces(client: StacksClient, limiter: RateLimiter) {
await limiter.removeTokens(1);
return client.accountsApi.getAccountNonces({
principal,
});
}) as Promise<AddressNonces>;
};
}

Expand Down
2 changes: 2 additions & 0 deletions src/app/store/networks/networks.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useSelector } from 'react-redux';
import { StacksNetwork } from '@stacks/network';
import { ChainID, TransactionVersion } from '@stacks/transactions';

import { NetworkModes } from '@shared/constants';

import { whenStacksChainId } from '@app/common/utils';
import { useAppDispatch } from '@app/store';

Expand Down

0 comments on commit d05300c

Please sign in to comment.