diff --git a/Example/FCLDemo/FCLDemo/ViewModel.swift b/Example/FCLDemo/FCLDemo/ViewModel.swift index 47cde44..72f7154 100644 --- a/Example/FCLDemo/FCLDemo/ViewModel.swift +++ b/Example/FCLDemo/FCLDemo/ViewModel.swift @@ -45,9 +45,9 @@ class ViewModel: NSObject, ObservableObject { @Published var script: String = """ - pub struct SomeStruct { - pub var x: Int - pub var y: Int + access(all) struct SomeStruct { + access(all) var x: Int + access(all) var y: Int init(x: Int, y: Int) { self.x = x @@ -55,7 +55,7 @@ class ViewModel: NSObject, ObservableObject { } } - pub fun main(): [SomeStruct] { + access(all) fun main(): [SomeStruct] { return [SomeStruct(x: 1, y: 2), SomeStruct(x: 3, y: 4)] } @@ -64,7 +64,7 @@ class ViewModel: NSObject, ObservableObject { @Published var transactionScript: String = """ transaction(test: String, testInt: Int) { - prepare(signer: AuthAccount) { + prepare(signer: &Account) { log(signer.address) log(test) log(testInt) @@ -229,9 +229,9 @@ class ViewModel: NSObject, ObservableObject { import FungibleToken from 0xFungibleToken import FUSD from 0xFUSD - pub fun main(account: Address): UFix64 { - let receiverRef = getAccount(account).getCapability(/public/fusdBalance)! - .borrow<&FUSD.Vault{FungibleToken.Balance}>() + access(all) fun main(account: Address): UFix64 { + let receiverRef = getAccount(account).capabilities.get<&{FungibleToken.Balance}>(/public/fusdBalance)! + .borrow() return receiverRef!.balance } @@ -291,7 +291,7 @@ class ViewModel: NSObject, ObservableObject { .transaction( """ transaction(test: String, testInt: Int) { - prepare(signer: AuthAccount) { + prepare(signer: &Account) { log(signer.address) log(test) log(testInt) diff --git a/README.md b/README.md index 8b309e9..775d825 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,9 @@ fcl.query { import FungibleToken from 0xFungibleToken import FUSD from 0xFUSD - pub fun main(account: Address): UFix64 { - let receiverRef = getAccount(account).getCapability(/public/fusdBalance)! - .borrow<&FUSD.Vault{FungibleToken.Balance}>() + access(all) fun main(account: Address): UFix64 { + let receiverRef = getAccount(account).capabilities.get<&FUSD.Vault>(/public/fusdBalance) + .borrow() return receiverRef!.balance } @@ -137,7 +137,7 @@ A **convenience method** that produces the needed authorization details for the try await fcl.mutate(cadence: """ transaction(test: String, testInt: Int) { - prepare(signer: AuthAccount) { + prepare(signer: &Account) { log(signer.address) log(test) log(testInt) @@ -189,7 +189,7 @@ _Pass in the following as a single object with the following keys.All keys are o fcl.query { cadence { """ - pub fun main(a: Int, b: Int, addr: Address): Int { + access(all) fun main(a: Int, b: Int, addr: Address): Int { log(addr) return a + b } @@ -231,7 +231,7 @@ _Pass in the following as a single object with the following keys. All keys are try await fcl.mutate(cadence: """ transaction(test: String, testInt: Int) { - prepare(signer: AuthAccount) { + prepare(signer: &Account) { log(signer.address) log(test) log(testInt) diff --git a/Sources/Constants/Constants.swift b/Sources/Constants/Constants.swift index 2b8b903..be8b09a 100644 --- a/Sources/Constants/Constants.swift +++ b/Sources/Constants/Constants.swift @@ -11,7 +11,7 @@ extension FCL { enum Constants { static var verifyAccountProofSignaturesCadence = """ import FCLCrypto from 0xFCLCrypto - pub fun main( + access(all) fun main( address: Address, message: String, keyIndices: [Int], @@ -23,7 +23,7 @@ extension FCL { static var verifyUserSignaturesCadence = """ import FCLCrypto from 0xFCLCrypto - pub fun main( + access(all) fun main( address: Address, message: String, keyIndices: [Int], diff --git a/Tests/FCLTests.swift b/Tests/FCLTests.swift index 11e86c7..545e68f 100644 --- a/Tests/FCLTests.swift +++ b/Tests/FCLTests.swift @@ -42,7 +42,7 @@ final class FCLTests: XCTestCase { let response: Int = try await fcl.query { cadence { """ - pub fun main(a: Int, b: Int, addr: Address): Int { + access(all) fun main(a: Int, b: Int, addr: Address): Int { log(addr) return a + b }