Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix types and comments #168

Merged
merged 6 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions __tests__/ain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ describe('ain-js', function() {

it('getPeerCandidateInfo', async function() {
const info = await ain.net.getPeerCandidateInfo();
expect(info).not.toBeNull();
expect(info.address).not.toBeNull();
expect(info.isAvailableForConnection).toBe(true);
expect(info.peerCandidateJsonRpcUrlList).not.toBeNull();
Expand Down
6 changes: 3 additions & 3 deletions src/ain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export default class Ain {
}

/**
* Fetches pending transaction.
* Fetches pending transactions.
* @returns {Promise<any>}
*/
getPendingTransactions(): Promise<any> {
Expand Down Expand Up @@ -240,7 +240,7 @@ export default class Ain {
* @param {number} index The transaction index in the block
* @returns {Promise<TransactionInfo>}
*/
getTransactionByBlockHashAndIndex(blockHash: string, index: Number): Promise<TransactionInfo> {
getTransactionByBlockHashAndIndex(blockHash: string, index: number): Promise<TransactionInfo> {
return this.provider.send('ain_getTransactionByBlockHashAndIndex', { block_hash: blockHash, index });
}

Expand All @@ -250,7 +250,7 @@ export default class Ain {
* @param {number} index The transaction index in the block
* @returns {Promise<TransactionInfo>}
*/
getTransactionByBlockNumberAndIndex(blockNumber: Number, index: Number): Promise<TransactionInfo> {
getTransactionByBlockNumberAndIndex(blockNumber: number, index: number): Promise<TransactionInfo> {
return this.provider.send('ain_getTransactionByBlockNumberAndIndex', { block_number: blockNumber, index });
}

Expand Down
4 changes: 2 additions & 2 deletions src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export default class Provider {

/**
* Fetches the blockchain node's address.
* @returns {Promise<number>} The address value.
* @returns {Promise<string>} The return value of the blockchain API.
*/
getAddress(): Promise<number> {
getAddress(): Promise<string> {
return this.send('ain_getAddress', {})
}

Expand Down
2 changes: 1 addition & 1 deletion src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export default class Wallet {
}

/**
* Fetches an account's timestamp value, which is the current transaction count of the account.
* Fetches an account's timestamp value, which is the timestamp of the last transaction signed by the account with nonce = -2.
* @param {object} args The ferch options.
* It may contain a string 'address' value and a string 'from' value.
* The 'address' is the address of the account to get the timestamp of,
Expand Down
Loading