Changelog
Recent updates to the Flow Go SDK
Version 0.12.2
Monday, November 30th 2020
Network Compatibility
| Emulator v0.10.0 (CLI v0.9.0) | Emulator v0.12.0 (CLI v0.11.0) | Testnet | Mainnet |
|---|---|---|---|
| ❌ | ✅ | ✅ | ❌ |
💥 Breaking Changes
Multiple contracts per account (#106)
By @janezpodhostnik
The Flow protocol now supports multiple contracts per account. This SDK has been updated with additional functionality to create and manage multiple contracts on the same account.
- The
flow.Accountstruct now contains aContractsfield that mapscontractName => contractSource(map[string][]byte).Codeis preserved for backwards compatibility. - The
templates.CreateAccountfunction has changed to accept a list of contracts rather than a singlecodeparameter. This list allows multiple contracts to be deployed upon account creation. templates.UpdateAccountContractfunction replacestemplates.UpdateAccountCode. This function updates a single contract by name.- The
templates.AddAccountContractfunction was added, allowing a contract to be deployed to an existing account.
Reduce transaction template size
By @janezpodhostnik
Byte array values ([UInt8]) used in Cadence templates (CreateAccount, UpdateAccountContract, AddAccountContract) are now typed as String and passed as hexadecimal strings. This was done to reduce the size of the accompanying transaction argument values; hexadecimal strings are much more compact in JSON-CDC than array literals.
This is a breaking change because it alters the deterministic template formats, on which some applications may depend.
⭐ Enhancements
- Example and documentation cleanup (#108, #109) @qq976739120
Version 0.11.0
Monday, November 30th 2020
Network Compatibility
| Emulator v0.10.0 (CLI v0.9.0) | Emulator v0.12.0 (CLI v0.11) | Testnet | Mainnet |
|---|---|---|---|
| ✅ | ❌ | ❌ | ✅ |
💥 Breaking Changes
- Rename
AccountKey.IDtoAccountKey.Index(#101) @psiemens
⭐ Enhancements
- Add
crypto/cloudkmsfor Google Cloud KMS transaction signing support (#96, #105) @psiemens @Kay-Zee - Add block timestamp field to
client.BlockEventsresponse returned byGetEventsInHeightRange(#100) @janezpodhostnik - Add
Revokedflag toflow.AccountKey(#101) @psiemens - Add
crypto.DecodePublicKeyPEMfunction (#96) @psiemens
v0.12.3
Invalid date
- add a Chinese doc (#112) @aturX
- Add Bastian & Janez as code owners (#123) @psiemens
- Update to Cadence v0.11.2 (#122) @turbolent
- Check tidy (#119) @turbolent
🛠 Improvements
- Allow passing options to KMS client constructor. (#114) @10thfloor
Version 0.10.0
Friday, September 18th 2020
Network Compatibility
| Emulator v0.7.0 | Emulator v0.8.0 | Emulator v0.9.0 | Emulator v0.10.0 | Testnet | Mainnet |
|---|---|---|---|---|---|
| ❌ | ❌ | ✅ | ✅ | ✅ | ✅ |
💥 Breaking Changes
- Update
onflow/flow/protobuf/go/flowto v0.1.5 (#98) @turbolent
🐛 Bug Fixes
- Add missing
EXPIREDvalue toflow.TransactionStatusenum (#90) @rrrkren - Do not deploy empty code string on account creation (#97) @psiemens
⭐ Enhancements
- Add transaction example that uses 2 authorizers (#89) @bjartek
- Improve ECDSA documentation (#94) @tarakby
- Improve documentation for the
flow.Transactionfields (#91) @turbolent
Version 0.9.0
Monday, August 10th 2020
Network Compatibility
| Emulator v0.5.0 | Emulator v0.6.0 | Emulator v0.7.0 | Testnet | Mainnet |
|---|---|---|---|---|
| ❌ | ✅ | ✅ | ✅ | ✅ |
💥 Breaking Changes
Upgrade to Cadence v0.8.0: https://github.com/onflow/cadence/releases/tag/v0.8.0
- Arguments passed to
cadence.Value#WithTypeare now typed as pointers (*cadence.Type) rather than values (cadence.Type).
Example:
myEventType := cadence.EventType{...})
// this 👇
myEvent := cadence.NewEvent(...).WithType(myEventType)
// changes to this 👇
myEvent := cadence.NewEvent(...).WithType(&myEventType)Version 0.8.0
Wednesday, July 15th 2020
Network Compatibility
| Emulator v0.4.0 | Emulator v0.5.0 | Emulator v0.6.0 | Testnet | Mainnet |
|---|---|---|---|---|
| ❌ | ❌ | ✅ | ❌ | ❌ |
💥 Breaking Changes
GetAccountAtLatestBlock (https://github.com/onflow/flow-go-sdk/pull/85)
The GetAccount Access API RPC method has been renamed to GetAccountAtLatestBlock to better reflect its functionality and differentiate it from the upcoming GetAccountAtBlockHeight method.
v0.10.1
Invalid date
- ID -> Index (#104) @Kay-Zee
- crypto/cloudkms: Add initial draft of Google Cloud KMS integration (#96) @psiemens
- Update flow.AccountKey to match latest protocol changes (#101) @psiemens
- Added BlockTimestamp to BlockEvents response (#100) @janezpodhostnik
Version 0.7.0
Wednesday, July 8th 2020
Network Compatibility
| Emulator v0.4.0 | Emulator v0.5.0 | Testnet | Mainnet |
|---|---|---|---|
| ❌ | ✅ | ❌ | ❌ |
💥 Breaking Changes
Transaction arguments (https://github.com/onflow/flow-go-sdk/pull/67)
Due to a bug that was causing transaction arguments to be encoded in an inconsistent manner (https://github.com/onflow/flow-go-sdk/issues/66), the flow.Transaction#Arguments field has been updated to be typed as [][]byte rather than []cadence.Value.
This in turn necessitated a change to the flow.Transaction#AddArgument function:
AddArgumentfunction signature changed tofunc (tx *Transaction) AddArgument(arg cadence.Value) error- This function performs JSON-CDC encoding of the provided argument, and therefore has the potential to produce an error.
AddRawArgumentfunction introduced:func (tx *Transaction) AddRawArgument(arg []byte) *Transaction- This is a chainable function that can be used to add pre-encoded arguments.
Transaction templates (https://github.com/onflow/flow-go-sdk/pull/78)
The helpers defined in the templates package have changed to use parameterized transactions and arguments rather than naive string templates. This approach is more flexible and will allow templates to be easily shared between different SDK implementations.
This change breaks the old API by changing the return type of each template function to *flow.Transaction.
For example, this is the signature for templates.CreateAccount:
// CreateAccount generates a transaction that creates a new account.
//
// This template accepts a list of public keys and a code argument, both of which are optional.
//
// The final argument is the address of the account that will pay the account creation fee.
// This account is added as a transaction authorizer and therefore must sign the resulting transaction.
func CreateAccount(accountKeys []*flow.AccountKey, code []byte, payer flow.Address) *flow.TransactionThe partial transactions returned by these helpers functions can later be signed and sent to the Access API.
Cadence v0.5.0 (https://github.com/onflow/flow-go-sdk/pull/77)
The Go SDK has been upgraded to use the latest Cadence release. Please view the Cadence release notes for an overview of the features and changes introduced in this release: https://github.com/onflow/cadence/releases/tag/v0.5.0
🐛 Bug Fixes
- See transaction arguments change above
⭐ Features
- Added
flow.SignUserMessagefunction to support signing of user messages (https://github.com/onflow/flow-go-sdk/pull/76). Example usage
Version 0.6.0
Thursday, June 25th 2020
💥 Breaking Changes
RPC errors
This release introduces a dedicated client.RPCError type for errors returned by the Access API. (#62)
client.RPCError implements the interface defined in the status.FromError function from the google.golang.org/grpc/status package:
import "google.golang.org/grpc/status"
res, err := c.GetTransactionResult(...)
if err != nil {
s, ok := status.FromError(err)
...
}client.RPCError can also be unwrapped to produce the original gRPC error:
grpcErr := errors.Unwrap(rpcErr)Removed crypto.KeyType enum
The crypto.KeyType enum was removed because it is no longer required by the rest of the SDK. (#58)
Version 0.5.0
Monday, June 15th 2020
💥 Breaking Changes
Script arguments
Added support for script arguments, which allows Cadence values to be passed as arguments to ExecuteScript calls. This change affects the following functions on client.Client:
ExecuteScriptAtLatestBlockExecuteScriptAtBlockIDExecuteScriptAtBlockHeight
Each of these functions now takes an additional argument of type []cadence.Value. For scripts that do not require any arguments, simply pass nil:
result, _ := c.ExecuteScriptAtLatestBlock(ctx, myBlockID, myScript, nil)Note: script arguments are not yet supported in the emulator.
🐛 Bug Fixes
- Added thread safety to the
flow.Transaction#IDfunction. This fixes a previous race condition that would occur when generating transaction IDs from multiple routines.
⭐ Features
- Added
flow.TransactionStatusExpiredstatus to theflow.TransactionStatusenum.- Note: transaction expiry is not yet supported by the emulator.