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

Commit a58e372

Browse files
committed
Integration with Hedera Hashgraph
Signed-off-by: Stoyan Panayotov <[email protected]>
1 parent 3ced344 commit a58e372

File tree

8 files changed

+777
-4
lines changed

8 files changed

+777
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
db/
22
.env
33
external-initiator
4+
.DS_STORE
5+
.idea

blockchain/common.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ var blockchains = []string{
4646
BIRITA,
4747
Agoric,
4848
Klaytn,
49+
HEDERA,
4950
}
5051

5152
type Params struct {
5253
Endpoint string `json:"endpoint"`
5354
Addresses []string `json:"addresses"`
5455
Topics []string `json:"topics"`
5556
AccountIds []string `json:"accountIds"`
57+
AccountId string `json:"accountId"`
5658
Address string `json:"address"`
5759
UpkeepID string `json:"upkeepId"`
5860
ServiceName string `json:"serviceName"`
@@ -98,6 +100,8 @@ func CreateClientManager(sub store.Subscription) (subscriber.ISubscriber, error)
98100
return createKeeperSubscriber(sub)
99101
case BIRITA:
100102
return createBSNIritaSubscriber(sub)
103+
case HEDERA:
104+
return createHederaSubscriber(sub), nil
101105
}
102106

103107
return nil, errors.New("unknown blockchain type for Client subscription")
@@ -106,7 +110,7 @@ func CreateClientManager(sub store.Subscription) (subscriber.ISubscriber, error)
106110
func GetConnectionType(endpoint store.Endpoint) (subscriber.Type, error) {
107111
switch endpoint.Type {
108112
// Add blockchain implementations that encapsulate entire connection here
109-
case XTZ, ONT, IOTX, Keeper, BIRITA:
113+
case XTZ, ONT, IOTX, Keeper, BIRITA, HEDERA:
110114
return subscriber.Client, nil
111115
default:
112116
u, err := url.Parse(endpoint.Url)
@@ -177,6 +181,10 @@ func GetValidations(t string, params Params) []int {
177181
return []int{
178182
1,
179183
}
184+
case HEDERA:
185+
return []int{
186+
len(params.AccountId),
187+
}
180188
}
181189

182190
return nil
@@ -228,6 +236,10 @@ func CreateSubscription(sub *store.Subscription, params Params) {
228236
}
229237
case Agoric:
230238
sub.Agoric = store.AgoricSubscription{}
239+
case HEDERA:
240+
sub.Hedera = store.HederaSubscription{
241+
AccountId: params.AccountId,
242+
}
231243
}
232244
}
233245

0 commit comments

Comments
 (0)