-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stéphane Prohaszka <[email protected]>
- Loading branch information
1 parent
996c943
commit d7910f0
Showing
10 changed files
with
98 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ledgerhq/wallet-api-core": minor | ||
--- | ||
|
||
Add TON support |
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,30 @@ | ||
import BigNumber from "bignumber.js"; | ||
import type { RawTonTransaction, TonTransaction } from "./types"; | ||
|
||
export const serializeTonTransaction = ({ | ||
amount, | ||
recipient, | ||
family, | ||
fees, | ||
comment, | ||
}: TonTransaction): RawTonTransaction => ({ | ||
amount: amount.toString(), | ||
recipient, | ||
family, | ||
fees: fees.toString(), | ||
comment, | ||
}); | ||
|
||
export const deserializeTonTransaction = ({ | ||
amount, | ||
recipient, | ||
family, | ||
fees, | ||
comment, | ||
}: RawTonTransaction): TonTransaction => ({ | ||
amount: new BigNumber(amount), | ||
recipient, | ||
family, | ||
fees: new BigNumber(fees), | ||
comment, | ||
}); |
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 BigNumber from "bignumber.js"; | ||
import type { z } from "zod"; | ||
import type { TransactionCommon } from "../index"; | ||
import type { schemaTonComment, schemaRawTonTransaction } from "./validation"; | ||
|
||
export type TonComment = z.infer<typeof schemaTonComment>; | ||
|
||
export type TonTransaction = TransactionCommon & { | ||
readonly family: RawTonTransaction["family"]; | ||
fees: BigNumber; | ||
comment: TonComment; | ||
}; | ||
|
||
export type RawTonTransaction = z.infer<typeof schemaRawTonTransaction>; |
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,13 @@ | ||
import { z } from "zod"; | ||
import { schemaFamilies, schemaTransactionCommon } from "../common"; | ||
|
||
export const schemaTonComment = z.object({ | ||
isEncrypted: z.boolean(), | ||
text: z.string(), | ||
}); | ||
|
||
export const schemaRawTonTransaction = schemaTransactionCommon.extend({ | ||
family: z.literal(schemaFamilies.enum.ton), | ||
fees: z.string(), | ||
comment: schemaTonComment, | ||
}); |
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