Skip to content

Commit

Permalink
fix: change FEE_SCHEDULE_FILE_PART_UPLOADED to not show as an error (#…
Browse files Browse the repository at this point in the history
…2537)

* fix: change FEE_SCHEDULE_FILE_PART_UPLOADED to not show as an error

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: add integration test for fee schedule file

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor(test): add const variable for dummy text

Signed-off-by: Ivaylo Nikolov <[email protected]>

* chore: reuse finished status

Signed-off-by: Ivaylo Nikolov <[email protected]>

---------

Signed-off-by: Ivaylo Nikolov <[email protected]>
  • Loading branch information
ivaylonikolov7 authored Oct 4, 2024
1 parent 596d115 commit 2a4e21d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/transaction/TransactionReceiptQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ export default class TransactionReceiptQuery extends Query {
case Status.ReceiptNotFound:
return [status, ExecutionState.Retry];
case Status.Success:
case Status.FeeScheduleFilePartUploaded:
return [status, ExecutionState.Finished];
default:
return [
Expand Down
5 changes: 4 additions & 1 deletion src/transaction/TransactionResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ export default class TransactionResponse {
async getReceipt(client) {
const receipt = await this.getReceiptQuery().execute(client);

if (receipt.status !== Status.Success) {
if (
receipt.status !== Status.Success &&
receipt.status !== Status.FeeScheduleFilePartUploaded
) {
throw new ReceiptStatusError({
transactionReceipt: receipt,
status: receipt.status,
Expand Down
27 changes: 26 additions & 1 deletion test/integration/FileUpdateIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import {
FileInfoQuery,
Hbar,
Status,
AccountId,
PrivateKey,
} from "../../src/exports.js";
import IntegrationTestEnv from "./client/NodeIntegrationTestEnv.js";
import IntegrationTestEnv, { Client } from "./client/NodeIntegrationTestEnv.js";

describe("FileUpdate", function () {
let env;
Expand Down Expand Up @@ -94,6 +96,29 @@ describe("FileUpdate", function () {
}
});

it("should not error when FEE_SCHEDULE_FILE_PART_UPLOADED response", async function () {
this.timeout(120000);

const OPERATOR_ID = AccountId.fromString("0.0.2");
const OPERATOR_KEY = PrivateKey.fromStringED25519(
"302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137",
);
const FEES_FILE_ID = "0.0.111";
const DUMMY_TEXT = "Hello, Hedera!";

const client = Client.forLocalNode().setOperator(
OPERATOR_ID,
OPERATOR_KEY,
);

await (
await new FileUpdateTransaction()
.setFileId(FEES_FILE_ID)
.setContents(DUMMY_TEXT)
.execute(client)
).getReceipt(client);
});

after(async function () {
await env.close();
});
Expand Down

0 comments on commit 2a4e21d

Please sign in to comment.