From 3adee98e8b4f5c1c7b3b51751c00cfb87d629858 Mon Sep 17 00:00:00 2001 From: Anukul Pandey Date: Thu, 18 Dec 2025 18:08:12 +0530 Subject: [PATCH 1/3] feat: formso-so --- package.json | 1 + src/popup/index.tsx | 17 ++++--- src/popup/popup.tsx | 8 ++++ yarn.lock | 111 ++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 125 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 2e77d4b..be4d154 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "build:zip": "rm -rf ./dist.zip && cd ./dist && zip -r -FS ../dist.zip ." }, "dependencies": { + "@formo/analytics": "^1.25.0", "@fortawesome/fontawesome-svg-core": "^6.4.2", "@fortawesome/free-brands-svg-icons": "^6.4.2", "@fortawesome/free-solid-svg-icons": "^6.4.2", diff --git a/src/popup/index.tsx b/src/popup/index.tsx index 749dd16..eae697f 100644 --- a/src/popup/index.tsx +++ b/src/popup/index.tsx @@ -5,6 +5,7 @@ import "../assets/tailwind.css"; import Popup from "./popup"; import { ThemeProvider } from "./context/ThemeContext"; import { HideBalanceProvider } from "./context/HideBalance"; +import { FormoAnalyticsProvider } from '@formo/analytics'; function init() { const appContainer = document.createElement("div"); @@ -17,13 +18,15 @@ function init() { const root = createRoot(appContainer); console.log(appContainer); root.render( - - - - - - - + + + + + + + + + ); } diff --git a/src/popup/popup.tsx b/src/popup/popup.tsx index 1ffbeac..a033f83 100644 --- a/src/popup/popup.tsx +++ b/src/popup/popup.tsx @@ -4,6 +4,7 @@ import { Provider, Signer } from "@reef-chain/evm-provider"; import { extension as extLib, reefState } from "@reef-chain/util-lib"; import { IconProp } from "@fortawesome/fontawesome-svg-core"; import { hooks } from "@reef-chain/react-lib"; +import { useFormo } from "@formo/analytics"; import { faCirclePlus, faArrowUpRightFromSquare, @@ -102,6 +103,7 @@ const accountToReefSigner = async ( const Popup = () => { const { isDarkMode, toggleTheme } = useTheme(); + const analytics = useFormo(); const [accountCtx, setAccountCtx] = useState({ accounts: [], selectedAccount: null, @@ -123,6 +125,12 @@ const Popup = () => { const [isSettingsOpen, setIsSettingsOpen] = useState(false); const [selectedLanguage, setSelectedLanguage] = useState('en'); + useEffect(() => { + if (selectedAccount && analytics) { + analytics.identify({ address: selectedAccount.address }); + } + }, [selectedAccount, analytics]); + useEffect(() => { const handleMutations = (mutations) => { mutations.forEach(() => { diff --git a/yarn.lock b/yarn.lock index b494616..d6473cf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1907,6 +1907,15 @@ resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.8.tgz#21a907684723bbbaa5f0974cf7730bd797eb8e62" integrity sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig== +"@formo/analytics@^1.25.0": + version "1.25.0" + resolved "https://registry.yarnpkg.com/@formo/analytics/-/analytics-1.25.0.tgz#20ffc8ee7a27aaa0e6f03c26c70fcfee594a4627" + integrity sha512-T58Dvpg17I7xUk6TYrBm//xk/c/Y5kkSpZMQ+kdhE33rj34xkKkbU4nPEklLGkGCwJKGVLamTAvf4mT4E9WbEQ== + dependencies: + ethereum-cryptography "3.2.0" + fetch-retry "6.0.0" + mipd "0.0.7" + "@fortawesome/fontawesome-common-types@6.6.0": version "6.6.0" resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.6.0.tgz#31ab07ca6a06358c5de4d295d4711b675006163f" @@ -2385,6 +2394,11 @@ resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b" integrity sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ== +"@noble/ciphers@1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@noble/ciphers/-/ciphers-1.3.0.tgz#f64b8ff886c240e644e5573c097f86e5b43676dc" + integrity sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw== + "@noble/curves@1.4.2", "@noble/curves@~1.4.0": version "1.4.2" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.2.tgz#40309198c76ed71bc6dbf7ba24e81ceb4d0d1fe9" @@ -2392,6 +2406,13 @@ dependencies: "@noble/hashes" "1.4.0" +"@noble/curves@1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.9.0.tgz#13e0ca8be4a0ce66c113693a94514e5599f40cfc" + integrity sha512-7YDlXiNMdO1YZeH6t/kvopHHbIZzlxrCV9WLqCY6QhcXOoXiNCMDqJIglZ9Yjx5+w7Dz30TITFrlTjnRg7sKEg== + dependencies: + "@noble/hashes" "1.8.0" + "@noble/curves@^1.3.0": version "1.6.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.6.0.tgz#be5296ebcd5a1730fccea4786d420f87abfeb40b" @@ -2399,6 +2420,13 @@ dependencies: "@noble/hashes" "1.5.0" +"@noble/curves@~1.9.0": + version "1.9.7" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.9.7.tgz#79d04b4758a43e4bca2cbdc62e7771352fa6b951" + integrity sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw== + dependencies: + "@noble/hashes" "1.8.0" + "@noble/hashes@1.4.0", "@noble/hashes@~1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" @@ -2409,6 +2437,11 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.5.0.tgz#abadc5ca20332db2b1b2aa3e496e9af1213570b0" integrity sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA== +"@noble/hashes@1.8.0", "@noble/hashes@~1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.8.0.tgz#cee43d801fcef9644b11b8194857695acd5f815a" + integrity sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -3361,6 +3394,11 @@ resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== +"@scure/base@~1.2.5": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.2.6.tgz#ca917184b8231394dd8847509c67a0be522e59f6" + integrity sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg== + "@scure/bip32@1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.4.0.tgz#4e1f1e196abedcef395b33b9674a042524e20d67" @@ -3370,6 +3408,15 @@ "@noble/hashes" "~1.4.0" "@scure/base" "~1.1.6" +"@scure/bip32@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.7.0.tgz#b8683bab172369f988f1589640e53c4606984219" + integrity sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw== + dependencies: + "@noble/curves" "~1.9.0" + "@noble/hashes" "~1.8.0" + "@scure/base" "~1.2.5" + "@scure/bip39@1.3.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.3.0.tgz#0f258c16823ddd00739461ac31398b4e7d6a18c3" @@ -3378,6 +3425,14 @@ "@noble/hashes" "~1.4.0" "@scure/base" "~1.1.6" +"@scure/bip39@1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.6.0.tgz#475970ace440d7be87a6086cbee77cb8f1a684f9" + integrity sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A== + dependencies: + "@noble/hashes" "~1.8.0" + "@scure/base" "~1.2.5" + "@sindresorhus/is@^0.14.0": version "0.14.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" @@ -4980,9 +5035,9 @@ bindings@^1.3.0, bindings@^1.5.0: dependencies: file-uri-to-path "1.0.0" -"bip32-ed25519@git+https://github.com/Zondax/bip32-ed25519.git": +"bip32-ed25519@https://github.com/Zondax/bip32-ed25519": version "0.0.4" - resolved "git+https://github.com/Zondax/bip32-ed25519.git#0949df01b5c93885339bc28116690292088f6134" + resolved "https://github.com/Zondax/bip32-ed25519#0949df01b5c93885339bc28116690292088f6134" dependencies: bn.js "^5.1.1" elliptic "^6.4.1" @@ -6886,6 +6941,17 @@ ethereum-blockies-base64@^1.0.2: dependencies: pnglib "0.0.1" +ethereum-cryptography@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-3.2.0.tgz#42a04b57834bf536e552b50a70b9ee5057c71dc6" + integrity sha512-Urr5YVsalH+Jo0sYkTkv1MyI9bLYZwW8BENZCeE1QYaTHETEYx0Nv/SVsWkSqpYrzweg6d8KMY1wTjH/1m/BIg== + dependencies: + "@noble/ciphers" "1.3.0" + "@noble/curves" "1.9.0" + "@noble/hashes" "1.8.0" + "@scure/bip32" "1.7.0" + "@scure/bip39" "1.6.0" + ethereum-cryptography@^2.0.0: version "2.2.1" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz#58f2810f8e020aecb97de8c8c76147600b0b8ccf" @@ -7176,6 +7242,11 @@ fetch-blob@^3.1.2, fetch-blob@^3.1.4: node-domexception "^1.0.0" web-streams-polyfill "^3.0.3" +fetch-retry@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/fetch-retry/-/fetch-retry-6.0.0.tgz#4ffdf92c834d72ae819e42a4ee2a63f1e9454426" + integrity sha512-BUFj1aMubgib37I3v4q78fYo63Po7t4HUPTpQ6/QE6yK6cIQrP+W43FYToeTEyg5m2Y7eFUtijUuAv/PDlWuag== + figures@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" @@ -9713,6 +9784,11 @@ minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5, minimist@^1.2.6, minimist@^1. resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== +mipd@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mipd/-/mipd-0.0.7.tgz#bb5559e21fa18dc3d9fe1c08902ef14b7ce32fd9" + integrity sha512-aAPZPNDQ3uMTdKbuO2YmAw2TxLHO0moa4YKAyETM/DTj5FloZo+a+8tU+iv4GmW+sOxKLSRwcSFuczk+Cpt6fg== + mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: version "0.5.3" resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" @@ -11760,7 +11836,16 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -11855,7 +11940,14 @@ stringify-object@^3.2.1: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -12968,7 +13060,7 @@ worker-timers@^7.1.4: worker-timers-broker "^6.1.8" worker-timers-worker "^7.0.71" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -12986,6 +13078,15 @@ wrap-ansi@^6.0.1: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From 52f4dd646ad910310a29ca199cda8ce2cc0e4e50 Mon Sep 17 00:00:00 2001 From: Anukul Pandey Date: Thu, 18 Dec 2025 18:33:02 +0530 Subject: [PATCH 2/3] feat: address change event emission fixed --- src/popup/popup.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/popup/popup.tsx b/src/popup/popup.tsx index a033f83..0e91ee0 100644 --- a/src/popup/popup.tsx +++ b/src/popup/popup.tsx @@ -76,6 +76,8 @@ import Tokens from "./Tokens/Tokens"; import VDA from "./VDA/VDA"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; + const accountToReefSigner = async ( account: extLib.InjectedAccount, provider: Provider @@ -127,7 +129,8 @@ const Popup = () => { useEffect(() => { if (selectedAccount && analytics) { - analytics.identify({ address: selectedAccount.address }); + console.log("[FORMO] emitting address change event") + analytics.identify({ address: selectedAccount.evmAddress ?? ZERO_ADDRESS, userId: selectedAccount.address, providerName: 'Reef Extension' }); } }, [selectedAccount, analytics]); From 513f62532b8001bc52452c02f0968f22f1f19d72 Mon Sep 17 00:00:00 2001 From: Anukul Pandey Date: Fri, 19 Dec 2025 15:34:26 +0530 Subject: [PATCH 3/3] feat: listen to tx --- src/popup/AccountOptions/Bind.tsx | 8 ++++++-- src/popup/util/bindUtil.ts | 9 ++++++++- src/popup/util/transactionUtil.ts | 15 ++++++++++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/popup/AccountOptions/Bind.tsx b/src/popup/AccountOptions/Bind.tsx index 3b08922..e623e92 100644 --- a/src/popup/AccountOptions/Bind.tsx +++ b/src/popup/AccountOptions/Bind.tsx @@ -21,6 +21,7 @@ import Uik from "@reef-chain/ui-kit"; import strings from "../../i18n/locales"; import { useTheme } from "../context/ThemeContext"; import LightText from "../../common/LightText"; +import { useFormo } from "@formo/analytics"; const MIN_BALANCE = BigInt(utils.parseEther("5").toString()); @@ -52,6 +53,7 @@ export const Bind = ({ provider }: Props): JSX.Element => { const { address: bindAddress } = useParams(); const { accountsWithSigners } = useContext(AccountsContext); const onAction = useContext(ActionContext); + const analytics = useFormo(); const [bindFor, setBindFor] = useState(); const [availableTxAccounts, setAvailableTxAccounts] = useState< @@ -103,7 +105,8 @@ export const Bind = ({ provider }: Props): JSX.Element => { addresses: [transferBalanceFrom.address, bindFor.address], }); } - } + }, + analytics ); setTxStatus({ @@ -137,7 +140,8 @@ export const Bind = ({ provider }: Props): JSX.Element => { addresses: [bindFor.address], }); } - } + }, + analytics ); if (txIdent) { diff --git a/src/popup/util/bindUtil.ts b/src/popup/util/bindUtil.ts index ae799e7..926a7a3 100644 --- a/src/popup/util/bindUtil.ts +++ b/src/popup/util/bindUtil.ts @@ -2,11 +2,13 @@ import { Provider } from "@reef-chain/evm-provider"; import { AccountWithSigner, TxStatusHandler, TxStatusUpdate } from "../types"; import { handleErr } from "./transactionUtil"; +import { IFormoAnalytics } from "@formo/analytics"; export const bindEvmAddress = ( signer: AccountWithSigner, provider: Provider, - onTxChange?: TxStatusHandler + onTxChange?: TxStatusHandler, + analytics?: IFormoAnalytics, ): string => { if (!provider || !signer || signer?.isEvmClaimed) { return ""; @@ -34,5 +36,10 @@ export const bindEvmAddress = ( ((txStat: TxStatusUpdate) => alert(txStat.error?.message)); handleErr(err, txIdent, "", errHandler, signer); }); + analytics?.track("bind_evm", { + method: 'bindEvmAddress', + account: signer.address, + evmAddressClaimed: signer.evmAddress, + }) return txIdent; }; diff --git a/src/popup/util/transactionUtil.ts b/src/popup/util/transactionUtil.ts index 79be484..de35dea 100644 --- a/src/popup/util/transactionUtil.ts +++ b/src/popup/util/transactionUtil.ts @@ -5,6 +5,7 @@ import { TX_STATUS_ERROR_CODE, TxStatusHandler, } from "../types"; +import { IFormoAnalytics, TransactionStatus } from "@formo/analytics"; export const handleErr = ( e: { message: string } | string, @@ -49,7 +50,8 @@ export const sendToNativeAddress = ( sender: AccountWithSigner, toAmt: bigint, to: string, - txHandler: TxStatusHandler + txHandler: TxStatusHandler, + analytics?: IFormoAnalytics ): string => { const txIdent = Math.random().toString(10); const transfer = provider.api.tx.balances.transfer(to, toAmt.toString()); @@ -60,6 +62,12 @@ export const sendToNativeAddress = ( { signer: sender.signer.signingKey }, (res) => { const txHash = transfer.hash.toHex(); + analytics?.transaction({ + status: res.isInBlock ? TransactionStatus.BROADCASTED : res.isFinalized ? TransactionStatus.CONFIRMED : TransactionStatus.STARTED, + address: sender.evmAddress ?? "0x0000000000000000000000000000000000000000", + chainId: 13939, + transactionHash: txHash, + }) txHandler({ txIdent, txHash, @@ -70,6 +78,11 @@ export const sendToNativeAddress = ( } ) .catch((e) => { + analytics?.transaction({ + status: TransactionStatus.REVERTED, + address: sender.evmAddress ?? "0x0000000000000000000000000000000000000000", + chainId: 13939, + }) console.log("sendToNativeAddress err=", e); handleErr(e, txIdent, "", txHandler, sender); });