This repository has been archived by the owner on Jul 7, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3abd323
commit 83cba7d
Showing
60 changed files
with
639 additions
and
220 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from "./peer"; | ||
export * from "./signed-transaction"; | ||
export * from "./transaction"; | ||
export * from "./transactions"; | ||
export * from "./wallet"; |
39 changes: 39 additions & 0 deletions
39
packages/platform-sdk-ark/src/dto/signed-transaction.test.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,39 @@ | ||
import "jest-extended"; | ||
|
||
import { BigNumber } from "@arkecosystem/platform-sdk-support"; | ||
|
||
import { SignedTransactionData } from "./signed-transaction"; | ||
|
||
let subject: SignedTransactionData; | ||
|
||
beforeEach(() => { | ||
subject = new SignedTransactionData("3e3817fd0c35bc36674f3874c2953fa3e35877cbcdb44a08bdc6083dbd39d572", { | ||
id: "3e3817fd0c35bc36674f3874c2953fa3e35877cbcdb44a08bdc6083dbd39d572", | ||
amount: "12500000000000000", | ||
fee: "0", | ||
senderPublicKey: "0208e6835a8f020cfad439c059b89addc1ce21f8cab0af6e6957e22d3720bff8a4", | ||
recipientId: "D6Z26L69gdk9qYmTv5uzk3uGepigtHY4ax", | ||
}); | ||
}); | ||
|
||
describe("SignedTransactionData", function () { | ||
test("#id", () => { | ||
expect(subject.id()).toBe("3e3817fd0c35bc36674f3874c2953fa3e35877cbcdb44a08bdc6083dbd39d572"); | ||
}); | ||
|
||
test("#sender", () => { | ||
expect(subject.sender()).toBe("DLK7ts2DpkbeBjFamuFtHLoDAq5upDhCmf"); | ||
}); | ||
|
||
test("#recipient", () => { | ||
expect(subject.recipient()).toBe("D6Z26L69gdk9qYmTv5uzk3uGepigtHY4ax"); | ||
}); | ||
|
||
test("#amount", () => { | ||
expect(subject.amount()).toEqual(BigNumber.make("12500000000000000")); | ||
}); | ||
|
||
test("#fee", () => { | ||
expect(subject.fee()).toEqual(BigNumber.ZERO); | ||
}); | ||
}); |
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,26 @@ | ||
import { Identities } from "@arkecosystem/crypto"; | ||
import { Contracts, DTO } from "@arkecosystem/platform-sdk"; | ||
import { BigNumber } from "@arkecosystem/platform-sdk-support"; | ||
|
||
export class SignedTransactionData extends DTO.AbstractSignedTransactionData | ||
implements Contracts.SignedTransactionData { | ||
public id(): string { | ||
return this.signedData.id; | ||
} | ||
|
||
public sender(): string { | ||
return Identities.Address.fromPublicKey(this.signedData.senderPublicKey); | ||
} | ||
|
||
public recipient(): string { | ||
return this.signedData.recipientId; | ||
} | ||
|
||
public amount(): BigNumber { | ||
return BigNumber.make(this.signedData.amount); | ||
} | ||
|
||
public fee(): BigNumber { | ||
return BigNumber.make(this.signedData.fee); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from "./peer"; | ||
export * from "./signed-transaction"; | ||
export * from "./transaction"; | ||
export * from "./transactions"; | ||
export * from "./wallet"; |
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,25 @@ | ||
import { Contracts, DTO, Exceptions } from "@arkecosystem/platform-sdk"; | ||
import { BigNumber } from "@arkecosystem/platform-sdk-support"; | ||
|
||
export class SignedTransactionData extends DTO.AbstractSignedTransactionData | ||
implements Contracts.SignedTransactionData { | ||
public id(): string { | ||
throw new Exceptions.NotImplemented(this.constructor.name, "id"); | ||
} | ||
|
||
public sender(): string { | ||
throw new Exceptions.NotImplemented(this.constructor.name, "sender"); | ||
} | ||
|
||
public recipient(): string { | ||
throw new Exceptions.NotImplemented(this.constructor.name, "recipient"); | ||
} | ||
|
||
public amount(): BigNumber { | ||
throw new Exceptions.NotImplemented(this.constructor.name, "amount"); | ||
} | ||
|
||
public fee(): BigNumber { | ||
throw new Exceptions.NotImplemented(this.constructor.name, "fee"); | ||
} | ||
} |
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
Oops, something went wrong.