-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: remove some properties from posthog unsafe properties * chore: set some analytics values on user profile * chore: add isOnboarded property to account create analytics event * feat: add analytics event for asset transfer fiat value * feat: check for ghosts of the past nft * chore: respond to pr review
- Loading branch information
Showing
7 changed files
with
110 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { AccountType } from "@core/domains/accounts/types" | ||
import { chainConnectorEvm } from "@core/rpcs/chain-connector-evm" | ||
import keyring from "@polkadot/ui-keyring" | ||
import { EvmNetworkId } from "@talismn/chaindata-provider" | ||
import { parseAbi } from "viem" | ||
|
||
import { abiErc721 } from "./abi" | ||
|
||
type Address = `0x${string}` | ||
|
||
export const hasErc721Nft = async ({ | ||
evmNetworkId, | ||
contractAddress, | ||
}: { | ||
evmNetworkId: EvmNetworkId | ||
contractAddress: Address | ||
}): Promise<Record<Address, boolean>> => { | ||
const evmAddresses = keyring | ||
.getPairs() | ||
.filter(({ type, meta }) => type === "ethereum" && meta.origin !== AccountType.Watched) | ||
.map(({ address }) => address as Address) | ||
|
||
const client = await chainConnectorEvm.getPublicClientForEvmNetwork(evmNetworkId) | ||
if (!client) throw new Error(`Unable to connect to EVM network: ${evmNetworkId}`) | ||
|
||
const data = await Promise.all( | ||
evmAddresses.map((address) => | ||
client.readContract({ | ||
address: contractAddress, | ||
abi: parseAbi(abiErc721), | ||
functionName: "balanceOf", | ||
args: [address], | ||
}) | ||
) | ||
) | ||
|
||
return Object.fromEntries(evmAddresses.map((address, i) => [address, data[i] > 0n])) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { hasErc721Nft } from "./hasErc721Nft" | ||
|
||
const moonbeamEvmNetworkId = "1284" | ||
const contractAddress = "0xDF67E64DC198E5287a6a625a4733841bD147E584" | ||
|
||
export const hasGhostsOfThePast = () => | ||
hasErc721Nft({ | ||
evmNetworkId: moonbeamEvmNetworkId, | ||
contractAddress, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters