mirror of
https://github.com/zhigang1992/wallet.git
synced 2026-01-12 22:53:27 +08:00
fix(analytics): wrong api details, missing token
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
PageParams,
|
||||
} from '@segment/analytics-next/dist/types/core/arguments-resolver';
|
||||
|
||||
import { HIRO_API_BASE_URL_MAINNET, HIRO_API_BASE_URL_TESTNET } from '@shared/constants';
|
||||
import { IS_TEST_ENV, SEGMENT_WRITE_KEY } from '@shared/environment';
|
||||
import { logger } from '@shared/logger';
|
||||
import { analytics, initAnalytics } from '@shared/utils/analytics';
|
||||
@@ -22,7 +23,7 @@ function isIgnoredPath(path: string) {
|
||||
}
|
||||
|
||||
function isHiroApiUrl(url: string) {
|
||||
return /^https:\/\/.*\.stacks.co/.test(url);
|
||||
return url.includes(HIRO_API_BASE_URL_MAINNET) || url.includes(HIRO_API_BASE_URL_TESTNET);
|
||||
}
|
||||
|
||||
export function useInitalizeAnalytics() {
|
||||
@@ -50,9 +51,7 @@ export function useAnalytics() {
|
||||
...(origin && { origin }),
|
||||
};
|
||||
|
||||
const defaultOptions = {
|
||||
context: { ip: '0.0.0.0' },
|
||||
};
|
||||
const defaultOptions = { context: { ip: '0.0.0.0' } };
|
||||
|
||||
return {
|
||||
async identify(properties: object) {
|
||||
|
||||
@@ -49,7 +49,7 @@ export function useSubmitTransactionCallback({ loadingKey }: UseSubmitTransactio
|
||||
txId: safelyFormatHexTxid(response.txid),
|
||||
});
|
||||
toast.success('Transaction submitted!');
|
||||
void analytics.track('broadcast_transaction', { token: 'stx' });
|
||||
void analytics.track('broadcast_transaction', { symbol: 'stx' });
|
||||
onSuccess(safelyFormatHexTxid(response.txid));
|
||||
setIsIdle();
|
||||
await refreshAccountData(timeForApiToUpdate);
|
||||
|
||||
@@ -17,7 +17,7 @@ interface BroadcastTransactionOptions {
|
||||
attachment?: string;
|
||||
networkUrl: string;
|
||||
}
|
||||
export async function broadcastTransaction(options: BroadcastTransactionOptions) {
|
||||
export async function broadcastStacksTransaction(options: BroadcastTransactionOptions) {
|
||||
const { txRaw, serialized, isSponsored, attachment, networkUrl } = options;
|
||||
|
||||
if (isSponsored) {
|
||||
|
||||
@@ -88,7 +88,7 @@ export function RpcSendTransferConfirmation() {
|
||||
tx,
|
||||
async onSuccess(txid) {
|
||||
void analytics.track('broadcast_transaction', {
|
||||
token: 'btc',
|
||||
symbol: 'btc',
|
||||
amount: transferAmount,
|
||||
fee,
|
||||
inputs: psbt.inputs.length,
|
||||
|
||||
@@ -72,7 +72,7 @@ export function BtcSendFormConfirmation() {
|
||||
tx,
|
||||
async onSuccess(txid) {
|
||||
void analytics.track('broadcast_transaction', {
|
||||
token: 'btc',
|
||||
symbol: 'btc',
|
||||
amount: transferAmount,
|
||||
fee,
|
||||
inputs: psbt.inputs.length,
|
||||
|
||||
@@ -22,7 +22,7 @@ import { isString, isUndefined } from '@shared/utils';
|
||||
import { useDefaultRequestParams } from '@app/common/hooks/use-default-request-search-params';
|
||||
import { stxToMicroStx } from '@app/common/money/unit-conversion';
|
||||
import { validateStacksAddress } from '@app/common/stacks-utils';
|
||||
import { broadcastTransaction } from '@app/common/transactions/stacks/broadcast-transaction';
|
||||
import { broadcastStacksTransaction } from '@app/common/transactions/stacks/broadcast-transaction';
|
||||
import {
|
||||
GenerateUnsignedTransactionOptions,
|
||||
generateUnsignedTransaction,
|
||||
@@ -120,7 +120,7 @@ export function useTransactionBroadcast() {
|
||||
return async ({ signedTx }: { signedTx: StacksTransaction }) => {
|
||||
try {
|
||||
const { isSponsored, serialized, txRaw } = prepareTxDetailsForBroadcast(signedTx);
|
||||
const result = await broadcastTransaction({
|
||||
const result = await broadcastStacksTransaction({
|
||||
isSponsored,
|
||||
serialized,
|
||||
txRaw,
|
||||
|
||||
Reference in New Issue
Block a user