From ec9913949bacdfe050d8d77c19a33faea166b86b Mon Sep 17 00:00:00 2001 From: Bjarte Stien Karlsen Date: Wed, 24 Jul 2024 12:49:35 +0200 Subject: [PATCH] update script --- scripts/getFlowToUSD.cdc | 1 - scripts/getProfileTest.cdc | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 scripts/getProfileTest.cdc diff --git a/scripts/getFlowToUSD.cdc b/scripts/getFlowToUSD.cdc index 2aafff98..419006bd 100644 --- a/scripts/getFlowToUSD.cdc +++ b/scripts/getFlowToUSD.cdc @@ -6,7 +6,6 @@ access(all) fun main():UFix64? { for address in feeds.keys { let name= feeds[address] - // let name = feeds[address] if name=="FLOW/USD" { return PublicPriceOracle.getLatestPrice(oracleAddr: address) } diff --git a/scripts/getProfileTest.cdc b/scripts/getProfileTest.cdc new file mode 100644 index 00000000..bb815e06 --- /dev/null +++ b/scripts/getProfileTest.cdc @@ -0,0 +1,13 @@ +//❯ flow scripts execute scripts/getProfileTest.cdc 0x70df6ccc9632a4dd -n migrationnetimport +import "Profile" + +access(all) fun main(address: Address) : AnyStruct { + var wallets = getAccount(address).capabilities.borrow<&{Profile.Public}>(Profile.publicPath)?.getWallets() ?? [] + + for wallet in wallets { + if wallet.name == "USDC" { + return wallet.balance.id + } + } + return nil +}