Skip to content

Commit

Permalink
update to stable cadence flowkit and fix tests (#137)
Browse files Browse the repository at this point in the history
* update to stable cadence flowkit and fix tests

* tidy

* removed restricted types and fixed tests

* started updating overflow to new stable cadence

* fixed remaining errors

* added AuthorizerTypes to OverflowResult

* update to stable-cadence.3

* add error message if you are creating account with a configured address and another one is created

* fixed tests with some TODOs regarding computation (#147)

* fixed tests with some TODOs regarding computation

* bump to latest version of stable-cadence

* fix: fix filtering out so we do not filter out NFT events

* filter out temp events

* added propper Authorizers to bot transactions parsed and send in

* try to give better error message when a transaction fails, include the filename

* added require versions of assert failure and success

* feat: implemented custom options to a tx to assert events and failure/success using builder methods

* fix: added helper to change an EventAssertion with replacing a field

* feat: update to new cli version

* fix: update to new flowkit

* fix: fixed tests

* add raw event to OverflowEvent

* merge main and fix tests

* use underflow (#155)

* use underflow

* allow setting underflow option and use that. breaks a bit of bc

* use new version of underflow

* tidy

* migrate to v2, fix warnigns
  • Loading branch information
bjartek committed Feb 26, 2024
1 parent 6e86330 commit 4a9b777
Show file tree
Hide file tree
Showing 82 changed files with 5,692 additions and 4,865 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: coveralls cover install-gotestsum test-report

coveralls:
go test --timeout 120s -coverprofile=profile.cov -covermode=atomic -coverpkg=github.com/bjartek/overflow -v ./...
go test --timeout 120s -coverprofile=profile.cov -covermode=atomic -coverpkg=github.com/bjartek/overflow/v2 -v ./...

cover: coveralls
go tool cover -html=profile.cov
Expand Down
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# Overflow

This is the v2 version of overflow to be used with cadence 1.0, for the v1 version that targets 0.x look in the v1 branch.

A DSL written in golang to be used in tests or to run a `story` of interactions against either an local emulator, testnet, mainnet or an in memory instance of the flow-emulator.

Use case scenarios include:
Expand Down Expand Up @@ -46,7 +48,7 @@ First create a project directory, initialize the go module and install `overflow
mkdir test-overflow && cd test-overflow
flow init
go mod init example.com/test-overflow
go get github.com/bjartek/overflow
go get github.com/bjartek/overflow/v2
```

Then create a task file:
Expand All @@ -64,7 +66,7 @@ import (
"fmt"

//if you imports this with . you do not have to repeat overflow everywhere
. "github.com/bjartek/overflow"
. "github.com/bjartek/overflow/v2"
)

func main() {
Expand Down Expand Up @@ -95,18 +97,12 @@ The following env vars are supported
- OVERFLOW_LOGGING: Set this to 0-4 to get increasing log


## Migrating from v0 api
## Migrating from v1 api

You need to change your imports to be v2 and not v1

Please note the following if you migrate from an earlier version of overflow that was not tagged
- "github.com/bjartek/overflow/overflow" -> "github.com/bjartek/overflow"
- overflow.Overflow -> overflow.OverflowState
- on OverflowState Script -> InlineScript
- FlowTransationBuilder -> OverflowInteractionBuilder
- FlowArgumentsBuilder -> OverflowArgumentsBuilder
- Discord dependency is gone, if you need the code ask
- almost all of the v0 is deprecated in favor of the functional builders `Overflow` to set up the client and , `Tx`, `Script`, `FetchEvents` to interact with it

## Credits

This project is the successor of https://github.com/bjartek/go-with-the-flow
The v0 version of the code with a set of apis that is now deprecated is in https://github.com/bjartek/overflow/tree/v0
The v1 version of the code with a set of apis that is now deprecated is in https://github.com/bjartek/overflow/tree/v1
73 changes: 0 additions & 73 deletions account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,76 +62,3 @@ func TestGetAccount(t *testing.T) {

})
}

/*
func TestCheckContractUpdate(t *testing.T) {
t.Run("Should return the updatable contracts", func(t *testing.T) {
g, err := OverflowTesting()
require.NoError(t, err)
res, err := g.CheckContractUpdates()
assert.Nil(t, err)
autogold.Equal(t, res)
})
t.Run("Should return the updatable contracts (updatable)", func(t *testing.T) {
g, err := OverflowTesting()
require.NoError(t, err)
code := []byte(`pub contract Debug{
pub struct FooListBar {
pub let foo:[Foo2]
pub let bar:String
init(foo:[Foo2], bar:String) {
self.foo=foo
self.bar=bar
}
}
pub struct Foo2{
pub let bar: Address
init(bar: Address) {
self.bar=bar
}
}
pub struct FooBar {
pub let foo:Foo
pub let bar:String
init(foo:Foo, bar:String) {
self.foo=foo
self.bar=bar
}
}
pub struct Foo{
pub let bar: String
init(bar: String) {
self.bar=bar
}
}
pub event Log(msg: String)
pub event LogNum(id: UInt64)
pub fun haha(){}
}`)
contract := flowkit.NewScript(code, []cadence.Value{}, "Debug")
err = g.AddContract("account", contract, true)
assert.Nil(t, err)
res, err := g.CheckContractUpdates()
assert.Nil(t, err)
autogold.Equal(t, res)
})
}
*/
Loading

0 comments on commit 4a9b777

Please sign in to comment.