Skip to content

Commit 412a206

Browse files
fix(sdk-coin-xtz): use fee if specified in reveal operation
TICKET: WIN-6256
1 parent d45a0c2 commit 412a206

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

modules/sdk-coin-xtz/src/lib/transactionBuilder.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,20 @@ export class TransactionBuilder extends BaseTransactionBuilder {
319319
}
320320

321321
/**
322-
* Build a reveal operation for the source account with default fees.
322+
* Build a reveal operation for the source account using the set fee parameters,
323+
* or default fees if not specified.
323324
*
324325
* @returns {RevealOp} A Tezos reveal operation
325326
*/
326327
private buildPublicKeyRevelationOperation(): RevealOp {
327-
const operation = revealOperation(this._counter.toString(), this._sourceAddress, this._publicKeyToReveal);
328+
const operation = revealOperation(
329+
this._counter.toString(),
330+
this._sourceAddress,
331+
this._publicKeyToReveal,
332+
this._fee?.fee,
333+
this._fee?.gasLimit,
334+
this._fee?.storageLimit
335+
);
328336
this._counter = this._counter.plus(1);
329337
return operation;
330338
}

modules/sdk-coin-xtz/test/unit/transactionBuilder.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('Tezos Transaction builder', function () {
9696
should.equal(tx.inputs.length, 1);
9797
should.equal(tx.outputs.length, 0);
9898
tx.inputs[0].address.should.equal('tz2PtJ9zgEgFVTRqy6GXsst54tH3ksEnYvvS');
99-
tx.inputs[0].value.should.equal('1420');
99+
tx.inputs[0].value.should.equal('10');
100100
should.not.exist(tx.delegate);
101101
tx.signature.length.should.equal(0);
102102
Object.keys(tx.getIndexesByTransactionType()).length.should.equal(1);
@@ -186,21 +186,21 @@ describe('Tezos Transaction builder', function () {
186186
txBuilder.sign({ key: defaultKeyPair.getKeys().prv });
187187
const tx = await txBuilder.build();
188188

189-
tx.id.should.equal('onpN4Zq664YTriyVmBbgEZAReHbucvD31XwvnpP5T9qzfhbanbx');
189+
tx.id.should.equal('oo2KFqWUTKZq6se9hjfegaMaPbXoh54ZdqMCczLMx5EFBFir61k');
190190
tx.type.should.equal(TransactionType.WalletInitialization);
191191
tx.source.should.equal('tz2PtJ9zgEgFVTRqy6GXsst54tH3ksEnYvvS');
192192
should.equal(tx.inputs.length, 2);
193193
should.equal(tx.outputs.length, 1);
194194
tx.inputs[0].address.should.equal('tz2PtJ9zgEgFVTRqy6GXsst54tH3ksEnYvvS');
195-
tx.inputs[0].value.should.equal('1420');
195+
tx.inputs[0].value.should.equal('4764');
196196
tx.inputs[1].address.should.equal('tz2PtJ9zgEgFVTRqy6GXsst54tH3ksEnYvvS');
197197
tx.inputs[1].value.should.equal('1004764');
198-
tx.outputs[0].address.should.equal('KT1Hdttpv7CBaJ8igdkhCudMHBWUqNviJCTf');
198+
tx.outputs[0].address.should.equal('KT1A9heCJqvJ3JUci8mngHd233d5vCZFp7Kn');
199199
tx.outputs[0].value.should.equal('1000000');
200200
tx.delegate.should.equal('tz1KpbK5v1NB2vg3JHBxXJZhyQ7ur83Xp7iC');
201201
tx.signature.length.should.equal(1);
202202
tx.signature[0].should.equal(
203-
'sigtJtqVf7FJVqkDPyPW878FfCnpCPNb6JJdXAxezepe4t97BwfouYJ6GMqHGSNhevu4uiLSQ2h374a4NxMnA9E9qLXa4j93'
203+
'sigvD51ih2buKJk18C67QkaWgA4gaWfzz4NwTewpbPkNvBokeXonyVER8PykorqZrjNcr1WGB1QY1wTXeGWaVtHXBg4WhGd7'
204204
);
205205
const indexesByTransactionType = tx.getIndexesByTransactionType();
206206
Object.keys(indexesByTransactionType).length.should.equal(2);

0 commit comments

Comments
 (0)