@@ -21,22 +21,22 @@ package blockchain
21
21
import (
22
22
"context"
23
23
"fmt"
24
-
25
- userErr "github.com/dapperlabs/flow-playground-api/middleware/errors"
26
24
"github.com/onflow/cadence"
27
25
jsoncdc "github.com/onflow/cadence/encoding/json"
28
26
"github.com/onflow/cadence/runtime/common"
29
27
"github.com/onflow/cadence/runtime/parser"
30
- kit "github.com/onflow/flow-cli/flowkit"
31
- "github.com/onflow/flow-cli/flowkit/accounts"
32
- "github.com/onflow/flow-cli/flowkit/config"
33
- "github.com/onflow/flow-cli/flowkit/gateway"
34
- "github.com/onflow/flow-cli/flowkit/output"
35
- "github.com/onflow/flow-cli/flowkit/transactions"
28
+ kit "github.com/onflow/flowkit/v2"
29
+ "github.com/onflow/flowkit/v2/accounts"
30
+ "github.com/onflow/flowkit/v2/config"
31
+ "github.com/onflow/flowkit/v2/gateway"
32
+ "github.com/onflow/flowkit/v2/output"
33
+ "github.com/onflow/flowkit/v2/transactions"
34
+
36
35
emu "github.com/onflow/flow-emulator/emulator"
37
36
"github.com/onflow/flow-emulator/storage/memstore"
38
37
"github.com/onflow/flow-go-sdk"
39
38
"github.com/onflow/flow-go-sdk/crypto"
39
+ userErr "github.com/onflow/flow-playground-api/middleware/errors"
40
40
"github.com/pkg/errors"
41
41
"github.com/rs/zerolog"
42
42
)
@@ -95,7 +95,8 @@ type flowKit struct {
95
95
96
96
func newFlowkit () (* flowKit , error ) {
97
97
readerWriter := NewInternalReaderWriter ()
98
- state , err := kit .Init (readerWriter , crypto .ECDSA_P256 , crypto .SHA3_256 )
98
+ state , err := kit .Init (readerWriter )
99
+ state , err = kit .Load ([]string {"flow.json" }, readerWriter )
99
100
if err != nil {
100
101
return nil , errors .Wrap (err , "failed to create flow-kit state" )
101
102
}
@@ -211,7 +212,7 @@ func (fk *flowKit) bootstrapContracts() error {
211
212
212
213
state .Deployments ().AddOrUpdate (config.Deployment {
213
214
Network : config .EmulatorNetwork .Name ,
214
- Account : fmt .Sprintf ("Emulator Account 0x%d " , i ),
215
+ Account : fmt .Sprintf ("Emulator Account 0x%x " , i ),
215
216
Contracts : emulatorContracts ,
216
217
})
217
218
}
@@ -294,6 +295,7 @@ func (fk *flowKit) executeScript(script string, arguments []string) (cadence.Val
294
295
Location : "" ,
295
296
},
296
297
kit .LatestScriptQuery )
298
+
297
299
if err != nil {
298
300
return nil , nil , userErr .NewUserError (err .Error ())
299
301
}
@@ -391,7 +393,7 @@ func (fk *flowKit) createAccount() (*flow.Account, error) {
391
393
return nil , err
392
394
}
393
395
394
- name := fmt .Sprintf ("Account 0x0%d " , len (state .Accounts ().Names ())- 1 )
396
+ name := fmt .Sprintf ("Account 0x0%x " , len (state .Accounts ().Names ()))
395
397
396
398
state .Accounts ().AddOrUpdate (& accounts.Account {
397
399
Name : name ,
@@ -534,7 +536,7 @@ func (fk *flowKit) sendTransaction(
534
536
}
535
537
536
538
func (fk * flowKit ) getLatestBlockHeight () (int , error ) {
537
- block , err := fk .blockchain .Gateway ().GetLatestBlock ()
539
+ block , err := fk .blockchain .Gateway ().GetLatestBlock (context . Background () )
538
540
if err != nil {
539
541
return 0 , err
540
542
}
@@ -546,7 +548,6 @@ func (fk *flowKit) getServiceAccount() (*accounts.Account, error) {
546
548
if err != nil {
547
549
return nil , err
548
550
}
549
-
550
551
service , err := state .EmulatorServiceAccount ()
551
552
if err != nil {
552
553
return nil , err
0 commit comments