"use strict";
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __async = (__this, __arguments, generator) => {
  return new Promise((resolve, reject) => {
    var fulfilled = (value) => {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    };
    var rejected = (value) => {
      try {
        step(generator.throw(value));
      } catch (e) {
        reject(e);
      }
    };
    var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
    step((generator = generator.apply(__this, __arguments)).next());
  });
};

// src/index.ts
var index_exports = {};
__export(index_exports, {
  BlindPay: () => BlindPay,
  createApiKeysResource: () => createApiKeysResource,
  createAvailableResource: () => createAvailableResource,
  createBankAccountsResource: () => createBankAccountsResource,
  createBlockchainWalletsResource: () => createBlockchainWalletsResource,
  createCustodialWalletsResource: () => createCustodialWalletsResource,
  createFeesResource: () => createFeesResource,
  createInstancesResource: () => createInstancesResource,
  createOfframpWalletsResource: () => createOfframpWalletsResource,
  createPartnerFeesResource: () => createPartnerFeesResource,
  createPayinQuotesResource: () => createPayinQuotesResource,
  createPayinsResource: () => createPayinsResource,
  createPayoutsResource: () => createPayoutsResource,
  createQuotesResource: () => createQuotesResource,
  createReceiversResource: () => createReceiversResource,
  createTransfersResource: () => createTransfersResource,
  createUploadResource: () => createUploadResource,
  createVirtualAccountsResource: () => createVirtualAccountsResource,
  createWebhookEndpointsResource: () => createWebhookEndpointsResource
});
module.exports = __toCommonJS(index_exports);

// src/client.ts
var import_svix = require("svix");

// package.json
var version = "3.4.1";

// src/internal/blindpay-error.ts
var BlindPayError = class extends Error {
  constructor(message) {
    super(message);
    this.name = "BlindpayError";
  }
};

// src/resources/api-keys/index.ts
function createApiKeysResource(instanceId, client) {
  return {
    list() {
      return client.get(`/instances/${instanceId}/api-keys`);
    },
    create(_a) {
      var data = __objRest(_a, []);
      return client.post(`/instances/${instanceId}/api-keys`, data);
    },
    get(id) {
      return client.get(`/instances/${instanceId}/api-keys/${id}`);
    },
    delete(id) {
      return client.delete(`/instances/${instanceId}/api-keys/${id}`);
    }
  };
}

// src/resources/available/index.ts
function createAvailableResource(client) {
  return {
    getBankDetails(rail) {
      return client.get(`/available/bank-details?rail=${rail}`);
    },
    getRails() {
      return client.get("/available/rails");
    },
    getNaicsCodes() {
      return client.get("/available/naics");
    },
    getSwiftCodeBankDetails(swift) {
      return client.get(`/available/swift/${swift}`);
    }
  };
}

