feat: make activity check optional
This commit is contained in:
parent
20bc27619b
commit
e5ce2c7c03
|
@ -471,28 +471,28 @@ func (api *API) AddressExists(ctx context.Context, address types.Address) (bool,
|
||||||
|
|
||||||
// Returns details for the passed address (response doesn't include derivation path)
|
// Returns details for the passed address (response doesn't include derivation path)
|
||||||
func (api *API) GetAddressDetails(ctx context.Context, chainID uint64, address string) (*DerivedAddress, error) {
|
func (api *API) GetAddressDetails(ctx context.Context, chainID uint64, address string) (*DerivedAddress, error) {
|
||||||
commonAddr := common.HexToAddress(address)
|
result := &DerivedAddress{
|
||||||
addressExists, err := api.s.accountsDB.AddressExists(types.Address(commonAddr))
|
Address: common.HexToAddress(address),
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
addressExists, err := api.s.accountsDB.AddressExists(types.Address(result.Address))
|
||||||
|
if err != nil {
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result.AlreadyCreated = addressExists
|
||||||
|
|
||||||
chainClient, err := api.s.rpcClient.EthClient(chainID)
|
chainClient, err := api.s.rpcClient.EthClient(chainID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
balance, err := api.s.tokenManager.GetChainBalance(ctx, chainClient, commonAddr)
|
balance, err := api.s.tokenManager.GetChainBalance(ctx, chainClient, result.Address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &DerivedAddress{
|
result.HasActivity = balance.Cmp(big.NewInt(0)) != 0
|
||||||
Address: commonAddr,
|
return result, nil
|
||||||
Path: "",
|
|
||||||
AlreadyCreated: addressExists,
|
|
||||||
HasActivity: balance.Cmp(big.NewInt(0)) != 0,
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *API) CreateMultiTransaction(ctx context.Context, multiTransactionCommand *transfer.MultiTransactionCommand, data []*bridge.TransactionBridge, password string) (*transfer.MultiTransactionCommandResult, error) {
|
func (api *API) CreateMultiTransaction(ctx context.Context, multiTransactionCommand *transfer.MultiTransactionCommand, data []*bridge.TransactionBridge, password string) (*transfer.MultiTransactionCommandResult, error) {
|
||||||
|
|
Loading…
Reference in New Issue