Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Integration with Hedera Hashgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
stoqnkpL committed Aug 26, 2021
1 parent 3ced344 commit acecbfb
Show file tree
Hide file tree
Showing 8 changed files with 777 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
db/
.env
external-initiator
.DS_STORE
.idea
14 changes: 13 additions & 1 deletion blockchain/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ var blockchains = []string{
BIRITA,
Agoric,
Klaytn,
HEDERA,
}

type Params struct {
Endpoint string `json:"endpoint"`
Addresses []string `json:"addresses"`
Topics []string `json:"topics"`
AccountIds []string `json:"accountIds"`
AccountId string `json:"accountId"`
Address string `json:"address"`
UpkeepID string `json:"upkeepId"`
ServiceName string `json:"serviceName"`
Expand Down Expand Up @@ -98,6 +100,8 @@ func CreateClientManager(sub store.Subscription) (subscriber.ISubscriber, error)
return createKeeperSubscriber(sub)
case BIRITA:
return createBSNIritaSubscriber(sub)
case HEDERA:
return createHederaSubscriber(sub), nil
}

return nil, errors.New("unknown blockchain type for Client subscription")
Expand All @@ -106,7 +110,7 @@ func CreateClientManager(sub store.Subscription) (subscriber.ISubscriber, error)
func GetConnectionType(endpoint store.Endpoint) (subscriber.Type, error) {
switch endpoint.Type {
// Add blockchain implementations that encapsulate entire connection here
case XTZ, ONT, IOTX, Keeper, BIRITA:
case XTZ, ONT, IOTX, Keeper, BIRITA, HEDERA:
return subscriber.Client, nil
default:
u, err := url.Parse(endpoint.Url)
Expand Down Expand Up @@ -177,6 +181,10 @@ func GetValidations(t string, params Params) []int {
return []int{
1,
}
case HEDERA:
return []int{
len(params.AccountId),
}
}

return nil
Expand Down Expand Up @@ -228,6 +236,10 @@ func CreateSubscription(sub *store.Subscription, params Params) {
}
case Agoric:
sub.Agoric = store.AgoricSubscription{}
case HEDERA:
sub.Hedera = store.HederaSubscription{
AccountId: params.AccountId,
}
}
}

Expand Down
Loading

0 comments on commit acecbfb

Please sign in to comment.