export_test.go 877 Bytes
Newer Older
1 2 3 4 5 6 7
// Copyright 2020 The Swarm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package ens

import (
8
	"github.com/ethereum/go-ethereum/common"
9
	"github.com/ethereum/go-ethereum/ethclient"
10
	goens "github.com/wealdtech/go-ens/v3"
11 12
)

13
const SwarmContentHashPrefix = swarmContentHashPrefix
14

15
var ErrNotImplemented = errNotImplemented
16

17 18
// WithConnectFunc will set the Dial function implementaton.
func WithConnectFunc(fn func(endpoint string, contractAddr string) (*ethclient.Client, *goens.Registry, error)) Option {
19
	return func(c *Client) {
20
		c.connectFn = fn
21 22 23 24
	}
}

// WithResolveFunc will set the Resolve function implementation.
25
func WithResolveFunc(fn func(registry *goens.Registry, addr common.Address, input string) (string, error)) Option {
26 27 28 29
	return func(c *Client) {
		c.resolveFn = fn
	}
}