-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: added SIP48 implementation * chore: added unit tests, removed code smells
- Loading branch information
Showing
28 changed files
with
349 additions
and
12 deletions.
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
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
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
34 changes: 34 additions & 0 deletions
34
packages/core/src/api/factories/alias/buyTopLevelDomain.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,34 @@ | ||
/** | ||
* Copyright (c) 2023 Signum Network | ||
*/ | ||
import {ChainService} from '../../../service/chainService'; | ||
import {UnsignedTransaction} from '../../../typings/unsignedTransaction'; | ||
import {signIfPrivateKey} from '../../../internal/signIfPrivateKey'; | ||
import {DefaultDeadline} from '../../../constants'; | ||
import {BuyTopLevelDomainArgs} from '../../../typings/args'; | ||
import {createParametersFromAttachment} from '../../../internal'; | ||
|
||
/** | ||
* Use with [[ApiComposer]] and belongs to [[AliasApi]]. | ||
* | ||
* See details at [[AliasApi.buyTopLevelDomain]] | ||
* | ||
* @module core.api.factories | ||
*/ | ||
export const buyTopLevelDomain = (service: ChainService) => | ||
(args: BuyTopLevelDomainArgs) => | ||
signIfPrivateKey(service, args, async (a: BuyTopLevelDomainArgs) => { | ||
let parameters = { | ||
tld: a.tld, | ||
amountNQT: a.amountPlanck, | ||
deadline: a.deadline || DefaultDeadline, | ||
feeNQT: a.feePlanck, | ||
publicKey: a.senderPublicKey, | ||
referencedTransactionFullHash: a.referencedTransactionFullHash, | ||
}; | ||
|
||
if (args.attachment) { | ||
parameters = createParametersFromAttachment(a.attachment, parameters); | ||
} | ||
return service.send<UnsignedTransaction>('setTLD', parameters); | ||
}); |
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
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
16 changes: 16 additions & 0 deletions
16
packages/core/src/api/factories/alias/getTopLevelDomains.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,16 @@ | ||
/** | ||
* Copyright (c) 2023 Signum Network | ||
*/ | ||
import {ChainService} from '../../../service/chainService'; | ||
import {GetTopLevelDomainsArgs} from '../../../typings/args/getTopLevelDomainsArgs'; | ||
import {TopLevelDomainList} from '../../../typings/topLevelDomainList'; | ||
|
||
/** | ||
* Use with [[ApiComposer]] and belongs to [[AliasApi]]. | ||
* | ||
* See details at [[AliasApi.getTopLevelDomains]] | ||
* @module core.api.factories | ||
*/ | ||
export const getTopLevelDomains = (service: ChainService): | ||
(args: GetTopLevelDomainsArgs) => Promise<TopLevelDomainList> => | ||
(args: GetTopLevelDomainsArgs): Promise<TopLevelDomainList> => service.query('getTLDs', args); |
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
17 changes: 17 additions & 0 deletions
17
packages/core/src/api/factories/alias/searchAliasesByName.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,17 @@ | ||
/** | ||
* Copyright (c) 2019 Burst Apps Team | ||
* Modified (c) 2023 Signum Network | ||
*/ | ||
import {ChainService} from '../../../service/chainService'; | ||
import {AliasList} from '../../../typings/aliasList'; | ||
import { SearchAliasesByNameArgs } from '../../../typings/args/searchAliasesByNameArgs'; | ||
|
||
/** | ||
* Use with [[ApiComposer]] and belongs to [[AliasApi]]. | ||
* | ||
* See details at [[AliasApi.searchAliasesByName]] | ||
* @module core.api.factories | ||
*/ | ||
export const searchAliasesByName = (service: ChainService): | ||
(args: SearchAliasesByNameArgs) => Promise<AliasList> => | ||
(args): Promise<AliasList> => service.query('getAliasesByName', args); |
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 |
---|---|---|
|
@@ -15,5 +15,6 @@ export enum TransactionArbitrarySubtype { | |
AccountInfo, | ||
AliasSale, | ||
AliasBuy, | ||
TopLevelDomainAssignment | ||
} | ||
|
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
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
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
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
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
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
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
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
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,14 @@ | ||
import {DefaultSendArgs} from './defaultSendArgs'; | ||
|
||
|
||
/** | ||
* The argument object for [[AccountApi.setTopLevelDomain]] | ||
* | ||
* @param tld The name of the Top Level Domain (max. 40 chars only digits and letters) | ||
* @param amountPlanck The amount in planck according SIP-48 | ||
* @module core | ||
*/ | ||
export interface BuyTopLevelDomainArgs extends DefaultSendArgs { | ||
tld: string; | ||
amountPlanck: string; | ||
} |
Oops, something went wrong.