Skip to content

Commit 37da7f1

Browse files
committed
fix(sdk-coin-avaxp): set flat fee for staking tx
Ticket: CR-1207
1 parent 4fa5e81 commit 37da7f1

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

modules/sdk-coin-avaxp/src/avaxp.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
ParseTransactionOptions,
99
BaseTransaction,
1010
InvalidTransactionError,
11-
FeeEstimateOptions,
1211
SigningError,
1312
TransactionType,
1413
InvalidAddressError,
@@ -19,7 +18,6 @@ import {
1918
import * as AvaxpLib from './lib';
2019
import {
2120
AvaxpSignTransactionOptions,
22-
TransactionFee,
2321
ExplainTransactionOptions,
2422
AvaxpVerifyTransactionOptions,
2523
AvaxpTransactionStakingOptions,
@@ -318,11 +316,6 @@ export class AvaxP extends BaseCoin {
318316
: { halfSigned: { txHex: transaction.toBroadcastFormat() } };
319317
}
320318

321-
async feeEstimate(params: FeeEstimateOptions): Promise<TransactionFee> {
322-
// staking transactions are fee-less
323-
return { fee: '0' };
324-
}
325-
326319
async parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction> {
327320
return {};
328321
}

modules/sdk-coin-avaxp/src/lib/permissionlessValidatorTxBuilder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export class PermissionlessValidatorTxBuilder extends TransactionBuilder {
5454
*/
5555
constructor(coinConfig: Readonly<CoinConfig>) {
5656
super(coinConfig);
57+
this.transaction._fee.fee = this.transaction._network.txFee;
5758
}
5859

5960
/**

modules/sdk-coin-avaxp/test/unit/lib/permissionlessValidatorTxBuilder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ describe('AvaxP permissionlessValidatorTxBuilder', () => {
185185
txExplain.inputs[0].id.should.equal('WyjYJHa7Ye1KMsBZiQ8hQJzY7YYxTJTTyMkxcVrKRDiNytTY8:0');
186186
txExplain.inputs[1].id.should.equal('WyjYJHa7Ye1KMsBZiQ8hQJzY7YYxTJTTyMkxcVrKRDiNytTY8:1');
187187
txExplain.inputs[2].id.should.equal('s92SjoZQemgG97HocX9GgyFy6ZKmapgcgqQ3y5J2uwP3qWBUy:0');
188+
txExplain.fee.fee.should.equal('1000000');
188189
assert(txJson.outputs[0].value === testData.BUILD_AND_SIGN_ADD_PERMISSIONLESS_VALIDATOR_SAMPLE.stakeAmount);
189190
tx.type.should.equal(TransactionType.AddPermissionlessValidator);
190191
console.log(tx.toBroadcastFormat());

0 commit comments

Comments
 (0)