Skip to content

Commit

Permalink
Merge pull request #64 from CityOfZion/CU-86drw584r-4
Browse files Browse the repository at this point in the history
CU-86drw584r Swap Multi Invoke - Implement SwapController without routes
  • Loading branch information
raulduartep authored Jun 28, 2024
2 parents ced9fc2 + 0a73693 commit 00d69bd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/bs-neo-legacy",
"comment": "Removing react-native",
"type": "patch"
}
],
"packageName": "@cityofzion/bs-neo-legacy"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/bs-neo3",
"comment": "Removing react-native",
"type": "patch"
}
],
"packageName": "@cityofzion/bs-neo3"
}
18 changes: 2 additions & 16 deletions packages/bs-neo-legacy/src/BSNeoLegacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,8 @@ export class BSNeoLegacy<BSCustomName extends string = string>
}

async decrypt(encryptedKey: string, password: string): Promise<Account> {
let BsReactNativeDecrypt: any

try {
const { NativeModules } = require('react-native')
BsReactNativeDecrypt = NativeModules.BsReactNativeDecrypt

if (!BsReactNativeDecrypt) {
throw new Error('@CityOfZion/bs-react-native-decrypt is not installed')
}
} catch {
const key = await wallet.decrypt(encryptedKey, password)
return this.generateAccountFromKey(key)
}

const privateKey = await BsReactNativeDecrypt.decryptNeoLegacy(encryptedKey, password)
return this.generateAccountFromKey(privateKey)
const key = await wallet.decrypt(encryptedKey, password)
return this.generateAccountFromKey(key)
}

encrypt(key: string, password: string): Promise<string> {
Expand Down
3 changes: 0 additions & 3 deletions packages/bs-neo3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,5 @@
"ts-jest": "29.1.1",
"ts-node": "10.9.1",
"typescript": "4.9.5"
},
"optionalDependencies": {
"react-native": "*"
}
}
18 changes: 2 additions & 16 deletions packages/bs-neo3/src/BSNeo3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,8 @@ export class BSNeo3<BSCustomName extends string = string>
}

async decrypt(encryptedKey: string, password: string): Promise<Account> {
let BsReactNativeDecrypt: any

try {
const { NativeModules } = require('react-native')
BsReactNativeDecrypt = NativeModules.BsReactNativeDecrypt

if (!BsReactNativeDecrypt) {
throw new Error('@CityOfZion/bs-react-native-decrypt is not installed')
}
} catch {
const key = await wallet.decrypt(encryptedKey, password)
return this.generateAccountFromKey(key)
}

const privateKey = await BsReactNativeDecrypt.decryptNeo3(encryptedKey, password)
return this.generateAccountFromKey(privateKey)
const key = await wallet.decrypt(encryptedKey, password)
return this.generateAccountFromKey(key)
}

async encrypt(key: string, password: string): Promise<string> {
Expand Down

0 comments on commit 00d69bd

Please sign in to comment.