From 14052db70d241dce06554c5c57d46b05ba9b50e1 Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Sat, 1 Jun 2024 21:52:15 -0400 Subject: [PATCH] copied polytoneProxies formula to wallet category --- src/data/formulas/wallet/index.ts | 1 + src/data/formulas/wallet/polytone.ts | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/data/formulas/wallet/polytone.ts diff --git a/src/data/formulas/wallet/index.ts b/src/data/formulas/wallet/index.ts index 32a9f059..c05ccdbf 100644 --- a/src/data/formulas/wallet/index.ts +++ b/src/data/formulas/wallet/index.ts @@ -1,6 +1,7 @@ export * as bank from './bank' export * as daos from './daos' export * as nft from './nft' +export * as polytone from './polytone' export * as proposals from './proposals' export * as tokens from './tokens' export * as valence from './valence' diff --git a/src/data/formulas/wallet/polytone.ts b/src/data/formulas/wallet/polytone.ts new file mode 100644 index 00000000..a4e96d6a --- /dev/null +++ b/src/data/formulas/wallet/polytone.ts @@ -0,0 +1,20 @@ +import { WalletFormula } from '@/core' + +// Map polytone note contract to the proxy contract for this account. +export const proxies: WalletFormula> = { + compute: async ({ walletAddress, getTransformationMatches }) => { + const notesWithRemoteAddress = + (await getTransformationMatches( + undefined, + `remoteAddress:${walletAddress}` + )) ?? [] + + return notesWithRemoteAddress.reduce( + (acc, { contractAddress, value }) => ({ + ...acc, + [contractAddress]: value as string, + }), + {} as Record + ) + }, +}