// src/resources/bank-accounts/index.ts
function createBankAccountsResource(instanceId, client) {
  return {
    list(_a) {
      var _b = _a, {
        receiver_id
      } = _b, params = __objRest(_b, [
        "receiver_id"
      ]);
      const queryParams = Object.keys(params).length ? `?${new URLSearchParams(params)}` : "";
      return client.get(
        `/instances/${instanceId}/receivers/${receiver_id}/bank-accounts${queryParams}`
      );
    },
    get({
      receiver_id,
      id
    }) {
      return client.get(
        `/instances/${instanceId}/receivers/${receiver_id}/bank-accounts/${id}`
      );
    },
    delete({ receiver_id, id }) {
      return client.delete(
        `/instances/${instanceId}/receivers/${receiver_id}/bank-accounts/${id}`
      );
    },
    createPix(_c) {
      var _d = _c, {
        receiver_id
      } = _d, data = __objRest(_d, [
        "receiver_id"
      ]);
      return client.post(`/instances/${instanceId}/receivers/${receiver_id}/bank-accounts`, __spreadValues({
        type: "pix"
      }, data));
    },
    createPixSafe(_e) {
      var _f = _e, {
        receiver_id
      } = _f, data = __objRest(_f, [
        "receiver_id"
      ]);
      return client.post(`/instances/${instanceId}/receivers/${receiver_id}/bank-accounts`, __spreadValues({
        type: "pix_safe"
      }, data));
    },
    createArgentinaTransfers(_g) {
      var _h = _g, {
        receiver_id
      } = _h, data = __objRest(_h, [
        "receiver_id"
      ]);
      return client.post(`/instances/${instanceId}/receivers/${receiver_id}/bank-accounts`, __spreadValues({
        type: "transfers_bitso"
      }, data));
    },
    createSpei(_i) {
      var _j = _i, {
        receiver_id
      } = _j, data = __objRest(_j, [
        "receiver_id"
      ]);
      return client.post(`/instances/${instanceId}/receivers/${receiver_id}/bank-accounts`, __spreadValues({
        type: "spei_bitso"
      }, data));
    },
    createColombiaAch(_k) {
      var _l = _k, {
        receiver_id
      } = _l, data = __objRest(_l, [
        "receiver_id"
      ]);
      return client.post(`/instances/${instanceId}/receivers/${receiver_id}/bank-accounts`, __spreadValues({
        type: "ach_cop_bitso"
      }, data));
    },
    createAch(_m) {
      var _n = _m, {
        receiver_id
      } = _n, data = __objRest(_n, [
        "receiver_id"
      ]);
      return client.post(`/instances/${instanceId}/receivers/${receiver_id}/bank-accounts`, __spreadValues({
        type: "ach"
      }, data));
    },
    createWire(_o) {
      var _p = _o, {
        receiver_id
      } = _p, data = __objRest(_p, [
        "receiver_id"
      ]);
      return client.post(`/instances/${instanceId}/receivers/${receiver_id}/bank-accounts`, __spreadValues({
        type: "wire"
      }, data));
    },
    createInternationalSwift(_q) {
      var _r = _q, {
        receiver_id
      } = _r, data = __objRest(_r, [
        "receiver_id"
      ]);
      return client.post(`/instances/${instanceId}/receivers/${receiver_id}/bank-accounts`, __spreadValues({
        type: "international_swift"
      }, data));
    },
    createRtp(_s) {
      var _t = _s, {
        receiver_id
      } = _t, data = __objRest(_t, [
        "receiver_id"
      ]);
      return client.post(`/instances/${instanceId}/receivers/${receiver_id}/bank-accounts`, __spreadValues({
        type: "rtp"
      }, data));
    }
  };
}

// src/resources/fees/index.ts
function createFeesResource(instanceId, client) {
  return {
    get() {
      return client.get(`/instances/${instanceId}/billing/fees`);
    }
  };
}

// src/resources/instances/index.ts
function createInstancesResource(instanceId, client) {
  return {
    getMembers() {
      return client.get(`/instances/${instanceId}/members`);
    },
    update(_a) {
      var data = __objRest(_a, []);
      return client.put(`/instances/${instanceId}`, data);
    },
    delete() {
      return client.delete(`/instances/${instanceId}`);
    },
    deleteMember(memberId) {
      return client.delete(`/instances/${instanceId}/members/${memberId}`);
    },
    updateMemberRole({
      memberId,
      role
    }) {
      return client.put(`/instances/${instanceId}/members/${memberId}`, { role });
    }
  };
}

// src/resources/partner-fees/index.ts
function createPartnerFeesResource(instanceId, client) {
  return {
    list() {
      return client.get(`/instances/${instanceId}/partner-fees`);
    },
    create(_a) {
      var data = __objRest(_a, []);
      return client.post(`/instances/${instanceId}/partner-fees`, data);
    },
    get(id) {
      return client.get(`/instances/${instanceId}/partner-fees/${id}`);
    },
    delete(id) {
      return client.delete(`/instances/${instanceId}/partner-fees/${id}`);
    }
  };
}

// src/resources/payins/index.ts
function createPayinsResource(instanceId, client) {
  return {
    list(params) {
      const queryParams = params ? `?${new URLSearchParams(params)}` : "";
      return client.get(`/instances/${instanceId}/payins${queryParams}`);
    },
    get(payinId) {
      return client.get(`/instances/${instanceId}/payins/${payinId}`);
    },
    getTrack(payinId) {
      return client.get(`/e/payins/${payinId}`);
    },
    createEvm(payin_quote_id) {
      return client.post(`/instances/${instanceId}/payins/evm`, {
        payin_quote_id
      });
    }
  };
}

