From 229ff05fe9893b415f1ea2fc5d0a8560b57afea2 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Mon, 15 Jun 2020 18:34:58 +0800 Subject: [PATCH] fix: improve send and confirm options ergonomics --- web3.js/module.d.ts | 6 +++--- web3.js/module.flow.js | 6 +++--- web3.js/src/connection.js | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/web3.js/module.d.ts b/web3.js/module.d.ts index 1ea36ca15d..4f137e5e9a 100644 --- a/web3.js/module.d.ts +++ b/web3.js/module.d.ts @@ -42,12 +42,12 @@ declare module '@solana/web3.js' { }; export type SendOptions = { - skipPreflight: boolean; + skipPreflight?: boolean; }; export type ConfirmOptions = { - confirmations: number; - skipPreflight: boolean; + confirmations?: number; + skipPreflight?: boolean; }; export type RpcResponseAndContext = { diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index f7f751eea7..6ee001fb79 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -55,12 +55,12 @@ declare module '@solana/web3.js' { }; declare export type SendOptions = { - skipPreflight: boolean, + skipPreflight: ?boolean, }; declare export type ConfirmOptions = { - confirmations: number, - skipPreflight: boolean, + confirmations: ?number, + skipPreflight: ?boolean, }; declare export type RpcResponseAndContext = { diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 474aa43a2c..e9e9262dc9 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -38,22 +38,22 @@ type Context = { * Options for sending transactions * * @typedef {Object} SendOptions - * @property {boolean} skipPreflight disable transaction verification step + * @property {boolean | undefined} skipPreflight disable transaction verification step */ export type SendOptions = { - skipPreflight: boolean, + skipPreflight: ?boolean, }; /** * Options for confirming transactions * * @typedef {Object} ConfirmOptions - * @property {boolean} skipPreflight disable transaction verification step - * @property {number} confirmations desired number of cluster confirmations + * @property {boolean | undefined} skipPreflight disable transaction verification step + * @property {number | undefined} confirmations desired number of cluster confirmations */ export type ConfirmOptions = { - confirmations: number, - skipPreflight: boolean, + skipPreflight: ?boolean, + confirmations: ?number, }; /**