import {
  afterEach,
  describe,
  globalExpect,
  init_dist,
  it
} from "../../chunk-D6N3USMR.mjs";
import {
  BlindPay,
  init_client
} from "../../chunk-VWWGGMMT.mjs";
import "../../chunk-FG25JHDX.mjs";
import "../../chunk-KMU6V4LW.mjs";
import "../../chunk-QGNLMN6Z.mjs";
import "../../chunk-ISHZTBAN.mjs";
import "../../chunk-UDRMLZWT.mjs";
import "../../chunk-LEPGLH7Q.mjs";
import "../../chunk-UC57SCKQ.mjs";
import "../../chunk-E7M4CJKR.mjs";
import "../../chunk-F5Z45GCA.mjs";
import "../../chunk-TBTA7A2P.mjs";
import "../../chunk-YIZJM2GU.mjs";
import "../../chunk-Z6EYX4D3.mjs";
import "../../chunk-ALHMJWQN.mjs";
import "../../chunk-B5T7AQLH.mjs";
import "../../chunk-RC5NN5UF.mjs";
import "../../chunk-VGU72ZNI.mjs";
import "../../chunk-LRHWT4JU.mjs";
import "../../chunk-WE73MTQL.mjs";
import "../../chunk-UOAM7SX3.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 });
        }));
      });
      describe("Create asset trustline", () => {
        it("should create asset trustline", () => __async(null, null, function* () {
          const mockedResponse = {
            xdr: "AAAAAgAAAABqVFqpZzXx+KxRjXXFGO3sKwHCEYdHsWxDRrJTLGPDowAAAGQABVECAAAAAQAAAAEAAAAAAAAAAAAAAABmWFbUAAAAAAAAAAEAAAAAAAAABgAAAAFVU0RCAAAAAABbjPEfrLNLCLjNQyaWWgTeFn4tnbFnNd9FTJ3HgkLUCwAAAAAAAAAAAAAAAAAAAAE="
          };
          fetchMock.mockResponseOnce(JSON.stringify(mockedResponse), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.wallets.blockchain.createAssetTrustline(
            "GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B"
          );
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedResponse);
        }));
      });
      describe("Mint USDB Stellar", () => {
        it("should mint usdb on stellar", () => __async(null, null, function* () {
          fetchMock.mockResponseOnce(JSON.stringify({}), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.wallets.blockchain.mintUsdbStellar({
            address: "GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B",
            amount: "1000000",
            signedXdr: "AAAAAgAAAABqVFqpZzXx+KxRjXXFGO3sKwHCEYdHsWxDRrJTLGPDowAAAGQABVECAAAAAQAAAAEAAAAAAAAAAAAAAABmWFbUAAAAAAAAAAEAAAAAAAAABgAAAAFVU0RCAAAAAABbjPEfrLNLCLjNQyaWWgTeFn4tnbFnNd9FTJ3HgkLUCwAAAAAAAAAAAAAAAAAAAAE="
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toBeDefined();
        }));
      });
      describe("Mint USDB Solana", () => {
        it("should mint usdb on solana", () => __async(null, null, function* () {
          const mockedResponse = {
            success: true,
            signature: "4wceVEQeJG4vpS4k2o1dHU5cFWeWTQU8iaCEpRaV5KkqSxPfbdAc8hzXa7nNYG6rvqgAmDkzBycbcXkKKAeK8Jtu",
            error: ""
          };
          fetchMock.mockResponseOnce(JSON.stringify(mockedResponse), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.wallets.blockchain.mintUsdbSolana({
            address: "7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5",
            amount: "1000000"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedResponse);
        }));
      });
      describe("Prepare Solana delegation transaction", () => {
        it("should prepare a solana delegation transaction", () => __async(null, null, function* () {
          const mockedResponse = {
            success: true,
            transaction: "AAGBf4K95Gp5i6f0BAEYAgABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIw=="
          };
          fetchMock.mockResponseOnce(JSON.stringify(mockedResponse), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.wallets.blockchain.prepareSolanaDelegationTransaction({
            token_address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
            amount: "1000000",
            owner_address: "7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedResponse);
        }));
      });
    });
  }
});
export default require_blockchain_test();
