-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PKG -- [root] Fix type declaration generation
- Loading branch information
Showing
57 changed files
with
603 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig", | ||
// Change this to match your project | ||
"exclude": [ | ||
"src/**/*.test.js", | ||
], | ||
"include": ["src/**/*"], | ||
"compilerOptions": { | ||
// Tells TypeScript to read JS files, as | ||
// normally they are ignored as source files | ||
"allowJs": true, | ||
// Generate d.ts files | ||
"declaration": true, | ||
// This compiler run should | ||
// only output d.ts files | ||
"emitDeclarationOnly": true, | ||
// Types should go into this directory. | ||
// Removing this would place the .d.ts files | ||
// next to the .js files | ||
"outDir": "types", | ||
// go to js file when using IDE functions like | ||
// "Go to Definition" in VSCode | ||
"declarationMap": false, | ||
"typeRoots": [ | ||
"../config/config", | ||
"../sdk/sdk", | ||
"../util-address/types", | ||
"../util-encode-key/types" | ||
] | ||
"declarationDir": "types", | ||
"rootDir": "src" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/// <reference types="node" /> | ||
import { Buffer } from "buffer"; | ||
export { Buffer }; | ||
type EncodeInput = Buffer | string | number | Uint8Array | null | undefined | EncodeInput[]; | ||
/** | ||
* Built on top of rlp library, removing the BN dependency for the flow. | ||
* Package : https://github.com/ethereumjs/rlp | ||
* RLP License : https://github.com/ethereumjs/rlp/blob/master/LICENSE | ||
* | ||
* ethereumjs/rlp is licensed under the | ||
* Mozilla Public License 2.0 | ||
* Permissions of this weak copyleft license are conditioned on making available source code of licensed files and modifications of those files under the same license (or in certain cases, one of the GNU licenses). Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work may be distributed under different terms and without source code for files added in the larger work. | ||
*/ | ||
/** | ||
* @param input - will be converted to buffer | ||
* @returns returns buffer of encoded data | ||
*/ | ||
export declare function encode(input: EncodeInput): Buffer; | ||
/** | ||
* Built on top of rlp library, removing the BN dependency for the flow. | ||
* Package : https://github.com/ethereumjs/rlp | ||
* RLP License : https://github.com/ethereumjs/rlp/blob/master/LICENSE | ||
* | ||
* ethereumjs/rlp is licensed under the | ||
* Mozilla Public License 2.0 | ||
* Permissions of this weak copyleft license are conditioned on making available source code of licensed files and modifications of those files under the same license (or in certain cases, one of the GNU licenses). Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work may be distributed under different terms and without source code for files added in the larger work. | ||
*/ | ||
/** | ||
* @param input - will be converted to buffer | ||
* @param stream Is the input a stream (false by default) | ||
* @returns returns buffer of encoded data | ||
*/ | ||
export declare function decode(input: Buffer | Uint8Array, stream?: boolean): Buffer; | ||
/** | ||
* Get the length of the RLP input | ||
* @param input | ||
* @returns The length of the input or an empty Buffer if no input | ||
*/ | ||
export declare function getLength(input: Buffer | Uint8Array | null | undefined | string | number): number; | ||
/** Transform anything into a Buffer */ | ||
export declare function toBuffer(v: Buffer | string | number | Uint8Array | null | undefined): Buffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare function connectSubscribeEvents(ix: any, context?: any, opts?: any): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { StreamConnection } from "@onflow/typedefs"; | ||
export declare class WebsocketError extends Error { | ||
code?: number; | ||
reason?: string; | ||
wasClean?: boolean; | ||
constructor({ code, reason, message, wasClean, }: { | ||
code?: number; | ||
reason?: string; | ||
message?: string; | ||
wasClean?: boolean; | ||
}); | ||
} | ||
type WebSocketConnection<T> = StreamConnection<{ | ||
data: T; | ||
}>; | ||
export declare function connectWs<T>({ hostname, path, params, getParams, retryLimit, retryIntervalMs, }: { | ||
hostname: string; | ||
path: string; | ||
params?: Record<string, string>; | ||
getParams?: () => Record<string, string> | undefined; | ||
retryLimit?: number; | ||
retryIntervalMs?: number; | ||
}): WebSocketConnection<T>; | ||
export declare function buildConnectionUrl(hostname: string, path?: string, params?: Record<string, string | number | string[] | number[] | null | undefined>): string; | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Creates an HTTP Request to be sent to a REST Access API via Fetch API. | ||
* | ||
* @param {object} options - Options for the HTTP Request | ||
* @param {String} options.hostname - Access API Hostname | ||
* @param {String} options.path - Path to the resource on the Access API | ||
* @param {String} options.method - HTTP Method | ||
* @param {object} options.body - HTTP Request Body | ||
* @param {object} [options.headers] - HTTP Request Headers | ||
* @param {boolean} [options.enableRequestLogging=true] - Enable/Disable request logging | ||
* @param {number} [options.retryLimit=5] - Number of times to retry request | ||
* @param {number} [options.retryIntervalMs=1000] - Time in milliseconds to wait before retrying request | ||
* @param {number} [options.timeoutLimit=30000] - Time in milliseconds to wait before timing out request | ||
* | ||
* @returns JSON object response from Access API. | ||
*/ | ||
export function httpRequest({ hostname, path, method, body, headers, retryLimit, retryIntervalMs, timeoutLimit, enableRequestLogging, }: { | ||
hostname: string; | ||
path: string; | ||
method: string; | ||
body: object; | ||
headers?: object | undefined; | ||
enableRequestLogging?: boolean | undefined; | ||
retryLimit?: number | undefined; | ||
retryIntervalMs?: number | undefined; | ||
timeoutLimit?: number | undefined; | ||
}): Promise<any>; | ||
export class HTTPRequestError extends Error { | ||
constructor({ error, hostname, path, method, requestBody, responseBody, responseStatusText, statusCode, }: { | ||
error: any; | ||
hostname: any; | ||
path: any; | ||
method: any; | ||
requestBody: any; | ||
responseBody: any; | ||
responseStatusText: any; | ||
statusCode: any; | ||
}); | ||
statusCode: any; | ||
errorMessage: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export { sendExecuteScript } from "./send-execute-script"; | ||
export { sendGetAccount } from "./send-get-account"; | ||
export { sendGetBlockHeader } from "./send-get-block-header"; | ||
export { sendGetBlock } from "./send-get-block"; | ||
export { sendGetCollection } from "./send-get-collection"; | ||
export { sendGetEvents } from "./send-get-events"; | ||
export { sendGetTransaction } from "./send-get-transaction"; | ||
export { sendGetTransactionStatus } from "./send-get-transaction-status"; | ||
export { sendPing } from "./send-ping"; | ||
export { sendTransaction } from "./send-transaction"; | ||
export { sendGetNetworkParameters } from "./send-get-network-parameters"; | ||
export { connectSubscribeEvents } from "./connect-subscribe-events"; | ||
export { send } from "./send-http"; | ||
export { WebsocketError } from "./connect-ws"; | ||
export { HTTPRequestError } from "./http-request.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendExecuteScript(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendGetAccount(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendGetBlockHeader(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendGetBlock(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendGetCollection(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendGetEvents(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendGetNetworkParameters(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendGetTransactionStatus(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendGetTransaction(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function send(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendPing(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function sendTransaction(ix: any, context?: {}, opts?: {}): Promise<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function safeParseJSON(data: any): any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare const WebSocket: new (url: string | URL, protocols?: string | string[] | undefined) => WebSocket; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.