Skip to content

Commit

Permalink
chore: update nil-vm version to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
pablojhl committed Jan 28, 2025
1 parent e8f6e35 commit f32895c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .nil-sdk.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "v0.9.0-rc.49"
version = "v0.9.0-rc.57"
6 changes: 5 additions & 1 deletion client-vms/src/payment/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ export class PaymentClient {
amount: bigint,
): E.Effect<bigint, Error> =>
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(
Expand Down
7 changes: 4 additions & 3 deletions client-vms/tests/payments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 () => {
Expand All @@ -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);
});
});

0 comments on commit f32895c

Please sign in to comment.