-
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.
feat: integrate hedera family (#128)
Co-authored-by: Chelsea Sanders <csanders@candy.com>
- Loading branch information
Showing
25 changed files
with
205 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 |
---|---|---|
|
@@ -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().max(100).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.
a4912ba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wallet-api-wallet-api-tools – ./apps/wallet-api-tools
wallet-api-wallet-api-tools.vercel.app
wallet-api-wallet-api-tools-ledgerhq.vercel.app
wallet-api-wallet-api-tools-git-main-ledgerhq.vercel.app