teleton 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12020,7 +12020,697 @@ import { WalletContractV5R1 as WalletContractV5R17, TonClient as TonClient9, toN
12020
12020
  import { SendMode as SendMode6 } from "@ton/core";
12021
12021
  import { getHttpEndpoint as getHttpEndpoint9 } from "@orbs-network/ton-access";
12022
12022
  import { DEX, pTON } from "@ston-fi/sdk";
12023
- import { StonApiClient } from "@ston-fi/api";
12023
+
12024
+ // node_modules/@ston-fi/api/dist/esm/index.js
12025
+ import { ofetch } from "ofetch";
12026
+ var __create = Object.create;
12027
+ var __defProp = Object.defineProperty;
12028
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12029
+ var __getOwnPropNames = Object.getOwnPropertyNames;
12030
+ var __getProtoOf = Object.getPrototypeOf;
12031
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12032
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
12033
+ var __copyProps = (to, from, except, desc) => {
12034
+ if (from && typeof from === "object" || typeof from === "function") {
12035
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12036
+ key = keys[i];
12037
+ if (!__hasOwnProp.call(to, key) && key !== except) {
12038
+ __defProp(to, key, {
12039
+ get: ((k) => from[k]).bind(null, key),
12040
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12041
+ });
12042
+ }
12043
+ }
12044
+ }
12045
+ return to;
12046
+ };
12047
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
12048
+ value: mod,
12049
+ enumerable: true
12050
+ }) : target, mod));
12051
+ var normalizeDate = (date) => {
12052
+ return date.toISOString().split(".")[0];
12053
+ };
12054
+ var require_map_obj = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12055
+ const isObject2 = (value) => typeof value === "object" && value !== null;
12056
+ const mapObjectSkip2 = /* @__PURE__ */ Symbol("skip");
12057
+ const isObjectCustom2 = (value) => isObject2(value) && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
12058
+ const mapObject2 = (object, mapper, options, isSeen = /* @__PURE__ */ new WeakMap()) => {
12059
+ options = {
12060
+ deep: false,
12061
+ target: {},
12062
+ ...options
12063
+ };
12064
+ if (isSeen.has(object)) return isSeen.get(object);
12065
+ isSeen.set(object, options.target);
12066
+ const { target } = options;
12067
+ delete options.target;
12068
+ const mapArray = (array) => array.map((element) => isObjectCustom2(element) ? mapObject2(element, mapper, options, isSeen) : element);
12069
+ if (Array.isArray(object)) return mapArray(object);
12070
+ for (const [key, value] of Object.entries(object)) {
12071
+ const mapResult = mapper(key, value, object);
12072
+ if (mapResult === mapObjectSkip2) continue;
12073
+ let [newKey, newValue, { shouldRecurse = true } = {}] = mapResult;
12074
+ if (newKey === "__proto__") continue;
12075
+ if (options.deep && shouldRecurse && isObjectCustom2(newValue)) newValue = Array.isArray(newValue) ? mapArray(newValue) : mapObject2(newValue, mapper, options, isSeen);
12076
+ target[newKey] = newValue;
12077
+ }
12078
+ return target;
12079
+ };
12080
+ module.exports = (object, mapper, options) => {
12081
+ if (!isObject2(object)) throw new TypeError(`Expected an object, got \`${object}\` (${typeof object})`);
12082
+ return mapObject2(object, mapper, options);
12083
+ };
12084
+ module.exports.mapObjectSkip = mapObjectSkip2;
12085
+ }));
12086
+ var import_map_obj = /* @__PURE__ */ __toESM(require_map_obj(), 1);
12087
+ var QuickLRU = class extends Map {
12088
+ constructor(options = {}) {
12089
+ super();
12090
+ if (!(options.maxSize && options.maxSize > 0)) throw new TypeError("`maxSize` must be a number greater than 0");
12091
+ if (typeof options.maxAge === "number" && options.maxAge === 0) throw new TypeError("`maxAge` must be a number greater than 0");
12092
+ this.maxSize = options.maxSize;
12093
+ this.maxAge = options.maxAge || Number.POSITIVE_INFINITY;
12094
+ this.onEviction = options.onEviction;
12095
+ this.cache = /* @__PURE__ */ new Map();
12096
+ this.oldCache = /* @__PURE__ */ new Map();
12097
+ this._size = 0;
12098
+ }
12099
+ _emitEvictions(cache$2) {
12100
+ if (typeof this.onEviction !== "function") return;
12101
+ for (const [key, item] of cache$2) this.onEviction(key, item.value);
12102
+ }
12103
+ _deleteIfExpired(key, item) {
12104
+ if (typeof item.expiry === "number" && item.expiry <= Date.now()) {
12105
+ if (typeof this.onEviction === "function") this.onEviction(key, item.value);
12106
+ return this.delete(key);
12107
+ }
12108
+ return false;
12109
+ }
12110
+ _getOrDeleteIfExpired(key, item) {
12111
+ if (this._deleteIfExpired(key, item) === false) return item.value;
12112
+ }
12113
+ _getItemValue(key, item) {
12114
+ return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
12115
+ }
12116
+ _peek(key, cache$2) {
12117
+ const item = cache$2.get(key);
12118
+ return this._getItemValue(key, item);
12119
+ }
12120
+ _set(key, value) {
12121
+ this.cache.set(key, value);
12122
+ this._size++;
12123
+ if (this._size >= this.maxSize) {
12124
+ this._size = 0;
12125
+ this._emitEvictions(this.oldCache);
12126
+ this.oldCache = this.cache;
12127
+ this.cache = /* @__PURE__ */ new Map();
12128
+ }
12129
+ }
12130
+ _moveToRecent(key, item) {
12131
+ this.oldCache.delete(key);
12132
+ this._set(key, item);
12133
+ }
12134
+ *_entriesAscending() {
12135
+ for (const item of this.oldCache) {
12136
+ const [key, value] = item;
12137
+ if (!this.cache.has(key)) {
12138
+ if (this._deleteIfExpired(key, value) === false) yield item;
12139
+ }
12140
+ }
12141
+ for (const item of this.cache) {
12142
+ const [key, value] = item;
12143
+ if (this._deleteIfExpired(key, value) === false) yield item;
12144
+ }
12145
+ }
12146
+ get(key) {
12147
+ if (this.cache.has(key)) {
12148
+ const item = this.cache.get(key);
12149
+ return this._getItemValue(key, item);
12150
+ }
12151
+ if (this.oldCache.has(key)) {
12152
+ const item = this.oldCache.get(key);
12153
+ if (this._deleteIfExpired(key, item) === false) {
12154
+ this._moveToRecent(key, item);
12155
+ return item.value;
12156
+ }
12157
+ }
12158
+ }
12159
+ set(key, value, { maxAge = this.maxAge } = {}) {
12160
+ const expiry = typeof maxAge === "number" && maxAge !== Number.POSITIVE_INFINITY ? Date.now() + maxAge : void 0;
12161
+ if (this.cache.has(key)) this.cache.set(key, {
12162
+ value,
12163
+ expiry
12164
+ });
12165
+ else this._set(key, {
12166
+ value,
12167
+ expiry
12168
+ });
12169
+ return this;
12170
+ }
12171
+ has(key) {
12172
+ if (this.cache.has(key)) return !this._deleteIfExpired(key, this.cache.get(key));
12173
+ if (this.oldCache.has(key)) return !this._deleteIfExpired(key, this.oldCache.get(key));
12174
+ return false;
12175
+ }
12176
+ peek(key) {
12177
+ if (this.cache.has(key)) return this._peek(key, this.cache);
12178
+ if (this.oldCache.has(key)) return this._peek(key, this.oldCache);
12179
+ }
12180
+ delete(key) {
12181
+ const deleted = this.cache.delete(key);
12182
+ if (deleted) this._size--;
12183
+ return this.oldCache.delete(key) || deleted;
12184
+ }
12185
+ clear() {
12186
+ this.cache.clear();
12187
+ this.oldCache.clear();
12188
+ this._size = 0;
12189
+ }
12190
+ resize(newSize) {
12191
+ if (!(newSize && newSize > 0)) throw new TypeError("`maxSize` must be a number greater than 0");
12192
+ const items = [...this._entriesAscending()];
12193
+ const removeCount = items.length - newSize;
12194
+ if (removeCount < 0) {
12195
+ this.cache = new Map(items);
12196
+ this.oldCache = /* @__PURE__ */ new Map();
12197
+ this._size = items.length;
12198
+ } else {
12199
+ if (removeCount > 0) this._emitEvictions(items.slice(0, removeCount));
12200
+ this.oldCache = new Map(items.slice(removeCount));
12201
+ this.cache = /* @__PURE__ */ new Map();
12202
+ this._size = 0;
12203
+ }
12204
+ this.maxSize = newSize;
12205
+ }
12206
+ *keys() {
12207
+ for (const [key] of this) yield key;
12208
+ }
12209
+ *values() {
12210
+ for (const [, value] of this) yield value;
12211
+ }
12212
+ *[Symbol.iterator]() {
12213
+ for (const item of this.cache) {
12214
+ const [key, value] = item;
12215
+ if (this._deleteIfExpired(key, value) === false) yield [key, value.value];
12216
+ }
12217
+ for (const item of this.oldCache) {
12218
+ const [key, value] = item;
12219
+ if (!this.cache.has(key)) {
12220
+ if (this._deleteIfExpired(key, value) === false) yield [key, value.value];
12221
+ }
12222
+ }
12223
+ }
12224
+ *entriesDescending() {
12225
+ let items = [...this.cache];
12226
+ for (let i = items.length - 1; i >= 0; --i) {
12227
+ const [key, value] = items[i];
12228
+ if (this._deleteIfExpired(key, value) === false) yield [key, value.value];
12229
+ }
12230
+ items = [...this.oldCache];
12231
+ for (let i = items.length - 1; i >= 0; --i) {
12232
+ const [key, value] = items[i];
12233
+ if (!this.cache.has(key)) {
12234
+ if (this._deleteIfExpired(key, value) === false) yield [key, value.value];
12235
+ }
12236
+ }
12237
+ }
12238
+ *entriesAscending() {
12239
+ for (const [key, value] of this._entriesAscending()) yield [key, value.value];
12240
+ }
12241
+ get size() {
12242
+ if (!this._size) return this.oldCache.size;
12243
+ let oldCacheSize = 0;
12244
+ for (const key of this.oldCache.keys()) if (!this.cache.has(key)) oldCacheSize++;
12245
+ return Math.min(this._size + oldCacheSize, this.maxSize);
12246
+ }
12247
+ entries() {
12248
+ return this.entriesAscending();
12249
+ }
12250
+ forEach(callbackFunction, thisArgument = this) {
12251
+ for (const [key, value] of this.entriesAscending()) callbackFunction.call(thisArgument, value, key, this);
12252
+ }
12253
+ get [Symbol.toStringTag]() {
12254
+ return JSON.stringify([...this.entriesAscending()]);
12255
+ }
12256
+ };
12257
+ var handlePreserveConsecutiveUppercase = (decamelized, separator) => {
12258
+ decamelized = decamelized.replace(/((?<![\p{Uppercase_Letter}\d])[\p{Uppercase_Letter}\d](?![\p{Uppercase_Letter}\d]))/gu, ($0) => $0.toLowerCase());
12259
+ return decamelized.replace(new RegExp("(?<!\\p{Uppercase_Letter})(\\p{Uppercase_Letter}+)(\\p{Uppercase_Letter}\\p{Lowercase_Letter}+)", "gu"), (_, $1, $2) => $1 + separator + $2.toLowerCase());
12260
+ };
12261
+ function decamelize(text, { separator = "_", preserveConsecutiveUppercase: preserveConsecutiveUppercase$1 = false } = {}) {
12262
+ if (!(typeof text === "string" && typeof separator === "string")) throw new TypeError("The `text` and `separator` arguments should be of type `string`");
12263
+ if (text.length < 2) return preserveConsecutiveUppercase$1 ? text : text.toLowerCase();
12264
+ const replacement = `$1${separator}$2`;
12265
+ const decamelized = text.replace(new RegExp("([\\p{Lowercase_Letter}\\d])(\\p{Uppercase_Letter})", "gu"), replacement);
12266
+ if (preserveConsecutiveUppercase$1) return handlePreserveConsecutiveUppercase(decamelized, separator);
12267
+ return decamelized.replace(new RegExp("(\\p{Uppercase_Letter})(\\p{Uppercase_Letter}\\p{Lowercase_Letter}+)", "gu"), replacement).toLowerCase();
12268
+ }
12269
+ var has$1 = (array, key) => array.some((element) => {
12270
+ if (typeof element === "string") return element === key;
12271
+ element.lastIndex = 0;
12272
+ return element.test(key);
12273
+ });
12274
+ var cache$1 = new QuickLRU({ maxSize: 1e5 });
12275
+ var isObject$2 = (value) => typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
12276
+ var transform$1 = (input, options = {}) => {
12277
+ if (!isObject$2(input)) return input;
12278
+ const { separator = "_", exclude, deep = false } = options;
12279
+ const makeMapper = (parentPath) => (key, value) => {
12280
+ if (deep && isObject$2(value)) {
12281
+ const path = parentPath === void 0 ? key : `${parentPath}.${key}`;
12282
+ value = (0, import_map_obj.default)(value, makeMapper(path));
12283
+ }
12284
+ if (!(exclude && has$1(exclude, key))) {
12285
+ const cacheKey = `${separator}${key}`;
12286
+ if (cache$1.has(cacheKey)) key = cache$1.get(cacheKey);
12287
+ else {
12288
+ const returnValue = decamelize(key, { separator });
12289
+ if (key.length < 100) cache$1.set(cacheKey, returnValue);
12290
+ key = returnValue;
12291
+ }
12292
+ }
12293
+ return [key, value];
12294
+ };
12295
+ return (0, import_map_obj.default)(input, makeMapper(void 0));
12296
+ };
12297
+ function decamelizeKeys$1(input, options) {
12298
+ if (Array.isArray(input)) return Object.keys(input).map((key) => transform$1(input[key], options));
12299
+ return transform$1(input, options);
12300
+ }
12301
+ function decamelizeKeys(val) {
12302
+ return decamelizeKeys$1(val, { deep: true });
12303
+ }
12304
+ function toUrlSafe(str) {
12305
+ let safeStr = str;
12306
+ while (safeStr.indexOf("/") >= 0) safeStr = safeStr.replace("/", "_");
12307
+ while (safeStr.indexOf("+") >= 0) safeStr = safeStr.replace("+", "-");
12308
+ while (safeStr.indexOf("=") >= 0) safeStr = safeStr.replace("=", "");
12309
+ return safeStr;
12310
+ }
12311
+ function normalizeRequest(path, options) {
12312
+ const pathWithParams = path.replace(/{([a-zA-Z0-9_]+)}/g, (_, key) => {
12313
+ const value = options?.query?.[key];
12314
+ if (!value) throw new Error(`Missing value for path parameter "${key}"`);
12315
+ delete options?.query?.[key];
12316
+ return toUrlSafe(value);
12317
+ });
12318
+ if (options?.query) {
12319
+ for (const key in options.query) {
12320
+ const value = options.query[key];
12321
+ if (typeof value === "string") options.query[key] = toUrlSafe(value);
12322
+ }
12323
+ options.query = decamelizeKeys(options.query);
12324
+ }
12325
+ if (options?.body && typeof options.body === "object") options.body = decamelizeKeys(options.body);
12326
+ return [pathWithParams, options];
12327
+ }
12328
+ var isObject$1 = (value) => typeof value === "object" && value !== null;
12329
+ var isObjectCustom = (value) => isObject$1(value) && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
12330
+ var mapObjectSkip = /* @__PURE__ */ Symbol("mapObjectSkip");
12331
+ var _mapObject = (object, mapper, options, isSeen = /* @__PURE__ */ new WeakMap()) => {
12332
+ options = {
12333
+ deep: false,
12334
+ target: {},
12335
+ ...options
12336
+ };
12337
+ if (isSeen.has(object)) return isSeen.get(object);
12338
+ isSeen.set(object, options.target);
12339
+ const { target } = options;
12340
+ delete options.target;
12341
+ const mapArray = (array) => array.map((element) => isObjectCustom(element) ? _mapObject(element, mapper, options, isSeen) : element);
12342
+ if (Array.isArray(object)) return mapArray(object);
12343
+ for (const [key, value] of Object.entries(object)) {
12344
+ const mapResult = mapper(key, value, object);
12345
+ if (mapResult === mapObjectSkip) continue;
12346
+ let [newKey, newValue, { shouldRecurse = true } = {}] = mapResult;
12347
+ if (newKey === "__proto__") continue;
12348
+ if (options.deep && shouldRecurse && isObjectCustom(newValue)) newValue = Array.isArray(newValue) ? mapArray(newValue) : _mapObject(newValue, mapper, options, isSeen);
12349
+ target[newKey] = newValue;
12350
+ }
12351
+ return target;
12352
+ };
12353
+ function mapObject(object, mapper, options) {
12354
+ if (!isObject$1(object)) throw new TypeError(`Expected an object, got \`${object}\` (${typeof object})`);
12355
+ return _mapObject(object, mapper, options);
12356
+ }
12357
+ var UPPERCASE = /[\p{Lu}]/u;
12358
+ var LOWERCASE = /[\p{Ll}]/u;
12359
+ var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
12360
+ var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
12361
+ var SEPARATORS = /[_.\- ]+/;
12362
+ var LEADING_SEPARATORS = /* @__PURE__ */ new RegExp("^" + SEPARATORS.source);
12363
+ var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
12364
+ var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
12365
+ var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase$1) => {
12366
+ let isLastCharLower = false;
12367
+ let isLastCharUpper = false;
12368
+ let isLastLastCharUpper = false;
12369
+ let isLastLastCharPreserved = false;
12370
+ for (let index = 0; index < string.length; index++) {
12371
+ const character = string[index];
12372
+ isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true;
12373
+ if (isLastCharLower && UPPERCASE.test(character)) {
12374
+ string = string.slice(0, index) + "-" + string.slice(index);
12375
+ isLastCharLower = false;
12376
+ isLastLastCharUpper = isLastCharUpper;
12377
+ isLastCharUpper = true;
12378
+ index++;
12379
+ } else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase$1)) {
12380
+ string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
12381
+ isLastLastCharUpper = isLastCharUpper;
12382
+ isLastCharUpper = false;
12383
+ isLastCharLower = true;
12384
+ } else {
12385
+ isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
12386
+ isLastLastCharUpper = isLastCharUpper;
12387
+ isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
12388
+ }
12389
+ }
12390
+ return string;
12391
+ };
12392
+ var preserveConsecutiveUppercase = (input, toLowerCase) => {
12393
+ LEADING_CAPITAL.lastIndex = 0;
12394
+ return input.replaceAll(LEADING_CAPITAL, (match) => toLowerCase(match));
12395
+ };
12396
+ var postProcess = (input, toUpperCase) => {
12397
+ SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
12398
+ NUMBERS_AND_IDENTIFIER.lastIndex = 0;
12399
+ return input.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)).replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
12400
+ };
12401
+ function camelCase(input, options) {
12402
+ if (!(typeof input === "string" || Array.isArray(input))) throw new TypeError("Expected the input to be `string | string[]`");
12403
+ options = {
12404
+ pascalCase: false,
12405
+ preserveConsecutiveUppercase: false,
12406
+ ...options
12407
+ };
12408
+ if (Array.isArray(input)) input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
12409
+ else input = input.trim();
12410
+ if (input.length === 0) return "";
12411
+ const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
12412
+ const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
12413
+ if (input.length === 1) {
12414
+ if (SEPARATORS.test(input)) return "";
12415
+ return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
12416
+ }
12417
+ if (input !== toLowerCase(input)) input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
12418
+ input = input.replace(LEADING_SEPARATORS, "");
12419
+ input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
12420
+ if (options.pascalCase) input = toUpperCase(input.charAt(0)) + input.slice(1);
12421
+ return postProcess(input, toUpperCase);
12422
+ }
12423
+ var has = (array, key) => array.some((element) => {
12424
+ if (typeof element === "string") return element === key;
12425
+ element.lastIndex = 0;
12426
+ return element.test(key);
12427
+ });
12428
+ var cache = new QuickLRU({ maxSize: 1e5 });
12429
+ var isObject = (value) => typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
12430
+ var transform = (input, options = {}) => {
12431
+ if (!isObject(input)) return input;
12432
+ const { exclude, pascalCase = false, stopPaths, deep = false, preserveConsecutiveUppercase: preserveConsecutiveUppercase$1 = false } = options;
12433
+ const stopPathsSet = new Set(stopPaths);
12434
+ const makeMapper = (parentPath) => (key, value) => {
12435
+ if (deep && isObject(value)) {
12436
+ const path = parentPath === void 0 ? key : `${parentPath}.${key}`;
12437
+ if (!stopPathsSet.has(path)) value = mapObject(value, makeMapper(path));
12438
+ }
12439
+ if (!(exclude && has(exclude, key))) {
12440
+ const cacheKey = pascalCase ? `${key}_` : key;
12441
+ if (cache.has(cacheKey)) key = cache.get(cacheKey);
12442
+ else {
12443
+ const returnValue = camelCase(key, {
12444
+ pascalCase,
12445
+ locale: false,
12446
+ preserveConsecutiveUppercase: preserveConsecutiveUppercase$1
12447
+ });
12448
+ if (key.length < 100) cache.set(cacheKey, returnValue);
12449
+ key = returnValue;
12450
+ }
12451
+ }
12452
+ return [key, value];
12453
+ };
12454
+ return mapObject(input, makeMapper(void 0));
12455
+ };
12456
+ function camelcaseKeys$1(input, options) {
12457
+ if (Array.isArray(input)) return Object.keys(input).map((key) => transform(input[key], options));
12458
+ return transform(input, options);
12459
+ }
12460
+ function camelcaseKeys(val) {
12461
+ return camelcaseKeys$1(val, { deep: true });
12462
+ }
12463
+ function denullifyValues(obj) {
12464
+ const newObj = {};
12465
+ for (const k in obj) {
12466
+ const v = obj[k];
12467
+ newObj[k] = v === null ? void 0 : v && typeof v === "object" && v.__proto__.constructor === Object ? denullifyValues(v) : v;
12468
+ }
12469
+ return newObj;
12470
+ }
12471
+ function normalizeResponse(response) {
12472
+ return denullifyValues(camelcaseKeys(response));
12473
+ }
12474
+ var StonApiClient = class {
12475
+ constructor(options) {
12476
+ this.apiFetch = ofetch.create({ baseURL: options?.baseURL ?? options?.baseUrl ?? "https://api.ston.fi" });
12477
+ }
12478
+ async getAsset(assetAddress) {
12479
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/assets/{assetAddress}", {
12480
+ method: "GET",
12481
+ query: { assetAddress }
12482
+ }))).asset;
12483
+ }
12484
+ async getAssets() {
12485
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/assets", { method: "GET" }))).assetList;
12486
+ }
12487
+ async queryAssets(body) {
12488
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/assets/query", {
12489
+ method: "POST",
12490
+ body
12491
+ }))).assetList;
12492
+ }
12493
+ /**
12494
+ * @deprecated use `queryAssets` method with `searchTerms` parameter instead
12495
+ */
12496
+ async searchAssets(query) {
12497
+ return this.queryAssets({
12498
+ ...query,
12499
+ searchTerms: [query.searchString]
12500
+ });
12501
+ }
12502
+ async getFarm(farmAddress) {
12503
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/farms/{farmAddress}", {
12504
+ method: "GET",
12505
+ query: { farmAddress }
12506
+ }))).farm;
12507
+ }
12508
+ async getFarms(query) {
12509
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/farms", {
12510
+ method: "GET",
12511
+ query
12512
+ }))).farmList;
12513
+ }
12514
+ async getFarmsByPool(poolAddress) {
12515
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/farms_by_pool/{poolAddress}", {
12516
+ method: "GET",
12517
+ query: { poolAddress }
12518
+ }))).farmList;
12519
+ }
12520
+ async getSwapPairs(query) {
12521
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/markets", {
12522
+ method: "GET",
12523
+ query
12524
+ }))).pairs;
12525
+ }
12526
+ async getSwapStatus(query) {
12527
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/swap/status", {
12528
+ method: "GET",
12529
+ query
12530
+ })));
12531
+ }
12532
+ async getPool(data) {
12533
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/pools/{poolAddress}", {
12534
+ method: "GET",
12535
+ query: typeof data === "string" ? { poolAddress: data } : data
12536
+ }))).pool;
12537
+ }
12538
+ async getPools(query) {
12539
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/pools", {
12540
+ method: "GET",
12541
+ query
12542
+ }))).poolList;
12543
+ }
12544
+ async getPoolsByAssetPair(query) {
12545
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/pools/by_market/{asset0Address}/{asset1Address}", {
12546
+ method: "GET",
12547
+ query
12548
+ }))).poolList;
12549
+ }
12550
+ async queryPools({ searchTerms: searchTerm, unconditionalAssets: unconditionalAsset, ...query }) {
12551
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/pools/query", {
12552
+ method: "POST",
12553
+ query: {
12554
+ ...query,
12555
+ searchTerm,
12556
+ unconditionalAsset
12557
+ }
12558
+ }))).poolList;
12559
+ }
12560
+ async queryTransactions(query) {
12561
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/transactions/query", {
12562
+ method: "GET",
12563
+ query: {
12564
+ ...query,
12565
+ minTxTimestamp: query.minTxTimestamp ? normalizeDate(query.minTxTimestamp) : void 0
12566
+ }
12567
+ })));
12568
+ }
12569
+ async simulateSwap({ offerUnits: units, ...query }) {
12570
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/swap/simulate", {
12571
+ method: "POST",
12572
+ query: {
12573
+ ...query,
12574
+ units
12575
+ }
12576
+ })));
12577
+ }
12578
+ async simulateReverseSwap({ askUnits: units, ...query }) {
12579
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/reverse_swap/simulate", {
12580
+ method: "POST",
12581
+ query: {
12582
+ ...query,
12583
+ units
12584
+ }
12585
+ })));
12586
+ }
12587
+ async simulateLiquidityProvision(query) {
12588
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/liquidity_provision/simulate", {
12589
+ method: "POST",
12590
+ query
12591
+ })));
12592
+ }
12593
+ async getJettonWalletAddress(query) {
12594
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/jetton/{jettonAddress}/address", {
12595
+ method: "GET",
12596
+ query
12597
+ }))).address;
12598
+ }
12599
+ async getWalletAsset(query) {
12600
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/wallets/{walletAddress}/assets/{assetAddress}", {
12601
+ method: "GET",
12602
+ query
12603
+ }))).asset;
12604
+ }
12605
+ async getWalletAssets(walletAddress) {
12606
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/wallets/{walletAddress}/assets", {
12607
+ method: "GET",
12608
+ query: { walletAddress }
12609
+ }))).assetList;
12610
+ }
12611
+ async getWalletFarm(query) {
12612
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/wallets/{walletAddress}/farms/{farmAddress}", {
12613
+ method: "GET",
12614
+ query
12615
+ }))).farm;
12616
+ }
12617
+ async getWalletFarms(data) {
12618
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/wallets/{walletAddress}/farms", {
12619
+ method: "GET",
12620
+ query: typeof data === "string" ? { walletAddress: data } : data
12621
+ }))).farmList;
12622
+ }
12623
+ async getWalletPool(query) {
12624
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/wallets/{walletAddress}/pools/{poolAddress}", {
12625
+ method: "GET",
12626
+ query
12627
+ }))).pool;
12628
+ }
12629
+ async getWalletPools(data) {
12630
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/wallets/{walletAddress}/pools", {
12631
+ method: "GET",
12632
+ query: typeof data === "string" ? { walletAddress: data } : data
12633
+ }))).poolList;
12634
+ }
12635
+ async getWalletStakes(query) {
12636
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/wallets/{walletAddress}/stakes", {
12637
+ method: "GET",
12638
+ query
12639
+ })));
12640
+ }
12641
+ async getWalletVaultsFee(query) {
12642
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/wallets/{walletAddress}/fee_vaults", {
12643
+ method: "GET",
12644
+ query
12645
+ }))).vaultList;
12646
+ }
12647
+ async getWalletOperations({ since, until, ...query }) {
12648
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/wallets/{walletAddress}/operations", {
12649
+ method: "GET",
12650
+ query: {
12651
+ ...query,
12652
+ since: normalizeDate(since),
12653
+ until: normalizeDate(until)
12654
+ }
12655
+ }))).operations;
12656
+ }
12657
+ async getOperations({ since, until }) {
12658
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/stats/operations", {
12659
+ method: "GET",
12660
+ query: {
12661
+ since: normalizeDate(since),
12662
+ until: normalizeDate(until)
12663
+ }
12664
+ }))).operations;
12665
+ }
12666
+ async getAssetsFeeStats({ since, until, referrerAddress }) {
12667
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/stats/fees", {
12668
+ method: "GET",
12669
+ query: {
12670
+ since: normalizeDate(since),
12671
+ until: normalizeDate(until),
12672
+ referrerAddress
12673
+ }
12674
+ })));
12675
+ }
12676
+ async getWithdrawalsFeeStats({ since, until, referrerAddress }) {
12677
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/stats/fee_withdrawals", {
12678
+ method: "GET",
12679
+ query: {
12680
+ since: normalizeDate(since),
12681
+ until: normalizeDate(until),
12682
+ referrerAddress
12683
+ }
12684
+ }))).withdrawals;
12685
+ }
12686
+ async getAccrualsFeeStats({ since, until, referrerAddress }) {
12687
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/stats/fee_accruals", {
12688
+ method: "GET",
12689
+ query: {
12690
+ since: normalizeDate(since),
12691
+ until: normalizeDate(until),
12692
+ referrerAddress
12693
+ }
12694
+ }))).operations;
12695
+ }
12696
+ async getStakingStats() {
12697
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/stats/staking", { method: "GET" })));
12698
+ }
12699
+ async getRouters(query) {
12700
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/routers", {
12701
+ method: "GET",
12702
+ query
12703
+ }))).routerList;
12704
+ }
12705
+ async getRouter(routerAddress) {
12706
+ return normalizeResponse(await this.apiFetch(...normalizeRequest("/v1/routers/{routerAddress}", {
12707
+ method: "GET",
12708
+ query: { routerAddress }
12709
+ }))).router;
12710
+ }
12711
+ };
12712
+
12713
+ // src/agent/tools/jetton/swap.ts
12024
12714
  var NATIVE_TON_ADDRESS = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c";