// src/resources/payins/quotes.ts
function createPayinQuotesResource(instanceId, client) {
  return {
    create(_a) {
      var data = __objRest(_a, []);
      return client.post(`/instances/${instanceId}/payin-quotes`, data);
    },
    getFxRate(_b) {
      var data = __objRest(_b, []);
      return client.post(`/instances/${instanceId}/payin-quotes/fx`, data);
    }
  };
}

// src/resources/payouts/index.ts
function createPayoutsResource(instanceId, client) {
  return {
    list(params) {
      const queryParams = params ? `?${new URLSearchParams(params)}` : "";
      return client.get(`/instances/${instanceId}/payouts${queryParams}`);
    },
    get(payoutId) {
      return client.get(`/instances/${instanceId}/payouts/${payoutId}`);
    },
    getTrack(payoutId) {
      return client.get(`/e/payouts/${payoutId}`);
    },
    authorizeStellarToken(_a) {
      var data = __objRest(_a, []);
      return client.post(`/instances/${instanceId}/payouts/stellar/authorize`, data);
    },
    createStellar(_b) {
      var data = __objRest(_b, []);
      return client.post(`/instances/${instanceId}/payouts/stellar`, data);
    },
    createEvm(_c) {
      var data = __objRest(_c, []);
      return client.post(`/instances/${instanceId}/payouts/evm`, data);
    },
    createSolana(_d) {
      var data = __objRest(_d, []);
      return client.post(`/instances/${instanceId}/payouts/solana`, data);
    },
    submitDocuments(_e) {
      var _f = _e, {
        payout_id
      } = _f, data = __objRest(_f, [
        "payout_id"
      ]);
      return client.post(`/instances/${instanceId}/payouts/${payout_id}/documents`, data);
    }
  };
}

// src/resources/quotes/index.ts
function createQuotesResource(instanceId, client) {
  return {
    create(_a) {
      var data = __objRest(_a, []);
      return client.post(`/instances/${instanceId}/quotes`, data);
    },
    getFxRate(_b) {
      var data = __objRest(_b, []);
      return client.post(`/instances/${instanceId}/quotes/fx`, data);
    }
  };
}

// src/resources/receivers/index.ts
function createReceiversResource(instanceId, client) {
  return {
    list(params) {
      const queryParams = params ? `?${new URLSearchParams(params)}` : "";
      return client.get(`/instances/${instanceId}/receivers${queryParams}`);
    },
    createIndividualWithStandardKYC(data) {
      return client.post(`/instances/${instanceId}/receivers`, __spreadValues({
        kyc_type: "standard",
        type: "individual"
      }, data));
    },
    createIndividualWithEnhancedKYC(data) {
      return client.post(`/instances/${instanceId}/receivers`, __spreadValues({
        kyc_type: "enhanced",
        type: "individual"
      }, data));
    },
    createBusinessWithStandardKYB(data) {
      return client.post(`/instances/${instanceId}/receivers`, __spreadValues({
        kyc_type: "standard",
        type: "business"
      }, data));
    },
    get(receiver_id) {
      return client.get(`/instances/${instanceId}/receivers/${receiver_id}`);
    },
    update(_a) {
      var _b = _a, { receiver_id } = _b, data = __objRest(_b, ["receiver_id"]);
      return client.put(`/instances/${instanceId}/receivers/${receiver_id}`, data);
    },
    delete(receiver_id) {
      return client.delete(`/instances/${instanceId}/receivers/${receiver_id}`);
    },
    getLimits(receiver_id) {
      return client.get(`/instances/${instanceId}/limits/receivers/${receiver_id}`);
    },
    getLimitIncreaseRequests(receiver_id) {
      return client.get(`/instances/${instanceId}/receivers/${receiver_id}/limit-increase`);
    },
    requestLimitIncrease(_c) {
      var _d = _c, {
        receiver_id
      } = _d, data = __objRest(_d, [
        "receiver_id"
      ]);
      return client.post(
        `/instances/${instanceId}/receivers/${receiver_id}/limit-increase`,
        data
      );
    }
  };
}

