From f32895cc2a6f680ce66d24452f8dc440cc307230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Hern=C3=A1ndez?= Date: Tue, 28 Jan 2025 13:06:14 +0000 Subject: [PATCH] chore: update nil-vm version to latest --- .nil-sdk.toml | 2 +- client-vms/src/payment/client.ts | 6 +++++- client-vms/tests/payments.test.ts | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.nil-sdk.toml b/.nil-sdk.toml index eb9f3480..3a067255 100644 --- a/.nil-sdk.toml +++ b/.nil-sdk.toml @@ -1 +1 @@ -version = "v0.9.0-rc.49" +version = "v0.9.0-rc.57" diff --git a/client-vms/src/payment/client.ts b/client-vms/src/payment/client.ts index 3cb86a53..63da7592 100644 --- a/client-vms/src/payment/client.ts +++ b/client-vms/src/payment/client.ts @@ -205,7 +205,11 @@ export class PaymentClient { amount: bigint, ): E.Effect => config.minimumAddFundsPayment > amount - ? E.fail(Error("Not enough unil amount")) + ? E.fail( + Error( + `Not enough unil amount. Minimum amount: ${config.minimumAddFundsPayment} credits`, + ), + ) : E.succeed(amount); const payload = toBinary( diff --git a/client-vms/tests/payments.test.ts b/client-vms/tests/payments.test.ts index f203cbc5..3e35c629 100644 --- a/client-vms/tests/payments.test.ts +++ b/client-vms/tests/payments.test.ts @@ -9,6 +9,7 @@ import { Env, PrivateKeyPerSuite } from "./helpers"; describe("PaymentClient", () => { let client: VmClient; + const fundAmount = BigInt(20000); beforeAll(async () => { const signer = await createSignerFromKey(PrivateKeyPerSuite.Payments); @@ -63,13 +64,13 @@ describe("PaymentClient", () => { }); it("add enough funds", async () => { - const result = await client.payer.addFunds(BigInt(10)); + const result = await client.payer.addFunds(fundAmount); expect(result).toBeNull; }); it("account is funded", async () => { const account = await client.payer.accountBalance(); - expect(account.balance).toBe(BigInt(1000)); + expect(account.balance).toBe(BigInt(2)); }); it("can pay from balance", async () => { @@ -81,6 +82,6 @@ describe("PaymentClient", () => { }); await client.payer.payForOperation(request); const account = await client.payer.accountBalance(); - expect(account.balance).toBeLessThan(BigInt(1000)); + expect(account.balance).toBeLessThan(fundAmount); }); });