12025
12715
  var jettonSwapTool = {
12026
12716
  name: "jetton_swap",
@@ -12608,7 +13298,6 @@ var jettonSearchExecutor = async (params, context) => {
12608
13298
  // src/agent/tools/jetton/quote.ts
12609
13299
  import { Type as Type86 } from "@sinclair/typebox";
12610
13300
  import { toNano as toNano8 } from "@ton/ton";
12611
- import { StonApiClient as StonApiClient2 } from "@ston-fi/api";
12612
13301
  var NATIVE_TON_ADDRESS2 = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c";
12613
13302
  var jettonQuoteTool = {
12614
13303
  name: "jetton_quote",
@@ -12639,7 +13328,7 @@ var jettonQuoteExecutor = async (params, context) => {
12639
13328
  const isTonInput = from_asset.toLowerCase() === "ton";
12640
13329
  const fromAddress = isTonInput ? NATIVE_TON_ADDRESS2 : from_asset;
12641
13330
  const toAddress = to_asset;
12642
- const stonApiClient = new StonApiClient2();
13331
+ const stonApiClient = new StonApiClient();
12643
13332
  const simulationResult = await stonApiClient.simulateSwap({
12644
13333
  offerAddress: fromAddress,
12645
13334
  askAddress: toAddress,
@@ -13581,7 +14270,6 @@ import { Type as Type94 } from "@sinclair/typebox";
13581
14270
  import { TonClient as TonClient13, toNano as toNano11, fromNano as fromNano6 } from "@ton/ton";
13582
14271
  import { Address as Address11 } from "@ton/core";
13583
14272
  import { getHttpEndpoint as getHttpEndpoint13 } from "@orbs-network/ton-access";
13584
- import { StonApiClient as StonApiClient3 } from "@ston-fi/api";
13585
14273
  import { Factory as Factory3, Asset as Asset3, PoolType as PoolType3, ReadinessStatus as ReadinessStatus3 } from "@dedust/sdk";
13586
14274
  var dexQuoteTool = {
13587
14275
  name: "dex_quote",
@@ -13612,7 +14300,7 @@ async function getStonfiQuote(fromAsset, toAsset, amount, slippage) {
13612
14300
  const isTonOutput = toAsset.toLowerCase() === "ton";
13613
14301
  const fromAddress = isTonInput ? NATIVE_TON_ADDRESS3 : fromAsset;
13614
14302
  const toAddress = isTonOutput ? NATIVE_TON_ADDRESS3 : toAsset;
13615
- const stonApiClient = new StonApiClient3();
14303
+ const stonApiClient = new StonApiClient();
13616
14304
  const simulationResult = await stonApiClient.simulateSwap({
13617
14305
  offerAddress: fromAddress,
13618
14306
  askAddress: toAddress,
@@ -13841,7 +14529,6 @@ import { mnemonicToPrivateKey as mnemonicToPrivateKey10 } from "@ton/crypto";
13841
14529
  import { WalletContractV5R1 as WalletContractV5R110, TonClient as TonClient14, toNano as toNano12, fromNano as fromNano7 } from "@ton/ton";
13842
14530
  import { Address as Address12, SendMode as SendMode8, internal as internal8 } from "@ton/core";
13843
14531
  import { getHttpEndpoint as getHttpEndpoint14 } from "@orbs-network/ton-access";
13844
- import { StonApiClient as StonApiClient4 } from "@ston-fi/api";
13845
14532
  import { DEX as DEX2, pTON as pTON2 } from "@ston-fi/sdk";
13846
14533
  import { Factory as Factory4, Asset as Asset4, PoolType as PoolType4, ReadinessStatus as ReadinessStatus4, JettonRoot as JettonRoot2, VaultJetton as VaultJetton2 } from "@dedust/sdk";
13847
14534
  var dexSwapTool = {
@@ -13878,7 +14565,7 @@ async function getStonfiQuote2(fromAsset, toAsset, amount, slippage) {
13878
14565
  const isTonOutput = toAsset.toLowerCase() === "ton";
13879
14566
  const fromAddress = isTonInput ? NATIVE_TON_ADDRESS3 : fromAsset;
13880
14567
  const toAddress = isTonOutput ? NATIVE_TON_ADDRESS3 : toAsset;
13881
- const stonApiClient = new StonApiClient4();
14568
+ const stonApiClient = new StonApiClient();
13882
14569
  const simulationResult = await stonApiClient.simulateSwap({
13883
14570
  offerAddress: fromAddress,
13884
14571
  askAddress: toAddress,
package/dist/cli/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  saveWallet,
18
18
  validateApiKeyFormat,
19
19
  walletExists
20
- } from "../chunk-TQBJNXWV.js";
20
+ } from "../chunk-7AUS3OYB.js";
21
21
  import "../chunk-B2PRMXOH.js";
22
22
  import {
23
23
  fetchWithTimeout
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TonnetApp,
3
3
  main
4
- } from "./chunk-TQBJNXWV.js";
4
+ } from "./chunk-7AUS3OYB.js";
5
5
  import "./chunk-B2PRMXOH.js";
6
6
  import "./chunk-PMX75DTX.js";
7
7
  import "./chunk-E2NXSWOS.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teleton",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Personal AI Agent for Telegram",
5
5
  "author": "ZKProof (https://t.me/zkproof)",
6
6
  "license": "MIT",
@@ -82,7 +82,6 @@
82
82
  "typescript": "^5.7.0"
83
83
  },
84
84
  "optionalDependencies": {
85
- "@ston-fi/api": "^0.30.0",
86
85
  "edge-tts": "^1.0.1"
87
86
  },
88
87
  "engines": {