-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
157 additions
and
54 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 support for coin aptos |
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 { AptosTransaction, RawAptosTransaction } from "./types"; | ||
|
||
export const serializeAptosTransaction = ({ | ||
family, | ||
mode, | ||
fees, | ||
amount, | ||
recipient, | ||
}: AptosTransaction): RawAptosTransaction => ({ | ||
family, | ||
amount: amount.toString(), | ||
recipient, | ||
fees: fees ? fees.toString() : undefined, | ||
mode, | ||
}); | ||
|
||
export const deserializeAptosTransaction = ({ | ||
family, | ||
mode, | ||
fees, | ||
amount, | ||
recipient, | ||
}: RawAptosTransaction): AptosTransaction => ({ | ||
family, | ||
amount: new BigNumber(amount), | ||
recipient, | ||
fees: fees ? new BigNumber(fees) : undefined, | ||
mode, | ||
}); |
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 @@ | ||
import type BigNumber from "bignumber.js"; | ||
import type { z } from "zod"; | ||
import type { TransactionCommon } from "../index"; | ||
import type { | ||
schemaAptosOperationMode, | ||
schemaRawAptosTransaction, | ||
} from "./validation"; | ||
|
||
export type AptosOperationMode = z.infer<typeof schemaAptosOperationMode>; | ||
|
||
export type AptosTransaction = TransactionCommon & { | ||
readonly family: RawAptosTransaction["family"]; | ||
mode: AptosOperationMode; | ||
fees?: BigNumber; | ||
}; | ||
|
||
export type RawAptosTransaction = z.infer<typeof schemaRawAptosTransaction>; |
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,10 @@ | ||
import { z } from "zod"; | ||
import { schemaFamilies, schemaTransactionCommon } from "../common"; | ||
|
||
export const schemaAptosOperationMode = z.enum(["send"]); | ||
|
||
export const schemaRawAptosTransaction = schemaTransactionCommon.extend({ | ||
family: z.literal(schemaFamilies.enum.aptos), | ||
mode: schemaAptosOperationMode, | ||
fees: z.string().optional(), | ||
}); |
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