// src/resources/terms-of-service/index.ts
function createTermsOfServiceResource(instanceId, client) {
  return {
    initiate({
      idempotency_key,
      receiver_id,
      redirect_url
    }) {
      return client.post(`/e/instances/${instanceId}/tos`, {
        idempotency_key,
        receiver_id,
        redirect_url
      });
    }
  };
}

// src/resources/transfers/index.ts
function createTransfersResource(instanceId, client) {
  return {
    quotes: {
      create(_a) {
        var data = __objRest(_a, []);
        return client.post(`/instances/${instanceId}/transfer-quotes`, data);
      }
    },
    create(_b) {
      var data = __objRest(_b, []);
      return client.post(`/instances/${instanceId}/transfers`, data);
    },
    list(params) {
      const queryParams = params ? `?${new URLSearchParams(params)}` : "";
      return client.get(`/instances/${instanceId}/transfers${queryParams}`);
    },
    get(transferId) {
      return client.get(`/instances/${instanceId}/transfers/${transferId}`);
    },
    getTrack(transferId) {
      return client.get(`/e/transfers/${transferId}`);
    }
  };
}

// src/resources/upload/index.ts
function createUploadResource(baseUrl, headers) {
  return {
    upload(_0) {
      return __async(this, arguments, function* ({
        file,
        bucket,
        instance_id
      }) {
        var _b;
        const formData = new FormData();
        formData.append("file", file);
        formData.append("bucket", bucket);
        const queryParams = instance_id ? `?instance_id=${instance_id}` : "";
        const _a2 = headers, { "Content-Type": _ } = _a2, headersWithoutContentType = __objRest(_a2, ["Content-Type"]);
        const response = yield fetch(`${baseUrl}/upload${queryParams}`, {
          method: "POST",
          headers: headersWithoutContentType,
          body: formData
        });
        if (!response.ok) {
          const error = yield response.json();
          return {
            data: null,
            error: {
              message: (_b = error == null ? void 0 : error.message) != null ? _b : "Unknown error"
            }
          };
        }
        const data = yield response.json();
        return {
          data,
          error: null
        };
      });
    }
  };
}

// src/resources/virtual-accounts/index.ts
function createVirtualAccountsResource(instanceId, client) {
  return {
    list(receiver_id) {
      return client.get(`/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`);
    },
    get({
      receiver_id,
      id
    }) {
      return client.get(
        `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts/${id}`
      );
    },
    create(_a) {
      var _b = _a, {
        receiver_id
      } = _b, data = __objRest(_b, [
        "receiver_id"
      ]);
      return client.post(
        `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`,
        data
      );
    },
    update(_c) {
      var _d = _c, {
        receiver_id,
        id
      } = _d, data = __objRest(_d, [
        "receiver_id",
        "id"
      ]);
      return client.put(
        `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts/${id}`,
        data
      );
    }
  };
}

// src/resources/wallets/blockchain.ts
function createBlockchainWalletsResource(instanceId, client) {
  return {
    list(receiver_id) {
      return client.get(
        `/instances/${instanceId}/receivers/${receiver_id}/blockchain-wallets`
      );
    },
    createWithAddress(_a) {
      var _b = _a, {
        receiver_id
      } = _b, data = __objRest(_b, [
        "receiver_id"
      ]);
      return client.post(
        `/instances/${instanceId}/receivers/${receiver_id}/blockchain-wallets`,
        __spreadProps(__spreadValues({}, data), {
          is_account_abstraction: true
        })
      );
    },
    createWithHash(_c) {
      var _d = _c, {
        receiver_id
      } = _d, data = __objRest(_d, [
        "receiver_id"
      ]);
      return client.post(
        `/instances/${instanceId}/receivers/${receiver_id}/blockchain-wallets`,
        __spreadProps(__spreadValues({}, data), {
          is_account_abstraction: false
        })
      );
    },
    getWalletMessage(receiver_id) {
      return client.get(
        `/instances/${instanceId}/receivers/${receiver_id}/blockchain-wallets/sign-message`
      );
    },
    get({
      receiver_id,
      id
    }) {
      return client.get(
        `/instances/${instanceId}/receivers/${receiver_id}/blockchain-wallets/${id}`
      );
    },
    delete({
      receiver_id,
      id
    }) {
      return client.delete(
        `/instances/${instanceId}/receivers/${receiver_id}/blockchain-wallets/${id}`
      );
    },
    createAssetTrustline(address) {
      return client.post(`/instances/${instanceId}/create-asset-trustline`, {
        address
      });
    },
    mintUsdbStellar(_e) {
      var data = __objRest(_e, []);
      return client.post(`/instances/${instanceId}/mint-usdb-stellar`, data);
    },
    mintUsdbSolana(_f) {
      var data = __objRest(_f, []);
      return client.post(`/instances/${instanceId}/mint-usdb-solana`, data);
    },
    prepareSolanaDelegationTransaction(_g) {
      var data = __objRest(_g, []);
      return client.post(`/instances/${instanceId}/prepare-delegate-solana`, data);
    }
  };
}

