Skip to content

Commit

Permalink
[ls-react-native-crypto] Remove package (#422)
Browse files Browse the repository at this point in the history
* [ls-react-native-crypto] Remove package (#12567)

GitOrigin-RevId: 7c20c886ea9b96036e8fd6abb1f94a45186fd4ab

* [uma-bridge] Transaction details (#12358)

GitOrigin-RevId: 2351355e0c7e2ee3fbf8ed61f45b64466970771d

* CI update lock file for PR

* [ui] Rename arrow icons for consistency and ease finding (#12548)

GitOrigin-RevId: 09664a642a45124289664a82a3c58a3a90c07e00

* Create eighty-plums-exercise.md

* Create lovely-dodos-protect.md

---------

Co-authored-by: Corey Martin <[email protected]>
Co-authored-by: Lightspark Eng <[email protected]>
  • Loading branch information
3 people authored Sep 26, 2024
1 parent 9aac0cc commit d61a209
Show file tree
Hide file tree
Showing 55 changed files with 436 additions and 8,124 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-plums-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lightsparkdev/core": patch
---

- Changes to internal use of currency utils
5 changes: 5 additions & 0 deletions .changeset/lovely-dodos-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lightsparkdev/ui": patch
---

- Rename some icons
2 changes: 1 addition & 1 deletion apps/examples/streaming-wallet-extension/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function Header(screen: Screen, setScreen: (screen: Screen) => void) {
return (
<div className="header">
<button onClick={() => setScreen(Screen.Balance)}>
<Icon name="LeftArrow" width={16} />
<Icon name="ArrowLeft" width={16} />
</button>
<HeaderBackText>Transactions</HeaderBackText>
</div>
Expand Down
1 change: 1 addition & 0 deletions apps/examples/ui-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"devDependencies": {
"@babel/core": "^7.21.4",
"@emotion/babel-plugin": "^11.11.0",
"@emotion/jest": "^11.13.0",
"@lightsparkdev/eslint-config": "*",
"@lightsparkdev/tsconfig": "*",
"@lightsparkdev/vite": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("TextIconAligner", () => {
size: "Small",
color: "blue43",
}}
rightIcon={{ name: "RightArrow" }}
rightIcon={{ name: "ArrowRight" }}
/>
</BrowserRouter>,
);
Expand Down
17 changes: 13 additions & 4 deletions apps/examples/ui-test-app/src/tests/toReactNodes.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createSerializer } from "@emotion/jest";
import {
setDefaultReactNodesTypography,
setReactNodesTypography,
Expand All @@ -7,6 +8,14 @@ import { render } from "@testing-library/react";
import { BrowserRouter } from "react-router-dom";
import { TestAppRoutes } from "../types";

expect.addSnapshotSerializer(
createSerializer({
classNameReplacer(className, index) {
return "css-test";
},
}),
);

describe("toReactNodes", () => {
it("renders the expected output for a single string", () => {
const result = toReactNodes("test1\ntest2");
Expand Down Expand Up @@ -41,7 +50,7 @@ describe("toReactNodes", () => {
expect(asFragment()).toMatchInlineSnapshot(`
<DocumentFragment>
<a
class="css-0"
class="css-test"
href="/test-app-page-one"
>
Test
Expand Down Expand Up @@ -188,7 +197,7 @@ describe("toReactNodes", () => {
</span>
<span />
<a
class="css-0"
class="css-test"
href="/test-app-page-one"
>
Test
Expand Down Expand Up @@ -234,13 +243,13 @@ describe("toReactNodes", () => {
</span>
<span />
<a
class="css-0"
class="css-test"
href="/test-app-page-one"
>
Test
</a>
<a
class="css-0"
class="css-test"
href="/test-app-page-two"
>
Test 2
Expand Down
52 changes: 50 additions & 2 deletions packages/core/src/utils/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export type CurrencyMap = {
type: "CurrencyMap";
};

export type CurrencyAmountObj = {
export type DeprecatedCurrencyAmountObj = {
/* Technically the generated graphql schema has value as `any` but it's always a number.
* We are intentionally widening the type here to allow for more forgiving input: */
value?: number | string | null;
Expand All @@ -208,18 +208,60 @@ export type CurrencyAmountObj = {
__typename?: "CurrencyAmount" | undefined;
};

export type CurrencyAmountObj = {
/* Technically the generated graphql schema has value as `any` but it's always a number.
* We are intentionally widening the type here to allow for more forgiving input: */
original_value?: number | string | null;
/* assume satoshi if not provided */
original_unit?: CurrencyUnitType;
__typename?: "CurrencyAmount" | undefined;
};

export type CurrencyAmountPreferenceObj = {
/* Technically the generated graphql schema has value as `any` but it's always a number.
* We are intentionally widening the type here to allow for more forgiving input: */
preferred_currency_unit?: CurrencyUnitType;
/* assume satoshi if not provided */
preferred_currency_value_rounded?: number | string | null;
__typename?: "CurrencyAmount" | undefined;
};

export type CurrencyAmountArg =
| DeprecatedCurrencyAmountObj
| CurrencyAmountObj
| CurrencyAmountPreferenceObj
| SDKCurrencyAmountType
| undefined
| null;

export function isCurrencyAmountObj(arg: unknown): arg is CurrencyAmountObj {
export function isDeprecatedCurrencyAmountObj(
arg: unknown,
): arg is DeprecatedCurrencyAmountObj {
return (
typeof arg === "object" && arg !== null && "value" in arg && "unit" in arg
);
}

export function isCurrencyAmountObj(arg: unknown): arg is CurrencyAmountObj {
return (
typeof arg === "object" &&
arg !== null &&
"original_value" in arg &&
"original_unit" in arg
);
}

export function isCurrencyAmountPreferenceObj(
arg: unknown,
): arg is CurrencyAmountPreferenceObj {
return (
typeof arg === "object" &&
arg !== null &&
"preferred_currency_unit" in arg &&
"preferred_currency_value_rounded" in arg
);
}

export function isSDKCurrencyAmount(
arg: unknown,
): arg is SDKCurrencyAmountType {
Expand Down Expand Up @@ -248,7 +290,13 @@ function getCurrencyAmount(currencyAmountArg: CurrencyAmountArg) {
if (isSDKCurrencyAmount(currencyAmountArg)) {
value = currencyAmountArg.originalValue;
unit = currencyAmountArg.originalUnit;
} else if (isCurrencyAmountPreferenceObj(currencyAmountArg)) {
value = asNumber(currencyAmountArg.preferred_currency_value_rounded);
unit = currencyAmountArg.preferred_currency_unit;
} else if (isCurrencyAmountObj(currencyAmountArg)) {
value = asNumber(currencyAmountArg.original_value);
unit = currencyAmountArg.original_unit;
} else if (isDeprecatedCurrencyAmountObj(currencyAmountArg)) {
value = asNumber(currencyAmountArg.value);
unit = currencyAmountArg.unit;
}
Expand Down
35 changes: 0 additions & 35 deletions packages/ls-react-native-crypto/.eslintrc.js

This file was deleted.

8 changes: 0 additions & 8 deletions packages/ls-react-native-crypto/.expo/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions packages/ls-react-native-crypto/.expo/devices.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/ls-react-native-crypto/.npmignore

This file was deleted.

3 changes: 0 additions & 3 deletions packages/ls-react-native-crypto/.prettierrc

This file was deleted.

83 changes: 0 additions & 83 deletions packages/ls-react-native-crypto/CHANGELOG.md

This file was deleted.

15 changes: 0 additions & 15 deletions packages/ls-react-native-crypto/README.md

This file was deleted.

Loading

0 comments on commit d61a209

Please sign in to comment.