generated from TrueCloudLab/basic
WIP: morph: Pass actor providers instead actors themselves #45
1 changed files with 15 additions and 5 deletions
|
@ -29,18 +29,28 @@ type ContractStorage struct {
|
|||
|
||||
var _ engine.MorphRuleChainStorage = (*ContractStorage)(nil)
|
||||
|
||||
func NewContractStorage(actor client.Actor, contract util.Uint160) *ContractStorage {
|
||||
type ActorProvider interface {
|
||||
GetActor() client.Actor
|
||||
}
|
||||
|
||||
func NewContractStorage(actorProvider ActorProvider, contract util.Uint160) *ContractStorage {
|
||||
return &ContractStorage{
|
||||
contractInterface: client.New(actor, contract),
|
||||
contractInterface: client.New(actorProvider.GetActor(), contract),
|
||||
}
|
||||
}
|
||||
|
||||
func NewContractStorageWithSimpleActor(rpcActor actor.RPCActor, acc *wallet.Account, contract util.Uint160) (*ContractStorage, error) {
|
||||
act, err := actor.NewSimple(rpcActor, acc)
|
||||
type RPCActorProvider interface {
|
||||
GetRPCActor() actor.RPCActor
|
||||
}
|
||||
|
||||
func NewContractStorageWithSimpleActor(rpcActorProvider RPCActorProvider, acc *wallet.Account, contract util.Uint160) (*ContractStorage, error) {
|
||||
act, err := actor.NewSimple(rpcActorProvider.GetRPCActor(), acc)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create simple actor: %w", err)
|
||||
}
|
||||
return NewContractStorage(act, contract), nil
|
||||
return &ContractStorage{
|
||||
contractInterface: client.New(act, contract),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *ContractStorage) AddMorphRuleChain(name chain.Name, target engine.Target, c *chain.Chain) (txHash util.Uint256, vub uint32, err error) {
|
||||
|
|
Loading…
Reference in a new issue