chore: migrate to typescript
This commit is contained in:
committed by
Justin Starry
parent
3eb9f7b3eb
commit
f912c63b22
@@ -1,8 +1,3 @@
|
||||
//@flow
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const endpoint = {
|
||||
http: {
|
||||
devnet: 'http://devnet.solana.com',
|
@@ -1,15 +1,13 @@
|
||||
// @flow
|
||||
|
||||
export function promiseTimeout<T>(
|
||||
promise: Promise<T>,
|
||||
timeoutMs: number,
|
||||
): Promise<T | null> {
|
||||
let timeoutId: TimeoutID;
|
||||
const timeoutPromise = new Promise(resolve => {
|
||||
let timeoutId: ReturnType<typeof setTimeout>;
|
||||
const timeoutPromise: Promise<null> = new Promise(resolve => {
|
||||
timeoutId = setTimeout(() => resolve(null), timeoutMs);
|
||||
});
|
||||
|
||||
return Promise.race([promise, timeoutPromise]).then(result => {
|
||||
return Promise.race([promise, timeoutPromise]).then((result: T | null) => {
|
||||
clearTimeout(timeoutId);
|
||||
return result;
|
||||
});
|
@@ -1,5 +1,3 @@
|
||||
// @flow
|
||||
|
||||
import {Connection} from '../connection';
|
||||
import type {TransactionSignature} from '../transaction';
|
||||
import type {ConfirmOptions} from '../connection';
|
@@ -1,5 +1,3 @@
|
||||
// @flow
|
||||
|
||||
import {Connection} from '../connection';
|
||||
import {Transaction} from '../transaction';
|
||||
import type {Account} from '../account';
|
@@ -1,10 +1,8 @@
|
||||
// @flow
|
||||
|
||||
export function decodeLength(bytes: Array<number>): number {
|
||||
let len = 0;
|
||||
let size = 0;
|
||||
for (;;) {
|
||||
let elem = bytes.shift();
|
||||
let elem = bytes.shift() as number;
|
||||
len |= (elem & 0x7f) << (size * 7);
|
||||
size += 1;
|
||||
if ((elem & 0x80) === 0) {
|
@@ -1,5 +1,3 @@
|
||||
// @flow
|
||||
|
||||
// zzz
|
||||
export function sleep(ms: number): Promise<void> {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
@@ -1,5 +1,3 @@
|
||||
// @flow
|
||||
|
||||
import {Buffer} from 'buffer';
|
||||
|
||||
export const toBuffer = (arr: Buffer | Uint8Array | Array<number>): Buffer => {
|
Reference in New Issue
Block a user