Compare commits

..
Author SHA1 Message Date
Bill He e2bdebe53c Add memo to transactions for onchain tracking 2024-02-05 17:59:58 -08:00
5 changed files with 26 additions and 16 deletions
+1 -1
View File
@@ -39,7 +39,7 @@
"@cosmjs/proto-signing": "^0.32.1",
"@cosmjs/stargate": "^0.32.1",
"@cosmjs/tendermint-rpc": "^0.32.1",
"@dydxprotocol/v4-abacus": "^1.4.1",
"@dydxprotocol/v4-abacus": "^1.4.0",
"@dydxprotocol/v4-client-js": "^1.0.20",
"@dydxprotocol/v4-localization": "^1.1.22",
"@ethersproject/providers": "^5.7.2",
+8 -8
View File
@@ -1,9 +1,5 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
overrides:
follow-redirects: 1.15.3
@@ -30,8 +26,8 @@ dependencies:
specifier: ^0.32.1
version: 0.32.2
'@dydxprotocol/v4-abacus':
specifier: ^1.4.1
version: 1.4.1
specifier: ^1.4.0
version: 1.4.0
'@dydxprotocol/v4-client-js':
specifier: ^1.0.20
version: 1.0.20
@@ -1092,8 +1088,8 @@ packages:
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
dev: true
/@dydxprotocol/v4-abacus@1.4.1:
resolution: {integrity: sha512-u7OSQ2zPt0EqNlm0mE9L4gj4Xwbd7RDG/4fOyzrOZZsRgXedghXGBNxonbqgx6Rp7yRYfA4Il76y+k7EOZcU2Q==}
/@dydxprotocol/v4-abacus@1.4.0:
resolution: {integrity: sha512-mkdkXQXTVF1K6UmZwIwLC9gjsXg+Nt3h5/iW+WriVv1cUMPmHfPyRWL31eDDvkVO5UeECf05kiYXPk1y+7dPuA==}
dev: false
/@dydxprotocol/v4-client-js@1.0.20:
@@ -14916,3 +14912,7 @@ packages:
/zwitch@2.0.4:
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
dev: true
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
+2
View File
@@ -173,3 +173,5 @@ export type AnalyticsEventData<T extends AnalyticsEvent> =
validatorUrl: string;
}
: never;
export const DEFAULT_TRANSACTION_MEMO = 'dYdX Frontend (web)';
+3 -1
View File
@@ -16,6 +16,7 @@ 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';
@@ -83,7 +84,8 @@ const useDydxClientContext = () => {
{
broadcastPollIntervalMs: 3_000,
broadcastTimeoutMs: 60_000,
}
},
DEFAULT_TRANSACTION_MEMO
)
)
);
+12 -6
View File
@@ -31,6 +31,7 @@ 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';
@@ -115,7 +116,8 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
{
broadcastPollIntervalMs: 3_000,
broadcastTimeoutMs: 60_000,
}
},
DEFAULT_TRANSACTION_MEMO
)
)
);
@@ -370,8 +372,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,
},
};
@@ -387,7 +389,11 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
}
ibcMsg.value.token.amount = amount.toString();
const tx = await this.nobleClient.send([ibcMsg]);
const tx = await this.nobleClient.send(
[ibcMsg],
undefined,
`${DEFAULT_TRANSACTION_MEMO} | ${this.nobleWallet?.address}`
);
const parsedTx = this.parseToPrimitives(tx);
@@ -426,8 +432,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,
},
};