// src/resources/wallets/custodial.ts
function createCustodialWalletsResource(instanceId, client) {
  return {
    list(receiver_id) {
      return client.get(`/instances/${instanceId}/receivers/${receiver_id}/wallets`);
    },
    get({
      receiver_id,
      id
    }) {
      return client.get(`/instances/${instanceId}/receivers/${receiver_id}/wallets/${id}`);
    },
    create(_a) {
      var _b = _a, {
        receiver_id
      } = _b, data = __objRest(_b, [
        "receiver_id"
      ]);
      return client.post(`/instances/${instanceId}/receivers/${receiver_id}/wallets`, data);
    },
    getBalance({
      receiver_id,
      id
    }) {
      return client.get(
        `/instances/${instanceId}/receivers/${receiver_id}/wallets/${id}/balance`
      );
    },
    delete({
      receiver_id,
      id
    }) {
      return client.delete(`/instances/${instanceId}/receivers/${receiver_id}/wallets/${id}`);
    }
  };
}

// src/resources/wallets/offramp.ts
function createOfframpWalletsResource(instanceId, client) {
  return {
    list({
      bank_account_id,
      receiver_id
    }) {
      return client.get(
        `/instances/${instanceId}/receivers/${receiver_id}/bank-accounts/${bank_account_id}/offramp-wallets`
      );
    },
    create(_a) {
      var _b = _a, {
        receiver_id,
        bank_account_id
      } = _b, data = __objRest(_b, [
        "receiver_id",
        "bank_account_id"
      ]);
      return client.post(
        `/instances/${instanceId}/receivers/${receiver_id}/bank-accounts/${bank_account_id}/offramp-wallets`,
        data
      );
    },
    get({
      receiver_id,
      bank_account_id,
      id
    }) {
      return client.get(
        `/instances/${instanceId}/receivers/${receiver_id}/bank-accounts/${bank_account_id}/offramp-wallets/${id}`
      );
    }
  };
}

// src/resources/webhooks/index.ts
function createWebhookEndpointsResource(instanceId, client) {
  return {
    list() {
      return client.get(`/instances/${instanceId}/webhook-endpoints`);
    },
    create(_a) {
      var data = __objRest(_a, []);
      return client.post(`/instances/${instanceId}/webhook-endpoints`, data);
    },
    delete(id) {
      return client.delete(`/instances/${instanceId}/webhook-endpoints/${id}`);
    },
    getSecret(id) {
      return client.get(`/instances/${instanceId}/webhook-endpoints/${id}/secret`);
    },
    getPortalAccessUrl() {
      return client.get(`/instances/${instanceId}/webhook-endpoints/portal-access`);
    }
  };
}

