mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 12:44:19 +01:00
[SDK] Add RoundInterval to StoreData (#283)
Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
This commit is contained in:
@@ -110,6 +110,7 @@ func (a *arkClient) InitWithWallet(
|
|||||||
ClientType: args.ClientType,
|
ClientType: args.ClientType,
|
||||||
Network: network,
|
Network: network,
|
||||||
RoundLifetime: info.RoundLifetime,
|
RoundLifetime: info.RoundLifetime,
|
||||||
|
RoundInterval: info.RoundInterval,
|
||||||
UnilateralExitDelay: info.UnilateralExitDelay,
|
UnilateralExitDelay: info.UnilateralExitDelay,
|
||||||
Dust: info.Dust,
|
Dust: info.Dust,
|
||||||
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
||||||
@@ -174,6 +175,7 @@ func (a *arkClient) Init(
|
|||||||
ClientType: args.ClientType,
|
ClientType: args.ClientType,
|
||||||
Network: network,
|
Network: network,
|
||||||
RoundLifetime: info.RoundLifetime,
|
RoundLifetime: info.RoundLifetime,
|
||||||
|
RoundInterval: info.RoundInterval,
|
||||||
UnilateralExitDelay: info.UnilateralExitDelay,
|
UnilateralExitDelay: info.UnilateralExitDelay,
|
||||||
Dust: info.Dust,
|
Dust: info.Dust,
|
||||||
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ type storeData struct {
|
|||||||
ClientType string `json:"client_type"`
|
ClientType string `json:"client_type"`
|
||||||
Network string `json:"network"`
|
Network string `json:"network"`
|
||||||
RoundLifetime string `json:"round_lifetime"`
|
RoundLifetime string `json:"round_lifetime"`
|
||||||
|
RoundInterval string `json:"round_interval"`
|
||||||
UnilateralExitDelay string `json:"unilateral_exit_delay"`
|
UnilateralExitDelay string `json:"unilateral_exit_delay"`
|
||||||
Dust string `json:"dust"`
|
Dust string `json:"dust"`
|
||||||
BoardingDescriptorTemplate string `json:"boarding_descriptor_template"`
|
BoardingDescriptorTemplate string `json:"boarding_descriptor_template"`
|
||||||
@@ -40,6 +41,7 @@ func (d storeData) isEmpty() bool {
|
|||||||
func (d storeData) decode() store.StoreData {
|
func (d storeData) decode() store.StoreData {
|
||||||
network := utils.NetworkFromString(d.Network)
|
network := utils.NetworkFromString(d.Network)
|
||||||
roundLifetime, _ := strconv.Atoi(d.RoundLifetime)
|
roundLifetime, _ := strconv.Atoi(d.RoundLifetime)
|
||||||
|
roundInterval, _ := strconv.Atoi(d.RoundInterval)
|
||||||
unilateralExitDelay, _ := strconv.Atoi(d.UnilateralExitDelay)
|
unilateralExitDelay, _ := strconv.Atoi(d.UnilateralExitDelay)
|
||||||
dust, _ := strconv.Atoi(d.Dust)
|
dust, _ := strconv.Atoi(d.Dust)
|
||||||
buf, _ := hex.DecodeString(d.AspPubkey)
|
buf, _ := hex.DecodeString(d.AspPubkey)
|
||||||
@@ -53,6 +55,7 @@ func (d storeData) decode() store.StoreData {
|
|||||||
Network: network,
|
Network: network,
|
||||||
RoundLifetime: int64(roundLifetime),
|
RoundLifetime: int64(roundLifetime),
|
||||||
UnilateralExitDelay: int64(unilateralExitDelay),
|
UnilateralExitDelay: int64(unilateralExitDelay),
|
||||||
|
RoundInterval: int64(roundInterval),
|
||||||
Dust: uint64(dust),
|
Dust: uint64(dust),
|
||||||
BoardingDescriptorTemplate: d.BoardingDescriptorTemplate,
|
BoardingDescriptorTemplate: d.BoardingDescriptorTemplate,
|
||||||
ExplorerURL: explorerURL,
|
ExplorerURL: explorerURL,
|
||||||
@@ -67,6 +70,7 @@ func (d storeData) asMap() map[string]string {
|
|||||||
"client_type": d.ClientType,
|
"client_type": d.ClientType,
|
||||||
"network": d.Network,
|
"network": d.Network,
|
||||||
"round_lifetime": d.RoundLifetime,
|
"round_lifetime": d.RoundLifetime,
|
||||||
|
"round_interval": d.RoundInterval,
|
||||||
"unilateral_exit_delay": d.UnilateralExitDelay,
|
"unilateral_exit_delay": d.UnilateralExitDelay,
|
||||||
"dust": d.Dust,
|
"dust": d.Dust,
|
||||||
"boarding_descriptor_template": d.BoardingDescriptorTemplate,
|
"boarding_descriptor_template": d.BoardingDescriptorTemplate,
|
||||||
@@ -113,6 +117,7 @@ func (s *Store) AddData(ctx context.Context, data store.StoreData) error {
|
|||||||
ClientType: data.ClientType,
|
ClientType: data.ClientType,
|
||||||
Network: data.Network.Name,
|
Network: data.Network.Name,
|
||||||
RoundLifetime: fmt.Sprintf("%d", data.RoundLifetime),
|
RoundLifetime: fmt.Sprintf("%d", data.RoundLifetime),
|
||||||
|
RoundInterval: fmt.Sprintf("%d", data.RoundInterval),
|
||||||
UnilateralExitDelay: fmt.Sprintf("%d", data.UnilateralExitDelay),
|
UnilateralExitDelay: fmt.Sprintf("%d", data.UnilateralExitDelay),
|
||||||
Dust: fmt.Sprintf("%d", data.Dust),
|
Dust: fmt.Sprintf("%d", data.Dust),
|
||||||
BoardingDescriptorTemplate: data.BoardingDescriptorTemplate,
|
BoardingDescriptorTemplate: data.BoardingDescriptorTemplate,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ type StoreData struct {
|
|||||||
ClientType string
|
ClientType string
|
||||||
Network common.Network
|
Network common.Network
|
||||||
RoundLifetime int64
|
RoundLifetime int64
|
||||||
|
RoundInterval int64
|
||||||
UnilateralExitDelay int64
|
UnilateralExitDelay int64
|
||||||
Dust uint64
|
Dust uint64
|
||||||
BoardingDescriptorTemplate string
|
BoardingDescriptorTemplate string
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ func TestStore(t *testing.T) {
|
|||||||
ClientType: client.GrpcClient,
|
ClientType: client.GrpcClient,
|
||||||
Network: common.LiquidRegTest,
|
Network: common.LiquidRegTest,
|
||||||
RoundLifetime: 512,
|
RoundLifetime: 512,
|
||||||
|
RoundInterval: 10,
|
||||||
UnilateralExitDelay: 512,
|
UnilateralExitDelay: 512,
|
||||||
Dust: 1000,
|
Dust: 1000,
|
||||||
BoardingDescriptorTemplate: "tr(0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0,{ and(pk(873079a0091c9b16abd1f8c508320b07f0d50144d09ccd792ce9c915dac60465), pk(USER)), and(older(604672), pk(USER)) })",
|
BoardingDescriptorTemplate: "tr(0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0,{ and(pk(873079a0091c9b16abd1f8c508320b07f0d50144d09ccd792ce9c915dac60465), pk(USER)), and(older(604672), pk(USER)) })",
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ func TestWallet(t *testing.T) {
|
|||||||
ClientType: client.GrpcClient,
|
ClientType: client.GrpcClient,
|
||||||
Network: common.LiquidRegTest,
|
Network: common.LiquidRegTest,
|
||||||
RoundLifetime: 512,
|
RoundLifetime: 512,
|
||||||
|
RoundInterval: 10,
|
||||||
UnilateralExitDelay: 512,
|
UnilateralExitDelay: 512,
|
||||||
Dust: 1000,
|
Dust: 1000,
|
||||||
BoardingDescriptorTemplate: "tr(0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0,{ and(pk(873079a0091c9b16abd1f8c508320b07f0d50144d09ccd792ce9c915dac60465), pk(USER)), and(older(604672), pk(USER)) })",
|
BoardingDescriptorTemplate: "tr(0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0,{ and(pk(873079a0091c9b16abd1f8c508320b07f0d50144d09ccd792ce9c915dac60465), pk(USER)), and(older(604672), pk(USER)) })",
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ type storeData struct {
|
|||||||
ExplorerURL string `json:"explorer_url"`
|
ExplorerURL string `json:"explorer_url"`
|
||||||
Network string `json:"network"`
|
Network string `json:"network"`
|
||||||
RoundLifetime string `json:"round_lifetime"`
|
RoundLifetime string `json:"round_lifetime"`
|
||||||
|
RoundInterval string `json:"round_interval"`
|
||||||
UnilateralExitDelay string `json:"unilateral_exit_delay"`
|
UnilateralExitDelay string `json:"unilateral_exit_delay"`
|
||||||
Dust string `json:"dust"`
|
Dust string `json:"dust"`
|
||||||
}
|
}
|
||||||
@@ -57,6 +58,7 @@ func (s *localStorageStore) AddData(ctx context.Context, data store.StoreData) e
|
|||||||
ClientType: data.ClientType,
|
ClientType: data.ClientType,
|
||||||
Network: data.Network.Name,
|
Network: data.Network.Name,
|
||||||
RoundLifetime: fmt.Sprintf("%d", data.RoundLifetime),
|
RoundLifetime: fmt.Sprintf("%d", data.RoundLifetime),
|
||||||
|
RoundInterval: fmt.Sprintf("%d", data.RoundInterval),
|
||||||
UnilateralExitDelay: fmt.Sprintf("%d", data.UnilateralExitDelay),
|
UnilateralExitDelay: fmt.Sprintf("%d", data.UnilateralExitDelay),
|
||||||
Dust: fmt.Sprintf("%d", data.Dust),
|
Dust: fmt.Sprintf("%d", data.Dust),
|
||||||
}
|
}
|
||||||
@@ -82,6 +84,7 @@ func (s *localStorageStore) GetData(ctx context.Context) (*store.StoreData, erro
|
|||||||
}
|
}
|
||||||
network := utils.NetworkFromString(s.store.Call("getItem", "network").String())
|
network := utils.NetworkFromString(s.store.Call("getItem", "network").String())
|
||||||
roundLifetime, _ := strconv.Atoi(s.store.Call("getItem", "round_lifetime").String())
|
roundLifetime, _ := strconv.Atoi(s.store.Call("getItem", "round_lifetime").String())
|
||||||
|
roundInterval, _ := strconv.Atoi(s.store.Call("getItem", "round_interval").String())
|
||||||
unilateralExitDelay, _ := strconv.Atoi(s.store.Call("getItem", "unilateral_exit_delay").String())
|
unilateralExitDelay, _ := strconv.Atoi(s.store.Call("getItem", "unilateral_exit_delay").String())
|
||||||
dust, _ := strconv.Atoi(s.store.Call("getItem", "min_relay_fee").String())
|
dust, _ := strconv.Atoi(s.store.Call("getItem", "min_relay_fee").String())
|
||||||
|
|
||||||
@@ -92,6 +95,7 @@ func (s *localStorageStore) GetData(ctx context.Context) (*store.StoreData, erro
|
|||||||
ClientType: s.store.Call("getItem", "client_type").String(),
|
ClientType: s.store.Call("getItem", "client_type").String(),
|
||||||
Network: network,
|
Network: network,
|
||||||
RoundLifetime: int64(roundLifetime),
|
RoundLifetime: int64(roundLifetime),
|
||||||
|
RoundInterval: int64(roundInterval),
|
||||||
UnilateralExitDelay: int64(unilateralExitDelay),
|
UnilateralExitDelay: int64(unilateralExitDelay),
|
||||||
Dust: uint64(dust),
|
Dust: uint64(dust),
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user