-
Notifications
You must be signed in to change notification settings - Fork 9
/
backends.go
47 lines (42 loc) · 1.1 KB
/
backends.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
43
44
45
46
47
package apollo
import (
"fmt"
"github.com/Salvionied/apollo/txBuilding/Backend/BlockFrostChainContext"
"github.com/Salvionied/apollo/txBuilding/Backend/FixedChainContext"
)
func NewEmptyBackend() FixedChainContext.FixedChainContext {
return FixedChainContext.InitFixedChainContext()
}
func NewBlockfrostBackend(
projectId string,
network Network,
) (BlockFrostChainContext.BlockFrostChainContext, error) {
switch network {
case MAINNET:
return BlockFrostChainContext.NewBlockfrostChainContext(
BLOCKFROST_BASE_URL_MAINNET,
int(MAINNET),
projectId,
), nil
case TESTNET:
return BlockFrostChainContext.NewBlockfrostChainContext(
BLOCKFROST_BASE_URL_TESTNET,
int(TESTNET),
projectId,
), nil
case PREVIEW:
return BlockFrostChainContext.NewBlockfrostChainContext(
BLOCKFROST_BASE_URL_PREVIEW,
int(TESTNET),
projectId,
), nil
case PREPROD:
return BlockFrostChainContext.NewBlockfrostChainContext(
BLOCKFROST_BASE_URL_PREPROD,
int(TESTNET),
projectId,
), nil
default:
return BlockFrostChainContext.BlockFrostChainContext{}, fmt.Errorf("Invalid network")
}
}