Skip to content

Commit

Permalink
fix: bigint -> number
Browse files Browse the repository at this point in the history
  • Loading branch information
reedrosenbluth committed Nov 18, 2021
1 parent 647833a commit 78c7960
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/transactions/src/builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 78c7960

Please sign in to comment.