// src/client.ts
var BlindPay = class {
  constructor({
    apiKey,
    instanceId
  }) {
    // Options
    this.baseUrl = "https://api.blindpay.com/v1";
    if (!apiKey) {
      throw new BlindPayError("Api key not provided, get your api key on blindpay dashboard");
    }
    if (!instanceId) {
      throw new BlindPayError(
        "Instance id not provided, get your instance id on blindpay dashboard"
      );
    }
    this.apiKey = apiKey;
    this.instanceId = instanceId;
    this.headers = {
      "Content-Type": "application/json",
      Accept: "application/json",
      "User-Agent": `blindpay-node/${version}`,
      Authorization: `Bearer ${this.apiKey}`
    };
    this.api = {
      get: this.get.bind(this),
      post: this.post.bind(this),
      put: this.put.bind(this),
      patch: this.patch.bind(this),
      delete: this.delete.bind(this)
    };
    this.available = createAvailableResource(this.api);
    this.instances = __spreadProps(__spreadValues({}, createInstancesResource(this.instanceId, this.api)), {
      apiKeys: createApiKeysResource(this.instanceId, this.api),
      webhookEndpoints: createWebhookEndpointsResource(this.instanceId, this.api),
      tos: createTermsOfServiceResource(this.instanceId, this.api)
    });
    this.partnerFees = createPartnerFeesResource(this.instanceId, this.api);
    this.payins = __spreadProps(__spreadValues({}, createPayinsResource(this.instanceId, this.api)), {
      quotes: createPayinQuotesResource(this.instanceId, this.api)
    });
    this.quotes = createQuotesResource(this.instanceId, this.api);
    this.payouts = createPayoutsResource(this.instanceId, this.api);
    this.transfers = createTransfersResource(this.instanceId, this.api);
    this.fees = createFeesResource(this.instanceId, this.api);
    this.upload = createUploadResource(this.baseUrl, this.headers);
    this.receivers = __spreadProps(__spreadValues({}, createReceiversResource(this.instanceId, this.api)), {
      bankAccounts: createBankAccountsResource(this.instanceId, this.api)
    });
    this.virtualAccounts = createVirtualAccountsResource(this.instanceId, this.api);
    this.wallets = {
      blockchain: createBlockchainWalletsResource(this.instanceId, this.api),
      offramp: createOfframpWalletsResource(this.instanceId, this.api),
      custodial: createCustodialWalletsResource(this.instanceId, this.api)
    };
  }
  request(method, path, body) {
    return __async(this, null, function* () {
      var _a;
      try {
        const response = yield fetch(`${this.baseUrl}${path}`, {
          method,
          headers: this.headers,
          body: body ? JSON.stringify(body) : void 0
        });
        if (!response.ok) {
          const error = yield response.json();
          return {
            data: null,
            error: {
              message: (_a = error == null ? void 0 : error.message) != null ? _a : "Unknown error"
            }
          };
        }
        const data = yield response.json();
        return {
          data,
          error: null
        };
      } catch (error) {
        if (error instanceof Error) {
          return {
            data: null,
            error: {
              message: error.message
            }
          };
        }
        const errorMessage = error && typeof error === "object" && "message" in error && typeof error.message === "string" ? error.message : "Unknown error";
        return {
          data: null,
          error: {
            message: errorMessage
          }
        };
      }
    });
  }
  get(path) {
    return __async(this, null, function* () {
      return this.request("GET", path);
    });
  }
  post(path, body) {
    return __async(this, null, function* () {
      return this.request("POST", path, body);
    });
  }
  put(path, body) {
    return __async(this, null, function* () {
      return this.request("PUT", path, body);
    });
  }
  patch(path, body) {
    return __async(this, null, function* () {
      return this.request("PATCH", path, body);
    });
  }
  delete(path, body) {
    return __async(this, null, function* () {
      return this.request("DELETE", path, body);
    });
  }
  /**
   * Verifies the BlindPay webhook signature using Svix
   *
   * @param params.secret The webhook secret from BlindPay dashboard
   * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
   * @param params.payload The raw request body as a string
   * @returns {boolean} True if the signature is valid, false otherwise
   */
  verifyWebhookSignature({
    secret,
    headers,
    payload
  }) {
    try {
      const webhook = new import_svix.Webhook(secret);
      webhook.verify(payload, {
        "svix-id": headers.id,
        "svix-timestamp": headers.timestamp,
        "svix-signature": headers.signature
      });
      return true;
    } catch (e) {
      return false;
    }
  }
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  BlindPay,
  createApiKeysResource,
  createAvailableResource,
  createBankAccountsResource,
  createBlockchainWalletsResource,
  createCustodialWalletsResource,
  createFeesResource,
  createInstancesResource,
  createOfframpWalletsResource,
  createPartnerFeesResource,
  createPayinQuotesResource,
  createPayinsResource,
  createPayoutsResource,
  createQuotesResource,
  createReceiversResource,
  createTransfersResource,
  createUploadResource,
  createVirtualAccountsResource,
  createWebhookEndpointsResource
});
