-
Notifications
You must be signed in to change notification settings - Fork 14
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
Chelsea Sanders
committed
Mar 17, 2023
1 parent
da89c62
commit c083a8c
Showing
26 changed files
with
211 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,6 @@ | ||
--- | ||
"@ledgerhq/wallet-api-core": minor | ||
"wallet-api-website": minor | ||
--- | ||
|
||
Integrate hedera family |
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 |
---|---|---|
|
@@ -39,4 +39,7 @@ lib/ | |
lib-es/ | ||
|
||
# eslint cache | ||
.eslintcache | ||
.eslintcache | ||
|
||
# ide | ||
.idea |
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 |
---|---|---|
|
@@ -14,6 +14,7 @@ export const FAMILIES = [ | |
"cosmos", | ||
"ripple", | ||
"cosmos", | ||
"hedera", | ||
"tezos", | ||
"polkadot", | ||
"stellar", | ||
|
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 { HederaTransaction, RawHederaTransaction } from "./types"; | ||
|
||
export function serializeHederaTransaction({ | ||
amount, | ||
family, | ||
memo = undefined, | ||
recipient, | ||
}: HederaTransaction): RawHederaTransaction { | ||
return { | ||
amount: amount.toString(), | ||
family, | ||
memo, | ||
recipient, | ||
}; | ||
} | ||
|
||
export function deserializeHederaTransaction({ | ||
amount, | ||
family, | ||
memo = undefined, | ||
recipient, | ||
}: RawHederaTransaction): HederaTransaction { | ||
return { | ||
amount: new BigNumber(amount), | ||
family, | ||
memo, | ||
recipient, | ||
}; | ||
} |
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 type { z } from "zod"; | ||
import type { TransactionCommon } from "../index"; | ||
import type { schemaRawHederaTransaction } from "./validation"; | ||
|
||
export interface HederaTransaction extends TransactionCommon { | ||
readonly family: RawHederaTransaction["family"]; | ||
memo?: string; | ||
} | ||
|
||
export type RawHederaTransaction = z.infer<typeof schemaRawHederaTransaction>; |
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,7 @@ | ||
import { z } from "zod"; | ||
import { schemaFamilies, schemaTransactionCommon } from "../common"; | ||
|
||
export const schemaRawHederaTransaction = schemaTransactionCommon.extend({ | ||
family: z.literal(schemaFamilies.enum.hedera), | ||
memo: 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
74 changes: 74 additions & 0 deletions
74
website/docs/reference/api/client/interfaces/HederaTransaction.md
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,74 @@ | ||
--- | ||
id: "HederaTransaction" | ||
title: "Interface: HederaTransaction" | ||
sidebar_label: "HederaTransaction" | ||
sidebar_position: 0 | ||
custom_edit_url: null | ||
--- | ||
|
||
Common fields for all cryptocurrency transactions | ||
|
||
## Hierarchy | ||
|
||
- [`TransactionCommon`](TransactionCommon.md) | ||
|
||
↳ **`HederaTransaction`** | ||
|
||
## Properties | ||
|
||
### amount | ||
|
||
• **amount**: `BigNumber` | ||
|
||
The amount of token to send in the transaction, denoted in the smallest cryptocurrency's magnitude | ||
For example in BTC, a tx with an 'amount' field of 1 will correspond to a tx corresponding to 0.00000001 BTC | ||
|
||
#### Inherited from | ||
|
||
[TransactionCommon](TransactionCommon.md).[amount](TransactionCommon.md#amount) | ||
|
||
#### Defined in | ||
|
||
packages/core/lib/families/types.d.ts:38 | ||
|
||
___ | ||
|
||
### family | ||
|
||
• `Readonly` **family**: ``"hedera"`` | ||
|
||
The family of the transaction | ||
|
||
#### Overrides | ||
|
||
[TransactionCommon](TransactionCommon.md).[family](TransactionCommon.md#family) | ||
|
||
#### Defined in | ||
|
||
packages/core/lib/families/hedera/types.d.ts:5 | ||
|
||
___ | ||
|
||
### memo | ||
|
||
• `Optional` **memo**: `string` | ||
|
||
#### Defined in | ||
|
||
packages/core/lib/families/hedera/types.d.ts:6 | ||
|
||
___ | ||
|
||
### recipient | ||
|
||
• **recipient**: `string` | ||
|
||
The address of the transaction's recipient | ||
|
||
#### Inherited from | ||
|
||
[TransactionCommon](TransactionCommon.md).[recipient](TransactionCommon.md#recipient) | ||
|
||
#### Defined in | ||
|
||
packages/core/lib/families/types.d.ts:42 |
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
Oops, something went wrong.