forked from Salvionied/apollo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backends.go
46 lines (42 loc) · 1.19 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
package apollo
import (
"github.com/SundaeSwap-finance/apollo/constants"
"github.com/SundaeSwap-finance/apollo/txBuilding/Backend/BlockFrostChainContext"
"github.com/SundaeSwap-finance/apollo/txBuilding/Backend/FixedChainContext"
)
func NewEmptyBackend() FixedChainContext.FixedChainContext {
return FixedChainContext.InitFixedChainContext()
}
func NewBlockfrostBackend(
projectId string,
network constants.Network,
) BlockFrostChainContext.BlockFrostChainContext {
switch network {
case constants.MAINNET:
return BlockFrostChainContext.NewBlockfrostChainContext(
constants.BLOCKFROST_BASE_URL_MAINNET,
int(constants.MAINNET),
projectId,
)
case constants.TESTNET:
return BlockFrostChainContext.NewBlockfrostChainContext(
constants.BLOCKFROST_BASE_URL_TESTNET,
int(constants.TESTNET),
projectId,
)
case constants.PREVIEW:
return BlockFrostChainContext.NewBlockfrostChainContext(
constants.BLOCKFROST_BASE_URL_PREVIEW,
int(constants.TESTNET),
projectId,
)
case constants.PREPROD:
return BlockFrostChainContext.NewBlockfrostChainContext(
constants.BLOCKFROST_BASE_URL_PREPROD,
int(constants.TESTNET),
projectId,
)
default:
panic("Invalid network")
}
}