Skip to content

Commit

Permalink
refactor(wallet): Implement Rust Address Generator
Browse files Browse the repository at this point in the history
Removes nodejs-mobile dependency and related files.
Adds react-native-address-generator and implements it accordingly.
  • Loading branch information
coreyphillips committed Apr 22, 2024
1 parent 7294b44 commit b6edc7e
Show file tree
Hide file tree
Showing 28 changed files with 283 additions and 1,508 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
nodejs-assets/*
ios/*
android/*
.eslintrc.js
Expand Down
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ buck-out/
.env*
!.env*.template

# NodeJS-Mobile
/nodejs-assets/build-native-modules-MacOS-helper-script-node.sh
/nodejs-assets/build-native-modules-MacOS-helper-script-npm.sh
/nodejs-assets/nodejs-project/sample-main.js
/nodejs-assets/nodejs-project/sample-package.json
android/app/pepk.jar

# sublime
*.sublime-project
*.sublime-workspace
Expand Down
29 changes: 0 additions & 29 deletions __mocks__/nodejs-mobile-react-native/index.js

This file was deleted.

21 changes: 21 additions & 0 deletions __mocks__/react-native-address-generator/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ok } from "@synonymdev/result";

const AddressGeneratorMock = {
getAddress: jest.fn(async (mnemonic, path, network) => {
return ok({
address: 'bcrt1q6rz28mcfaxtmd6v789l9rrlrusdprr9pz3cppk',
path: path,
publicKey: '02e7ab2537b5d49e970309aae06e9e49f36ce1c9febbd44ec8e0d1cca0b4f9c319',
});
}),

getScriptHash: jest.fn(async (address, network) => {
return ok('34dad6f450d0a21a999fc2158132141d4ba4c75e510e6b2e62cda4257af71d9a');
}),

getPrivateKey: jest.fn(async (mnemonic, path, network, passphrase = '') => {
return ok('cTGhosGriPpuGA586jemcuH9pE9spwUmneMBmYYzrQEbY92DJrbo');
}),
};

module.exports = AddressGeneratorMock;
14 changes: 0 additions & 14 deletions __mocks__/rn-bridge/index.js

This file was deleted.

1 change: 0 additions & 1 deletion __tests__/reselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ describe('Reselect', () => {
let s: RootState;

beforeAll(async () => {
require('../nodejs-assets/nodejs-project/main.js');
let res = await createNewWallet();
if (res.isErr()) {
throw res.error;
Expand Down
1 change: 0 additions & 1 deletion __tests__/todos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe('Todos selector', () => {
let s: RootState;

beforeAll(async () => {
require('../nodejs-assets/nodejs-project/main.js');
let res = await createNewWallet();
if (res.isErr()) {
throw res.error;
Expand Down
278 changes: 0 additions & 278 deletions __tests__/wallet-restore.ts

This file was deleted.

Loading

0 comments on commit b6edc7e

Please sign in to comment.