Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
[KeyManager] Renamed Lyra to Freighter (#183)
Browse files Browse the repository at this point in the history
* Rename Lyra to Freighter

* Changelog updated
  • Loading branch information
quietbits authored Oct 30, 2020
1 parent 5ae0af7 commit f3f236d
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 34 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## In master

## [v0.3.0-rc.2]
## [v0.3.0-rc.3]

- [KeyManager] Renamed Lyra to Freighter.

## [v0.3.0-rc.2](https://github.com/stellar/js-stellar-wallets/compare/v0.3.0-rc.1...v0.3.0-rc.2)

- [KeyManager] Added optional `custom` prop to `signTransaction()` to allow
passing additional info.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar/wallet-sdk",
"version": "0.3.0-rc.2",
"version": "0.3.0-rc.3",
"description": "Libraries to help you write Stellar-enabled wallets in Javascript",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -81,7 +81,7 @@
"@albedo-link/intent": "^0.9.2",
"@ledgerhq/hw-app-str": "^4.48.0",
"@ledgerhq/hw-transport-u2f": "^4.48.0",
"@stellar/lyra-api": "^1.0.0-alpha.2",
"@stellar/freighter-api": "^1.0.0-beta.0",
"@types/jest": "^24.0.11",
"change-case": "^3.1.0",
"lodash": "^4.17.14",
Expand Down
4 changes: 2 additions & 2 deletions src/KeyManager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import StellarSdk, { Transaction } from "stellar-sdk";

import { albedoHandler } from "./keyTypeHandlers/albedo";
import { freighterHandler } from "./keyTypeHandlers/freighter";
import { ledgerHandler } from "./keyTypeHandlers/ledger";
import { lyraHandler } from "./keyTypeHandlers/lyra";
import { plaintextKeyHandler } from "./keyTypeHandlers/plaintextKey";
import { trezorHandler } from "./keyTypeHandlers/trezor";

Expand Down Expand Up @@ -92,7 +92,7 @@ export class KeyManager {
this.keyHandlerMap = {
[KeyType.albedo]: albedoHandler,
[KeyType.ledger]: ledgerHandler,
[KeyType.lyra]: lyraHandler,
[KeyType.freighter]: freighterHandler,
[KeyType.plaintextKey]: plaintextKeyHandler,
[KeyType.trezor]: trezorHandler,
};
Expand Down
2 changes: 1 addition & 1 deletion src/constants/keys.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export enum KeyType {
albedo = "albedo",
ledger = "ledger",
lyra = "lyra",
freighter = "freighter",
plaintextKey = "plaintextKey",
trezor = "trezor",
}
20 changes: 7 additions & 13 deletions src/keyTypeHandlers/lyra.ts → src/keyTypeHandlers/freighter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { signTransaction } from "@stellar/lyra-api";
import { signTransaction } from "@stellar/freighter-api";
import { Networks, Transaction, TransactionBuilder } from "stellar-sdk";

import { HandlerSignTransactionParams, KeyTypeHandler } from "../types";

import { KeyType } from "../constants/keys";

export const lyraHandler: KeyTypeHandler = {
keyType: KeyType.lyra,
export const freighterHandler: KeyTypeHandler = {
keyType: KeyType.freighter,
async signTransaction(params: HandlerSignTransactionParams) {
const { transaction, key } = params;

Expand All @@ -19,24 +19,18 @@ export const lyraHandler: KeyTypeHandler = {
}

try {
const response = await signTransaction({
transactionXdr: transaction.toXDR(),
});

if (response.error) {
throw new Error(response.error);
}
const response = await signTransaction(transaction.toXDR());

// fromXDR() returns type "Transaction | FeeBumpTransaction" and
// signTransaction() doesn't like "| FeeBumpTransaction" type, so casting
// to "Transaction" type.
return TransactionBuilder.fromXDR(
response.signedTransaction,
Networks.TESTNET,
response,
Networks.PUBLIC,
) as Transaction;
} catch (error) {
throw new Error(
`We couldn’t sign the transaction with Lyra. ${error.toString()}.`,
`We couldn’t sign the transaction with Freighter. ${error.toString()}.`,
);
}
},
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -630,10 +630,10 @@
dependencies:
regenerator-runtime "^0.13.2"

"@babel/runtime@^7.11.0":
version "7.11.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736"
integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==
"@babel/runtime@^7.11.2":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.1.tgz#b4116a6b6711d010b2dad3b7b6e43bf1b9954740"
integrity sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==
dependencies:
regenerator-runtime "^0.13.4"

Expand Down Expand Up @@ -922,10 +922,10 @@
resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz#8da5c6530915653f3a1f38fd5f101d8c3f8079c5"
integrity sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==

"@stellar/lyra-api@^1.0.0-alpha.2":
version "1.0.0-alpha.2"
resolved "https://registry.yarnpkg.com/@stellar/lyra-api/-/lyra-api-1.0.0-alpha.2.tgz#8863998dd9588c946e17449a35bba4bfd8f21092"
integrity sha512-1Y3a2KSpCL3Cg/qHJYHRe5kRA4gz8JnQedRPwwUp9q+Bd6UaTPOmgKVUMRrYRTAaLx87JtZUQObHTPc4owcJQg==
"@stellar/freighter-api@^1.0.0-beta.0":
version "1.0.0-beta.0"
resolved "https://registry.yarnpkg.com/@stellar/freighter-api/-/freighter-api-1.0.0-beta.0.tgz#08c3f4ebb4d1b8c3e92039242ca5c877814864b4"
integrity sha512-wngITwqu9h4yfgqXvJS27VEkrlPh/u6uTDOPI2Ct8pZzde3fVPYGK+42izhGAe5oOvbziZQqHkHIPh+rkl7YHg==

"@stellar/prettier-config@^1.0.1":
version "1.0.1"
Expand Down Expand Up @@ -6954,14 +6954,14 @@ tree-kill@^1.1.0:
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a"
integrity sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==

trezor-connect@^8.1.9:
version "8.1.14"
resolved "https://registry.yarnpkg.com/trezor-connect/-/trezor-connect-8.1.14.tgz#6ce7c4c7569453a7f678b3fa9e1c4b7e90c5289e"
integrity sha512-Y0yY7Mc8iN/feLct2bnJNEIbFbbMC+bCddQ7vMf22ygpcl/plNnvnze03mi6+7hEk3FmiR66gi12INSOr0wBHw==
trezor-connect@^8.1.16:
version "8.1.16"
resolved "https://registry.yarnpkg.com/trezor-connect/-/trezor-connect-8.1.16.tgz#a634b16c436311f3833aa0a6a36089c95ba4f6fd"
integrity sha512-HYSYsJk0js+OFUjO7ebsUunjYBpoUcjHI5iDBeaDoefBl0FT/Qwf6o1sd2IYVVmVCL/MtqxZ6by+/Z0/GaFBNw==
dependencies:
"@babel/runtime" "^7.11.0"
"@babel/runtime" "^7.11.2"
events "^3.2.0"
whatwg-fetch "^3.3.1"
whatwg-fetch "^3.4.1"

trim-right@^1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -7391,7 +7391,7 @@ whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3:
dependencies:
iconv-lite "0.4.24"

whatwg-fetch@^3.3.1:
whatwg-fetch@^3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.4.1.tgz#e5f871572d6879663fa5674c8f833f15a8425ab3"
integrity sha512-sofZVzE1wKwO+EYPbWfiwzaKovWiZXf4coEzjGP9b2GBVgQRLQUZ2QcuPpQExGDAW5GItpEm6Tl4OU5mywnAoQ==
Expand Down

0 comments on commit f3f236d

Please sign in to comment.