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

Commit

Permalink
WIP: move to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
SurfingNerd authored and chmanie committed Apr 15, 2020
1 parent fb5d886 commit d8ca456
Show file tree
Hide file tree
Showing 89 changed files with 8,245 additions and 3,606 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ reports
*.patch
.diff/
.patch/

# IDEA IDE
.idea

temp
10 changes: 10 additions & 0 deletions docs/migrationProtocol/change_file_extension.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

find ../../modules/node_modules/@colony/purser-core/ -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;


find purser-ledger/ -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;

find purser-software/ -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
find purser-trezor/ -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;

74 changes: 74 additions & 0 deletions docs/migrationProtocol/migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

# Migrating purser from flow-js to typescript

this is a small diary of the migration process from flow to typescript


Done with the help of this tutorial:
https://medium.com/inato/migrating-from-flow-to-typescript-why-how-worth-it-5b7703d12089


Current Strategy: Start with purser-core and then digging forward to other modules.


## typescript config changes

### dom Modules
the dom module was required for using the crypto functionality of windows
(Maybe it could be bypassed by using hashtable accessor (this['window'] instead of this.window))

### esModuleInterop flag
esModuleInterop is required for the BN.js library. see: https://github.com/CodeChain-io/codechain-primitives-js/issues/68


### Internal references

used to be `@colony/purser-core` - now they are `../purser-core`.
need to figure out how to do better.


## Known Issues

### Removed Functionality

- removed eslint for now, going to reactivate proper linting for TS later on.
- genericWallet `otherAddresses` property and in the constructor ?? added again ?! TODO: check.


## Possible Improvements

## TransactionObjectType

maybe TransactionObjectType could be replaced with the less restrictive eth-core type TransactionConfig,

´´´
export interface TransactionConfig {
from?: string | number;
to?: string;
value?: number | string | BN;
gas?: number | string;
gasPrice?: number | string | BN;
data?: string;
nonce?: number;
chainId?: number;
}
´´´

### purser-software
removed the setter purser-software keystore.

set keystore(newEncryptionPassword: string): void {
internalEncryptionPassword = newEncryptionPassword;
}

#### Private Key is passed forward as Buffer
see privateKeyBuffer, ethereum-js privateToPublic works only with buffers.

#### Private Key from Mnemonic

SoftwareWallet requires `WalletArgumentsType` as construction argument.
In the old implementation an


## Should be tested
- support for msCrypto (Edge browser)
Empty file.
153 changes: 153 additions & 0 deletions modules/node_modules/@colony/defaults.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions modules/node_modules/@colony/purser-core/defaults.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d8ca456

Please sign in to comment.