import {
  afterEach,
  describe,
  globalExpect,
  init_dist,
  it
} from "../../chunk-GCCHFONX.mjs";
import {
  BlindPay,
  init_client
} from "../../chunk-ZPGWM4VJ.mjs";
import "../../chunk-IZYPRCCV.mjs";
import "../../chunk-QGNLMN6Z.mjs";
import "../../chunk-UC57SCKQ.mjs";
import "../../chunk-TBTA7A2P.mjs";
import "../../chunk-BONN6PYB.mjs";
import "../../chunk-5XJJKYXE.mjs";
import "../../chunk-RC5NN5UF.mjs";
import "../../chunk-W7NJUABI.mjs";
import "../../chunk-E7M4CJKR.mjs";
import "../../chunk-3QQCDR3E.mjs";
import "../../chunk-LRHWT4JU.mjs";
import "../../chunk-QHMIK7U3.mjs";
import "../../chunk-64EFLUS3.mjs";
import "../../chunk-B5T7AQLH.mjs";
import {
  __async,
  __commonJS
} from "../../chunk-OBKEW4AQ.mjs";

// src/resources/wallets/blockchain.test.ts
var require_blockchain_test = __commonJS({
  "src/resources/wallets/blockchain.test.ts"(exports) {
    init_dist();
    init_client();
    describe("Blockchain wallets", () => {
      afterEach(() => fetchMock.resetMocks());
      const blindpay = new BlindPay({ apiKey: "test-key", instanceId: "in_000000000000" });
      describe("Get blockchain wallet message", () => {
        it("should get blockchain wallet message", () => __async(null, null, function* () {
          const mockedMessage = { message: "random" };
          fetchMock.mockResponseOnce(JSON.stringify(mockedMessage), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.wallets.blockchain.getWalletMessage("re_000000000000");
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedMessage);
        }));
      });
      describe("List blockchain wallets", () => {
        it("should list blockchain wallets", () => __async(null, null, function* () {
          const mockedWallets = [
            {
              id: "bw_000000000000",
              name: "Wallet Display Name",
              network: "polygon",
              address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C",
              signature_tx_hash: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
              is_account_abstraction: false,
              receiver_id: "re_000000000000"
            }
          ];
          fetchMock.mockResponseOnce(JSON.stringify(mockedWallets), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.wallets.blockchain.list("re_000000000000");
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedWallets);
        }));
      });
      describe("Create blockchain wallet with address", () => {
        it("should create a blockchain wallet with address (account abstraction)", () => __async(null, null, function* () {
          const mockedWallet = {
            id: "bw_000000000000",
            name: "Wallet Display Name",
            network: "polygon",
            address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C",
            signature_tx_hash: void 0,
            is_account_abstraction: true,
            receiver_id: "re_000000000000"
          };
          fetchMock.mockResponseOnce(JSON.stringify(mockedWallet), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.wallets.blockchain.createWithAddress({
            receiver_id: "re_000000000000",
            name: "Wallet Display Name",
            network: "polygon",
            address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedWallet);
        }));
      });
      describe("Create blockchain wallet with hash", () => {
        it("should create a blockchain wallet with hash (without account abstraction)", () => __async(null, null, function* () {
          const mockedWallet = {
            id: "bw_000000000000",
            name: "Wallet Display Name",
            network: "polygon",
            address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C",
            signature_tx_hash: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
            is_account_abstraction: false,
            receiver_id: "re_000000000000"
          };
          fetchMock.mockResponseOnce(JSON.stringify(mockedWallet), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.wallets.blockchain.createWithHash({
            receiver_id: "re_000000000000",
            name: "Wallet Display Name",
            network: "polygon",
            signature_tx_hash: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedWallet);
        }));
      });
      describe("Get blockchain wallet", () => {
        it("should get a blockchain wallet", () => __async(null, null, function* () {
          const mockedWallet = {
            id: "bw_000000000000",
            name: "Wallet Display Name",
            network: "polygon",
            address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C",
            signature_tx_hash: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
            is_account_abstraction: false,
            receiver_id: "re_000000000000"
          };
          fetchMock.mockResponseOnce(JSON.stringify(mockedWallet), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.wallets.blockchain.get({
            receiver_id: "re_000000000000",
            id: "bw_000000000000"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedWallet);
        }));
      });
      describe("Delete blockchain wallet", () => {
        it("should delete a blockchain wallet", () => __async(null, null, function* () {
          fetchMock.mockResponseOnce(JSON.stringify({ data: null }), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.wallets.blockchain.delete({
            receiver_id: "re_000000000000",
            id: "bw_000000000000"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual({ data: null });
        }));
      });
    });
  }
});
export default require_blockchain_test();
