forked from TrueCloudLab/frostfs-node
[#750] adm: Drop deprecated CreateTxFromScript()
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
b0d303f3ed
commit
7f35f2fb1d
5 changed files with 25 additions and 100 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/actor"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/gas"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/neo"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/nep17"
|
||||
|
@ -61,13 +62,7 @@ func (c *initializeContext) transferFunds() error {
|
|||
},
|
||||
)
|
||||
|
||||
tx, err := createNEP17MultiTransferTx(c.Client, c.ConsensusAcc, 0, transfers, []rpcclient.SignerAccount{{
|
||||
Signer: transaction.Signer{
|
||||
Account: c.ConsensusAcc.Contract.ScriptHash(),
|
||||
Scopes: transaction.CalledByEntry,
|
||||
},
|
||||
Account: c.ConsensusAcc,
|
||||
}})
|
||||
tx, err := createNEP17MultiTransferTx(c.Client, c.ConsensusAcc, transfers)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't create transfer transaction: %w", err)
|
||||
}
|
||||
|
@ -156,11 +151,11 @@ func (c *initializeContext) transferGASToProxy() error {
|
|||
return err
|
||||
}
|
||||
|
||||
tx, err := createNEP17MultiTransferTx(c.Client, c.CommitteeAcc, 0, []rpcclient.TransferTarget{{
|
||||
tx, err := createNEP17MultiTransferTx(c.Client, c.CommitteeAcc, []rpcclient.TransferTarget{{
|
||||
Token: gas.Hash,
|
||||
Address: proxyCs.Hash,
|
||||
Amount: initialProxyGASAmount,
|
||||
}}, nil)
|
||||
}})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -172,8 +167,8 @@ func (c *initializeContext) transferGASToProxy() error {
|
|||
return c.awaitTx()
|
||||
}
|
||||
|
||||
func createNEP17MultiTransferTx(c Client, acc *wallet.Account, netFee int64,
|
||||
recipients []rpcclient.TransferTarget, cosigners []rpcclient.SignerAccount) (*transaction.Transaction, error) {
|
||||
func createNEP17MultiTransferTx(c Client, acc *wallet.Account,
|
||||
recipients []rpcclient.TransferTarget) (*transaction.Transaction, error) {
|
||||
from := acc.Contract.ScriptHash()
|
||||
|
||||
w := io.NewBufBinWriter()
|
||||
|
@ -185,11 +180,18 @@ func createNEP17MultiTransferTx(c Client, acc *wallet.Account, netFee int64,
|
|||
if w.Err != nil {
|
||||
return nil, fmt.Errorf("failed to create transfer script: %w", w.Err)
|
||||
}
|
||||
return c.CreateTxFromScript(w.Bytes(), acc, -1, netFee, append([]rpcclient.SignerAccount{{
|
||||
|
||||
signers := []actor.SignerAccount{{
|
||||
Signer: transaction.Signer{
|
||||
Account: from,
|
||||
Account: acc.Contract.ScriptHash(),
|
||||
Scopes: transaction.CalledByEntry,
|
||||
},
|
||||
Account: acc,
|
||||
}}, cosigners...))
|
||||
}}
|
||||
|
||||
act, err := actor.New(c, signers)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't create actor: %w", err)
|
||||
}
|
||||
return act.MakeRun(w.Bytes())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue