Compare commits

..
Author SHA1 Message Date
Aleka Cheung f4c166294f update abacus and remove mobilesignin test flag 2024-02-06 11:48:14 -05:00
Aleka Cheung 2c01bf26fc add featureFlags to env config 2024-02-05 20:48:08 -05:00
9 changed files with 18 additions and 90 deletions
-1
View File
@@ -8,7 +8,6 @@ VITE_V3_TOKEN_ADDRESS=
VITE_TOKEN_MIGRATION_URI=
AMPLITUDE_API_KEY=
AMPLITUDE_SERVER_URL=
BUGSNAG_API_KEY=
IOS_APP_ID=
INTERCOM_APP_ID=
-1
View File
@@ -78,7 +78,6 @@ Set environment variables via `.env`.
- `VITE_V3_TOKEN_ADDRESS` (optional): Address of the V3 $DYDX token.
- `VITE_TOKEN_MIGRATION_URI` (optional): The URL of the token migration website.
- `AMPLITUDE_API_KEY` (optional): Amplitude API key for enabling Amplitude; used with `pnpm run build:inject-amplitude`.
- `AMPLITUDE_SERVER_URL` (optional): Custom Amplitude server URL
- `BUGSNAG_API_KEY` (optional): API key for enabling Bugsnag; used with `pnpm run build:inject-bugsnag`.
- `IOS_APP_ID` (optional): iOS app ID used for enabling deep linking to the iOS app; used with `pnpm run build:inject-app-deeplinks`.
- `INTERCOM_APP_ID` (optional): Used for enabling Intercom; utilized with `pnpm run build:inject-intercom`.
-22
View File
@@ -1,22 +0,0 @@
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "exchange.dydx.trading.debug",
"sha256_cert_fingerprints": [
"8A:9C:CC:49:B0:35:9A:91:67:CB:98:B0:B5:87:92:5F:9E:B7:EF:CE:A0:47:57:85:A4:35:3E:0C:E1:56:9E:A2"
]
}
},
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "exchange.dydx.trading",
"sha256_cert_fingerprints": [
"B2:2D:CC:27:9D:52:05:98:63:C9:7B:34:36:70:A3:8E:00:31:28:08:2D:2E:70:76:C9:31:AE:F9:55:21:15:A5"
]
}
}
]
+3 -30
View File
@@ -3,13 +3,12 @@ import path from 'path';
import { fileURLToPath } from 'url';
const AMPLITUDE_API_KEY = process.env.AMPLITUDE_API_KEY;
const AMPLITUDE_SERVER_URL = process.env.AMPLITUDE_SERVER_URL;
const currentPath = fileURLToPath(import.meta.url);
const projectRoot = path.dirname(currentPath);
const htmlFilePath = path.resolve(projectRoot, '../dist/index.html');
if (AMPLITUDE_API_KEY) {
if(AMPLITUDE_API_KEY){
try {
const html = await fs.readFile(htmlFilePath, 'utf-8');
@@ -19,34 +18,8 @@ if (AMPLITUDE_API_KEY) {
`;
const amplitudeListenerScript = `<script type="module">
!(function () {
var e = "${AMPLITUDE_API_KEY}";
e &&
(globalThis.amplitude.init(e${
AMPLITUDE_SERVER_URL
? `, undefined, {
serverUrl: "${AMPLITUDE_SERVER_URL}"
}`
: ''
}),
globalThis.amplitude.setOptOut(!1),
globalThis.addEventListener("dydx:track", function (e) {
var t = e.detail.eventType,
d = e.detail.eventData;
globalThis.amplitude.track(t, d);
}),
globalThis.addEventListener("dydx:identify", function (e) {
var t = e.detail.property,
d = e.detail.propertyValue;
if ("walletAddress" === t) globalThis.amplitude.setUserId(d);
else {
var i = new globalThis.amplitude.Identify();
i.set(t, d), globalThis.amplitude.identify(i);
}
}),
console.log("Amplitude enabled."));
})();
</script>`;
!function(){var e="${AMPLITUDE_API_KEY}";e&&(globalThis.amplitude.init(e),globalThis.amplitude.setOptOut(!1),globalThis.addEventListener("dydx:track",function(e){var t=e.detail.eventType,d=e.detail.eventData;globalThis.amplitude.track(t,d)}),globalThis.addEventListener("dydx:identify",function(e){var t=e.detail.property,d=e.detail.propertyValue;if("walletAddress"===t)globalThis.amplitude.setUserId(d);else{var i=new globalThis.amplitude.Identify;i.set(t,d),globalThis.amplitude.identify(i)}}),console.log("Amplitude enabled."))}();
</script>`;
const injectedHtml = html.replace(
'<div id="root"></div>',
+7 -18
View File
@@ -95,10 +95,7 @@ export type ElementProps<TableRowData extends object | CustomRowConfig, TableRow
selectionBehavior?: 'replace' | 'toggle';
onRowAction?: (key: TableRowKey, row: TableRowData) => void;
slotEmpty?: React.ReactNode;
viewMoreConfig?: {
initialNumRowsToShow: number;
numRowsPerPage?: number;
};
initialNumRowsToShow?: number;
// collection: TableCollection<string>;
// children: React.ReactNode;
};
@@ -128,7 +125,7 @@ export const Table = <TableRowData extends object, TableRowKey extends Key>({
selectionMode = 'single',
selectionBehavior = 'toggle',
slotEmpty,
viewMoreConfig,
initialNumRowsToShow,
// shouldRowRender,
// collection,
@@ -144,18 +141,8 @@ export const Table = <TableRowData extends object, TableRowKey extends Key>({
style,
}: ElementProps<TableRowData, TableRowKey> & StyleProps) => {
const [selectedKeys, setSelectedKeys] = useState(new Set<TableRowKey>());
const [numRowsToShow, setNumRowsToShow] = useState(viewMoreConfig?.initialNumRowsToShow);
const enableViewMore = viewMoreConfig !== undefined;
const onViewMoreClick = () => {
if (!viewMoreConfig) return;
const { numRowsPerPage } = viewMoreConfig;
if (numRowsPerPage) {
setNumRowsToShow((prev) => (prev ?? 0) + numRowsPerPage);
} else {
setNumRowsToShow(data.length);
}
};
const [numRowsToShow, setNumRowsToShow] = useState(initialNumRowsToShow);
const enableViewMore = numRowsToShow !== undefined;
const currentBreakpoints = useBreakpoints();
const shownColumns = columns.filter(
@@ -231,7 +218,9 @@ export const Table = <TableRowData extends object, TableRowKey extends Key>({
}
numColumns={shownColumns.length}
onViewMoreClick={
enableViewMore && numRowsToShow! < data.length ? onViewMoreClick : undefined
enableViewMore && numRowsToShow < data.length
? () => setNumRowsToShow(data.length)
: undefined
}
// shouldRowRender={shouldRowRender}
hideHeader={hideHeader}
-2
View File
@@ -173,5 +173,3 @@ export type AnalyticsEventData<T extends AnalyticsEvent> =
validatorUrl: string;
}
: never;
export const DEFAULT_TRANSACTION_MEMO = 'dYdX Frontend (web)';
+1 -3
View File
@@ -16,7 +16,6 @@ import {
import type { ResolutionString } from 'public/tradingview/charting_library';
import type { ConnectNetworkEvent, NetworkConfig } from '@/constants/abacus';
import { DEFAULT_TRANSACTION_MEMO } from '@/constants/analytics';
import { type Candle, RESOLUTION_MAP } from '@/constants/candles';
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
import { DydxChainAsset } from '@/constants/wallets';
@@ -84,8 +83,7 @@ const useDydxClientContext = () => {
{
broadcastPollIntervalMs: 3_000,
broadcastTimeoutMs: 60_000,
},
DEFAULT_TRANSACTION_MEMO
}
)
)
);
+6 -12
View File
@@ -31,7 +31,6 @@ import {
type HumanReadableTransferPayload,
} from '@/constants/abacus';
import { DEFAULT_TRANSACTION_MEMO } from '@/constants/analytics';
import { DialogTypes } from '@/constants/dialogs';
import { UNCOMMITTED_ORDER_TIMEOUT_MS } from '@/constants/trade';
import { ENVIRONMENT_CONFIG_MAP, DydxNetwork, isTestnet } from '@/constants/networks';
@@ -116,8 +115,7 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
{
broadcastPollIntervalMs: 3_000,
broadcastTimeoutMs: 60_000,
},
DEFAULT_TRANSACTION_MEMO
}
)
)
);
@@ -372,8 +370,8 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
value: {
...params.msg,
timeoutTimestamp: params.msg.timeoutTimestamp
? // Squid returns timeoutTimestamp as Long, but the signer expects BigInt
BigInt(Long.fromValue(params.msg.timeoutTimestamp).toString())
// Squid returns timeoutTimestamp as Long, but the signer expects BigInt
? BigInt(Long.fromValue(params.msg.timeoutTimestamp).toString())
: undefined,
},
};
@@ -389,11 +387,7 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
}
ibcMsg.value.token.amount = amount.toString();
const tx = await this.nobleClient.send(
[ibcMsg],
undefined,
`${DEFAULT_TRANSACTION_MEMO} | ${this.nobleWallet?.address}`
);
const tx = await this.nobleClient.send([ibcMsg]);
const parsedTx = this.parseToPrimitives(tx);
@@ -432,8 +426,8 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
value: {
...parsedIbcPayload.msg,
timeoutTimestamp: parsedIbcPayload.msg.timeoutTimestamp
? // Squid returns timeoutTimestamp as Long, but the signer expects BigInt
BigInt(Long.fromValue(parsedIbcPayload.msg.timeoutTimestamp).toString())
// Squid returns timeoutTimestamp as Long, but the signer expects BigInt
? BigInt(Long.fromValue(parsedIbcPayload.msg.timeoutTimestamp).toString())
: undefined,
},
};
@@ -121,7 +121,7 @@ export const TradingRewardHistoryTable = ({
selectionBehavior="replace"
withOuterBorder={withOuterBorder}
withInnerBorders={withInnerBorders}
viewMoreConfig={{ initialNumRowsToShow: 5, numRowsPerPage: 10 }}
initialNumRowsToShow={5}
withScrollSnapColumns
withScrollSnapRows
/>