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

Miscellaneous TypeScript fixes #331

Merged
merged 5 commits into from
Apr 1, 2021
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
2 changes: 1 addition & 1 deletion src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default class HTTPClient {
constructor(
tokenHeader: TokenHeader,
baseServer: string,
port?: number,
port?: string | number,
private defaultHeaders: Record<string, any> = {}
) {
// Do not need colon if port is empty
Expand Down
2 changes: 1 addition & 1 deletion src/client/kmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class Kmd extends ServiceClient {
constructor(
token: string | KMDTokenHeader | CustomTokenHeader,
baseServer = 'http://127.0.0.1',
port = 7833,
port: string | number = 7833,
headers = {}
) {
super('X-KMD-API-Token', token, baseServer, port, headers);
Expand Down
2 changes: 1 addition & 1 deletion src/client/v2/algod/algod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class AlgodClient extends ServiceClient {
constructor(
token: string | AlgodTokenHeader | CustomTokenHeader,
baseServer = 'http://r2.algorand.network',
port = 4180,
port: string | number = 4180,
headers = {}
) {
super('X-Algo-API-Token', token, baseServer, port, headers);
Expand Down
2 changes: 1 addition & 1 deletion src/client/v2/indexer/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class IndexerClient extends ServiceClient {
constructor(
token: string | IndexerTokenHeader | CustomTokenHeader,
baseServer = 'http://127.0.0.1',
port = 8080,
port: string | number = 8080,
headers = {}
) {
super('X-Indexer-API-Token', token, baseServer, port, headers);
Expand Down
2 changes: 1 addition & 1 deletion src/client/v2/serviceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default abstract class ServiceClient {
tokenHeaderIdentifier: TokenHeaderIdentifier,
tokenHeaderOrStr: string | TokenHeader,
baseServer: string,
port?: number,
port?: string | number,
defaultHeaders: Record<string, any> = {}
) {
// Accept token header as string or object
Expand Down
4 changes: 2 additions & 2 deletions src/makeTxn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export function makeAssetCreateTxnWithSuggestedParams(
unitName: AssetCreateTxn['assetUnitName'],
assetName: AssetCreateTxn['assetName'],
assetURL: AssetCreateTxn['assetURL'],
assetMetadataHash: AssetCreateTxn['assetMetadataHash'],
assetMetadataHash: AssetCreateTxn['assetMetadataHash'] | undefined,
suggestedParams: MustHaveSuggestedParams<AssetCreateTxn>['suggestedParams'],
rekeyTo?: AssetCreateTxn['reKeyTo']
) {
Expand Down Expand Up @@ -386,7 +386,7 @@ export function makeAssetCreateTxn(
unitName: AssetCreateTxn['assetUnitName'],
assetName: AssetCreateTxn['assetName'],
assetURL: AssetCreateTxn['assetURL'],
assetMetadataHash: AssetCreateTxn['assetMetadataHash'],
assetMetadataHash?: AssetCreateTxn['assetMetadataHash'],
rekeyTo?: AssetCreateTxn['reKeyTo']
) {
const suggestedParams: SuggestedParams = {
Expand Down
12 changes: 6 additions & 6 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ interface TransactionStorageStructure
from: string | Address;
to: string | Address;
fee: number;
amount: number;
amount: number | bigint;
firstRound: number;
lastRound: number;
note?: Uint8Array;
Expand All @@ -70,7 +70,7 @@ interface TransactionStorageStructure
voteLast: number;
voteKeyDilution: number;
assetIndex: number;
assetTotal: number;
assetTotal: number | bigint;
assetDecimals: number;
assetDefaultFrozen: boolean;
assetManager: string | Address;
Expand All @@ -80,7 +80,7 @@ interface TransactionStorageStructure
assetUnitName: string;
assetName: string;
assetURL: string;
assetMetadataHash: string | Uint8Array;
assetMetadataHash?: string | Uint8Array;
freezeAccount: string | Address;
freezeState: boolean;
assetRevocationTarget?: string | Address;
Expand Down Expand Up @@ -114,7 +114,7 @@ export class Transaction implements TransactionStorageStructure {
from: Address;
to: Address;
fee: number;
amount: number;
amount: number | bigint;
firstRound: number;
lastRound: number;
note?: Uint8Array;
Expand All @@ -128,7 +128,7 @@ export class Transaction implements TransactionStorageStructure {
voteLast: number;
voteKeyDilution: number;
assetIndex: number;
assetTotal: number;
assetTotal: number | bigint;
assetDecimals: number;
assetDefaultFrozen: boolean;
assetManager: Address;
Expand All @@ -138,7 +138,7 @@ export class Transaction implements TransactionStorageStructure {
assetUnitName: string;
assetName: string;
assetURL: string;
assetMetadataHash: Uint8Array;
assetMetadataHash?: Uint8Array;
freezeAccount: Address;
freezeState: boolean;
assetRevocationTarget?: Address;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/types/transactions/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export interface TransactionParams {
/**
* Integer amount to send
*/
amount: number;
amount: number | bigint;

/**
* Integer first protocol round on which this txn is valid
Expand Down Expand Up @@ -211,7 +211,7 @@ export interface TransactionParams {
/**
* Total supply of the asset
*/
assetTotal: number;
assetTotal: number | bigint;

/**
* Integer number of decimals for asset unit calcuation
Expand Down Expand Up @@ -260,7 +260,7 @@ export interface TransactionParams {
/**
* Uint8Array or UTF-8 string representation of a hash commitment with respect to the asset. Must be exactly 32 bytes long.
*/
assetMetadataHash: Uint8Array | string;
assetMetadataHash?: Uint8Array | string;

/**
* String representation of Algorand address being frozen or unfrozen
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/types/transactions/encoded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface EncodedAssetParams {
/**
* assetTotal
*/
t: number;
t: number | bigint;

/**
* assetDefaultFrozen
Expand Down Expand Up @@ -140,12 +140,12 @@ export interface EncodedTransaction {
/**
* amount
*/
amt?: number;
amt?: number | bigint;

/**
* amount (but for asset transfers)
*/
aamt?: number;
aamt?: number | bigint;

/**
* closeRemainderTo
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.