Skip to content

Commit

Permalink
Merge pull request #30 from joshuahannan/c1.0-updates
Browse files Browse the repository at this point in the history
Update cadence code for 1.0
  • Loading branch information
lmcmz authored Jul 9, 2024
2 parents 3599905 + f74f5d3 commit a06f7a5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions Example/FCLDemo/FCLDemo/ViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ 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
self.y = y
}
}
pub fun main(): [SomeStruct] {
access(all) fun main(): [SomeStruct] {
return [SomeStruct(x: 1, y: 2),
SomeStruct(x: 3, y: 4)]
}
Expand All @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Constants/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion Tests/FCLTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit a06f7a5

Please sign in to comment.