Skip to content

Commit 4ae6089

Browse files
committed
fix lint and user docs
1 parent b5afa1b commit 4ae6089

File tree

4 files changed

+32
-18
lines changed

4 files changed

+32
-18
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,29 @@ If you just want to find out a name from the registry you can just do this:
9090
```js
9191
const accountAddress = await convex.resolveAccountName('my-account')
9292
```
93+
94+
## Building and testing this library
95+
96+
To build and test this library. First you need to clone the repositry
97+
98+
```
99+
git clone https://github.com/Convex-Dev/convex-api-js.git
100+
```
101+
102+
Then you need to install the node.js dependent packages to run with this library:
103+
104+
```
105+
npm install
106+
```
107+
108+
Now you can run the test suite, by typing the following command:
109+
110+
```
111+
npm run test
112+
```
113+
114+
After editing any of the source code, you run the lint analyzer to make sure your code is complient:
115+
116+
```
117+
npm run lint
118+
```

src/API.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class API {
6060
}
6161

6262
public static create(url: string, language?: Language): API {
63-
return new API(url, language);
63+
return new API(url, language)
6464
}
6565

6666
/**
@@ -86,7 +86,6 @@ export class API {
8686
*
8787
*/
8888
public async createAccount(keyPair: KeyPair): Promise<Account> {
89-
9089
const queryURL = urljoin(this.url, '/api/v1/createAccount')
9190
const data = {
9291
accountKey: keyPair.publicKeyAPI,
@@ -433,11 +432,7 @@ export class API {
433432
* ```
434433
*
435434
*/
436-
public async transfer(
437-
toAddressAccount: BigInt | Account,
438-
amount: BigInt | number,
439-
fromAccount: Account
440-
): Promise<BigInt> {
435+
public async transfer(toAddressAccount: BigInt | Account, amount: BigInt | number, fromAccount: Account): Promise<BigInt> {
441436
let toAddress
442437
if (Object.prototype.toString.call(toAddressAccount) === '[object BigInt]') {
443438
toAddress = toAddressAccount

src/Account.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class Account {
2323
* @returns a new Account Object
2424
*/
2525
public static create(keyPair: KeyPair, address?: BigInt, name?: string): Account {
26-
return new Account(keyPair, address, name);
26+
return new Account(keyPair, address, name)
2727
}
2828

2929
/**
@@ -35,6 +35,6 @@ export class Account {
3535
*
3636
*/
3737
public sign(text: string): string {
38-
return this.keyPair.sign(text);
38+
return this.keyPair.sign(text)
3939
}
4040
}

src/KeyPair.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ export class KeyPair {
6363
* @returns an KeyPair object with the private and public key pairs.
6464
*
6565
*/
66-
public static importFromString(
67-
text: string,
68-
password: string,
69-
publicKeyText?: string
70-
): KeyPair {
66+
public static importFromString(text: string, password: string, publicKeyText?: string): KeyPair {
7167
const privateKey = createPrivateKey({
7268
key: text,
7369
type: 'pkcs8',
@@ -93,10 +89,7 @@ export class KeyPair {
9389
* @returns An KeyPair object with the private and public keys.
9490
*
9591
*/
96-
public static async importFromFile(
97-
filename: string,
98-
password: string,
99-
): Promise<KeyPair> {
92+
public static async importFromFile(filename: string, password: string): Promise<KeyPair> {
10093
if (fs.existsSync(filename)) {
10194
const data = await fs.promises.readFile(filename)
10295
return KeyPair.importFromString(data.toString(), password)

0 commit comments

Comments
 (0)