Skip to content

Version 0.4.0 (Beta 1)

Pre-release
Pre-release
Compare
Choose a tag to compare
@psiemens psiemens released this 26 May 19:34
· 1399 commits to master since this release

⚠️ Breaking Changes

Cadence

Upgrade to Cadence v0.4.0-beta1: https://github.com/onflow/cadence/releases/tag/v0.4.0-beta1

The AuthAccount constructor signature has changed from this:

AuthAccount(publicKeys: [[Int]], code: [Int])

to this:

let account = AuthAccount(payer: AuthAccount)

This allows for another account that isn't the transaction payer to pay for the creation of a new account.

The constructor also no longer takes publicKeys and code arguments -- these fields must be provided via the addPublicKey and setCode methods.

Example

This transaction:

transaction {
	prepare() {
		let acct = AuthAccount(keys: keys, code: code)
	}
}

now becomes this:

transaction {
	prepare(signer: AuthAccount) {
		let acct = AuthAccount(payer: signer)
		for key in keys {
				acct.addPublicKey(key)
		}
		acct.setCode(code)
	}
}

This also means that the account creation transaction requires an authorizer. For cases where you were previously signing with a single payer, you can make this change to use the same payer to pay the transaction fee and account creation fee.

// Old code

tx := flow.NewTransaction().
  SetScript(createAccount).
  SetPayer(payerAddress)
  
_, = tx.SignEnvelope(payerAddress, payerKey, payerSigner)
// New code

tx := flow.NewTransaction().
  SetScript(createAccount).
  SetPayer(payerAddress).
  AddAuthorizer(payerAddress) // add payerAddress as an authorizer
  
_, = tx.SignEnvelope(payerAddress, payerKey, payerSigner)