-
Notifications
You must be signed in to change notification settings - Fork 2
/
dummy_finder.go
42 lines (33 loc) · 921 Bytes
/
dummy_finder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package paths
import (
"github.com/digitalbitsorg/go/xdr"
)
type DummyFinder struct {
}
func (f *DummyFinder) Find(q Query) ([]Path, error) {
paths := make([]Path, 2)
n, err := xdr.NewAsset(xdr.AssetTypeAssetTypeNative, nil)
if err != nil {
return nil, err
}
paths[0] = DummyPath{
source: n,
destination: n,
path: []xdr.Asset{n, n, n},
}
paths[1] = DummyPath{
source: n,
destination: n,
path: []xdr.Asset{n, n, n},
}
return paths, nil
}
type DummyPath struct {
source xdr.Asset
destination xdr.Asset
path []xdr.Asset
}
func (d DummyPath) Source() xdr.Asset { return d.source }
func (d DummyPath) Destination() xdr.Asset { return d.destination }
func (d DummyPath) Path() []xdr.Asset { return d.path }
func (d DummyPath) Cost(amount xdr.Int64) (xdr.Int64, error) { return amount, nil }