From 78c79600c1a0b7fde1af689f83a0c63f94d036aa Mon Sep 17 00:00:00 2001 From: Reed Rosenbluth <331327+reedrosenbluth@users.noreply.github.com> Date: Thu, 18 Nov 2021 13:28:01 -0500 Subject: [PATCH] fix: bigint -> number --- packages/transactions/src/builders.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/transactions/src/builders.ts b/packages/transactions/src/builders.ts index f10dc3def..fb4c36f03 100644 --- a/packages/transactions/src/builders.ts +++ b/packages/transactions/src/builders.ts @@ -142,8 +142,8 @@ export async function estimateTransfer( } interface FeeEstimation { - fee: bigint, - fee_rate: bigint, + fee: number, + fee_rate: number, } interface FeeEstimateResponse { cost_scalar_change_by_byte: bigint, @@ -1353,13 +1353,17 @@ export async function sponsorTransaction( const sponsorPubKey = pubKeyfromPrivKey(options.sponsorPrivateKey); if (sponsorOptions.fee === undefined || sponsorOptions.fee === null) { - let txFee = BigInt(0); + let txFee = 0; switch (options.transaction.payload.payloadType) { case PayloadType.TokenTransfer: case PayloadType.SmartContract: case PayloadType.ContractCall: const estimatedLen = options.transaction.serialize().byteLength; - txFee = (await estimateTransaction(options.transaction.payload, estimatedLen, network))[1].fee; + try { + txFee = (await estimateTransaction(options.transaction.payload, estimatedLen, network))[1].fee; + } catch(e) { + throw e; + } break; default: throw new Error(