(client *cpclient.Client, privateKey *ecdsa.PrivateKey, fromAddress common.Address)
| 92 | } |
| 93 | |
| 94 | func newAuth(client *cpclient.Client, privateKey *ecdsa.PrivateKey, fromAddress common.Address) *bind.TransactOpts { |
| 95 | auth := bind.NewKeyedTransactor(privateKey) |
| 96 | newNonce := uint64(0) |
| 97 | |
| 98 | if needInit { |
| 99 | blockNumber := client.GetBlockNumber() |
| 100 | |
| 101 | initNonce, err := client.NonceAt(context.Background(), fromAddress, blockNumber) |
| 102 | if err != nil { |
| 103 | fmt.Println("get nonce failed", err) |
| 104 | } |
| 105 | GetNonceInstance(initNonce) |
| 106 | } |
| 107 | newNonce = GetNonceInstance(0).GetNonce() |
| 108 | fmt.Println("newNonce:", newNonce) |
| 109 | auth.Nonce = new(big.Int).SetUint64(newNonce) |
| 110 | return auth |
| 111 | |
| 112 | } |
| 113 | |
| 114 | func newTransactor(privateKey *ecdsa.PrivateKey, nonce *big.Int) *bind.TransactOpts { |
| 115 | auth := bind.NewKeyedTransactor(privateKey) |
nothing calls this directly
no test coverage detected