This repository has been archived by the owner on Jul 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(profiles): implement
RegistrationAggregate
(#648)
- Loading branch information
1 parent
a7e45c8
commit 880cedc
Showing
3 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
packages/platform-sdk-profiles/src/profiles/aggregates/registration-aggregate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Coins, Contracts } from "@arkecosystem/platform-sdk"; | ||
|
||
export class RegistrationAggregate { | ||
// @TODO: add typehint | ||
readonly #wallet; | ||
|
||
// @TODO: add typehint | ||
public constructor(wallet) { | ||
this.#wallet = wallet; | ||
} | ||
|
||
public async businesses(query: Contracts.ClientPagination = {}): Promise<Coins.TransactionDataCollection> { | ||
return this.#wallet.client().transactions({ | ||
...query, | ||
entityType: "business", | ||
senderPublicKey: this.#wallet.publicKey(), | ||
}); | ||
} | ||
|
||
public async delegates(query: Contracts.ClientPagination = {}): Promise<Coins.TransactionDataCollection> { | ||
return this.#wallet.client().transactions({ | ||
...query, | ||
entityType: "delegate", | ||
senderPublicKey: this.#wallet.publicKey(), | ||
}); | ||
} | ||
|
||
public async corePlugins(query: Contracts.ClientPagination = {}): Promise<Coins.TransactionDataCollection> { | ||
return this.#wallet.client().transactions({ | ||
...query, | ||
entityType: "corePlugin", | ||
senderPublicKey: this.#wallet.publicKey(), | ||
}); | ||
} | ||
|
||
public async desktopWalletPlugins( | ||
query: Contracts.ClientPagination = {}, | ||
): Promise<Coins.TransactionDataCollection> { | ||
return this.#wallet.client().transactions({ | ||
...query, | ||
entityType: "desktopWalletPlugin", | ||
senderPublicKey: this.#wallet.publicKey(), | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters