diff --git a/examples/examples.go b/examples/examples.go index 8a99f86dd..a4a913a91 100644 --- a/examples/examples.go +++ b/examples/examples.go @@ -42,13 +42,21 @@ var ( conf config ) +type key struct { + Type string `json:"type"` + Index int `json:"index"` + Context struct { + PrivateKey string `json:"privateKey"` + } + SignatureAlgorithm string `json:"signatureAlgorithm"` + HashAlgorithm string `json:"hashAlgorithm"` +} + type config struct { Accounts struct { Service struct { - Address string `json:"address"` - PrivateKey string `json:"privateKey"` - SigAlgo string `json:"sigAlgorithm"` - HashAlgo string `json:"hashAlgorithm"` + Address string `json:"address"` + Keys []key } } Contracts map[string]string `json:"contracts"` @@ -86,8 +94,8 @@ func init() { } func ServiceAccount(flowClient *client.Client) (flow.Address, *flow.AccountKey, crypto.Signer) { - sigAlgo := crypto.StringToSignatureAlgorithm(conf.Accounts.Service.SigAlgo) - privateKey, err := crypto.DecodePrivateKeyHex(sigAlgo, conf.Accounts.Service.PrivateKey) + sigAlgo := crypto.StringToSignatureAlgorithm(conf.Accounts.Service.Keys[0].SignatureAlgorithm) + privateKey, err := crypto.DecodePrivateKeyHex(sigAlgo, conf.Accounts.Service.Keys[0].Context.PrivateKey) Handle(err) addr := flow.HexToAddress(conf.Accounts.Service.Address) diff --git a/examples/flow.json b/examples/flow.json index 8d1f533e9..ff738406e 100755 --- a/examples/flow.json +++ b/examples/flow.json @@ -1,10 +1,23 @@ { + "emulators": { + "default": { + "serviceAccount": "service" + } + }, "accounts": { "service": { "address": "f8d6e0586b0a20c7", - "privateKey": "68ee617d9bf67a4677af80aaca5a090fcda80ff2f4dbc340e0e36201fa1f1d8c", - "sigAlgorithm": "ECDSA_P256", - "hashAlgorithm": "SHA3_256" + "keys": [ + { + "type": "hex", + "index": 0, + "signatureAlgorithm": "ECDSA_P256", + "hashAlgorithm": "SHA3_256", + "context": { + "privateKey": "68ee617d9bf67a4677af80aaca5a090fcda80ff2f4dbc340e0e36201fa1f1d8c" + } + } + ] } }, "contracts": {