@clarigen/core 1.0.0-next.8 → 1.0.0

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.
package/dist/core.esm.js DELETED
@@ -1,1427 +0,0 @@
1
- import { contractPrincipalCV, ClarityType, hexToCV, tupleCV, listCV, noneCV, someCV, stringAsciiCV, stringUtf8CV, uintCV, intCV, bufferCV, addressToString, cvToHex } from 'micro-stacks/clarity';
2
- import { isClarityAbiTuple, isClarityAbiList, isClarityAbiOptional, isClarityAbiStringAscii, isClarityAbiStringUtf8, parseToCV as parseToCV$1, isClarityAbiBuffer, broadcastTransaction } from 'micro-stacks/transactions';
3
- import { bytesToAscii, bytesToHex, fetchPrivate } from 'micro-stacks/common';
4
- import { ok, err } from 'neverthrow';
5
- import { fetchContractDataMapEntry, parseReadOnlyResponse } from 'micro-stacks/api';
6
-
7
- var TESTNET_BURN_ADDRESS = 'ST000000000000000000002AMW42H';
8
- var MAINNET_BURN_ADDRESS = 'SP000000000000000000002Q6VF78';
9
- var toCamelCase = function toCamelCase(input, titleCase) {
10
- var inputStr = typeof input === 'string' ? input : String(input);
11
-
12
- var _inputStr$replace$rep = inputStr.replace('!', '').replace('?', '').split('-'),
13
- first = _inputStr$replace$rep[0],
14
- parts = _inputStr$replace$rep.slice(1);
15
-
16
- var result = titleCase ? "" + first[0].toUpperCase() + first.slice(1) : first;
17
- parts.forEach(function (part) {
18
- var capitalized = part[0].toUpperCase() + part.slice(1);
19
- result += capitalized;
20
- });
21
- return result;
22
- };
23
- var getContractNameFromPath = function getContractNameFromPath(path) {
24
- var contractPaths = path.split('/');
25
- var filename = contractPaths[contractPaths.length - 1];
26
-
27
- var _filename$split = filename.split('.'),
28
- contractName = _filename$split[0];
29
-
30
- return contractName;
31
- };
32
- var getContractIdentifier = function getContractIdentifier(contract) {
33
- return contract.address + "." + contract.name;
34
- };
35
- var getContractPrincipalCV = function getContractPrincipalCV(contract) {
36
- var contractName = getContractNameFromPath(contract.contractFile);
37
- return contractPrincipalCV(contract.address, contractName);
38
- };
39
- function bootContractIdentifier(name, mainnet) {
40
- var addr = mainnet ? MAINNET_BURN_ADDRESS : TESTNET_BURN_ADDRESS;
41
- return addr + "." + name;
42
- }
43
-
44
- var CoreNodeEventType;
45
-
46
- (function (CoreNodeEventType) {
47
- CoreNodeEventType["ContractEvent"] = "contract_event";
48
- CoreNodeEventType["StxTransferEvent"] = "stx_transfer_event";
49
- CoreNodeEventType["StxMintEvent"] = "stx_mint_event";
50
- CoreNodeEventType["StxBurnEvent"] = "stx_burn_event";
51
- CoreNodeEventType["StxLockEvent"] = "stx_lock_event";
52
- CoreNodeEventType["NftTransferEvent"] = "nft_transfer_event";
53
- CoreNodeEventType["NftMintEvent"] = "nft_mint_event";
54
- CoreNodeEventType["NftBurnEvent"] = "nft_burn_event";
55
- CoreNodeEventType["FtTransferEvent"] = "ft_transfer_event";
56
- CoreNodeEventType["FtMintEvent"] = "ft_mint_event";
57
- CoreNodeEventType["FtBurnEvent"] = "ft_burn_event";
58
- })(CoreNodeEventType || (CoreNodeEventType = {}));
59
-
60
- function makeContracts(contracts, options) {
61
- if (options === void 0) {
62
- options = {};
63
- }
64
-
65
- var instances = {};
66
-
67
- for (var k in contracts) {
68
- var contract = contracts[k];
69
- var address = options.deployerAddress || contract.address;
70
- var identifier = address + "." + contract.name;
71
- var instance = contract.contract(address, contract.name);
72
- instances[k] = {
73
- identifier: identifier,
74
- contract: instance
75
- };
76
- }
77
-
78
- return instances;
79
- }
80
-
81
- function principalToString(principal) {
82
- if (principal.type === ClarityType.PrincipalStandard) {
83
- return addressToString(principal.address);
84
- } else if (principal.type === ClarityType.PrincipalContract) {
85
- var address = addressToString(principal.address);
86
- return address + "." + principal.contractName.content;
87
- } else {
88
- throw new Error("Unexpected principal data: " + JSON.stringify(principal));
89
- }
90
- }
91
- /**
92
- * @param val - ClarityValue
93
- * @param returnResponse - if true, this will return a "response" object from the `neverthrow`
94
- * library. Otherwise, it returns the inner value of the response (whether ok or err)
95
- */
96
-
97
-
98
- function cvToValue(val, returnResponse) {
99
- if (returnResponse === void 0) {
100
- returnResponse = false;
101
- }
102
-
103
- switch (val.type) {
104
- case ClarityType.BoolTrue:
105
- return true;
106
-
107
- case ClarityType.BoolFalse:
108
- return false;
109
-
110
- case ClarityType.Int:
111
- case ClarityType.UInt:
112
- return val.value;
113
-
114
- case ClarityType.Buffer:
115
- return val.buffer;
116
-
117
- case ClarityType.OptionalNone:
118
- return null;
119
-
120
- case ClarityType.OptionalSome:
121
- return cvToValue(val.value);
122
-
123
- case ClarityType.ResponseErr:
124
- if (returnResponse) return err(cvToValue(val.value));
125
- return cvToValue(val.value);
126
-
127
- case ClarityType.ResponseOk:
128
- if (returnResponse) return ok(cvToValue(val.value));
129
- return cvToValue(val.value);
130
-
131
- case ClarityType.PrincipalStandard:
132
- case ClarityType.PrincipalContract:
133
- return principalToString(val);
134
-
135
- case ClarityType.List:
136
- return val.list.map(function (v) {
137
- return cvToValue(v);
138
- });
139
-
140
- case ClarityType.Tuple:
141
- var result = {};
142
- var arr = Object.keys(val.data).map(function (key) {
143
- return [key, cvToValue(val.data[key])];
144
- });
145
- arr.forEach(function (_ref) {
146
- var key = _ref[0],
147
- value = _ref[1];
148
- result[key] = value;
149
- });
150
- return result;
151
-
152
- case ClarityType.StringASCII:
153
- return val.data;
154
-
155
- case ClarityType.StringUTF8:
156
- return val.data;
157
- }
158
- }
159
- /**
160
- * Converts a hex encoded string to the javascript clarity value object {type: string; value: any}
161
- * @param hex - the hex encoded string with or without `0x` prefix
162
- * @param jsonCompat - enable to serialize bigints to strings
163
- */
164
-
165
- function hexToCvValue(hex, jsonCompat) {
166
- if (jsonCompat === void 0) {
167
- jsonCompat = false;
168
- }
169
-
170
- return cvToValue(hexToCV(hex), jsonCompat);
171
- }
172
-
173
- function inputToBigInt(input) {
174
- var isBigInt = typeof input === 'bigint';
175
- var isNumber = typeof input === 'number';
176
- var isString = typeof input === 'string';
177
- var isOk = isBigInt || isNumber || isString;
178
-
179
- if (!isOk) {
180
- throw new Error('Invalid input type for integer');
181
- }
182
-
183
- return BigInt(input);
184
- }
185
-
186
- function parseToCV(input, type) {
187
- if (isClarityAbiTuple(type)) {
188
- if (typeof input !== 'object') {
189
- throw new Error('Invalid tuple input');
190
- }
191
-
192
- var tuple = {};
193
- type.tuple.forEach(function (key) {
194
- var val = input[key.name];
195
- tuple[key.name] = parseToCV(val, key.type);
196
- });
197
- return tupleCV(tuple);
198
- } else if (isClarityAbiList(type)) {
199
- var inputs = input;
200
- var values = inputs.map(function (input) {
201
- return parseToCV(input, type.list.type);
202
- });
203
- return listCV(values);
204
- } else if (isClarityAbiOptional(type)) {
205
- if (!input) return noneCV();
206
- return someCV(parseToCV(input, type.optional));
207
- } else if (isClarityAbiStringAscii(type)) {
208
- if (typeof input !== 'string') {
209
- throw new Error('Invalid string-ascii input');
210
- }
211
-
212
- return stringAsciiCV(input);
213
- } else if (isClarityAbiStringUtf8(type)) {
214
- if (typeof input !== 'string') {
215
- throw new Error('Invalid string-ascii input');
216
- }
217
-
218
- return stringUtf8CV(input);
219
- } else if (type === 'bool') {
220
- var inputString = typeof input === 'boolean' ? input.toString() : input;
221
- return parseToCV$1(inputString, type);
222
- } else if (type === 'uint128') {
223
- var bigi = inputToBigInt(input);
224
- return uintCV(bigi.toString());
225
- } else if (type === 'int128') {
226
- var _bigi = inputToBigInt(input);
227
-
228
- return intCV(_bigi.toString());
229
- } else if (type === 'trait_reference') {
230
- if (typeof input !== 'string') throw new Error('Invalid input for trait_reference');
231
-
232
- var _input$split = input.split('.'),
233
- addr = _input$split[0],
234
- name = _input$split[1];
235
-
236
- return contractPrincipalCV(addr, name);
237
- } else if (isClarityAbiBuffer(type)) {
238
- return bufferCV(input);
239
- }
240
-
241
- return parseToCV$1(input, type);
242
- }
243
- function cvToString(val, encoding) {
244
- if (encoding === void 0) {
245
- encoding = 'hex';
246
- }
247
-
248
- switch (val.type) {
249
- case ClarityType.BoolTrue:
250
- return 'true';
251
-
252
- case ClarityType.BoolFalse:
253
- return 'false';
254
-
255
- case ClarityType.Int:
256
- return val.value.toString();
257
-
258
- case ClarityType.UInt:
259
- return "u" + val.value.toString();
260
-
261
- case ClarityType.Buffer:
262
- if (encoding === 'tryAscii') {
263
- var str = bytesToAscii(val.buffer);
264
-
265
- if (/[ -~]/.test(str)) {
266
- return JSON.stringify(str);
267
- }
268
- }
269
-
270
- return "0x" + bytesToHex(val.buffer);
271
-
272
- case ClarityType.OptionalNone:
273
- return 'none';
274
-
275
- case ClarityType.OptionalSome:
276
- return "(some " + cvToString(val.value, encoding) + ")";
277
-
278
- case ClarityType.ResponseErr:
279
- return "(err " + cvToString(val.value, encoding) + ")";
280
-
281
- case ClarityType.ResponseOk:
282
- return "(ok " + cvToString(val.value, encoding) + ")";
283
-
284
- case ClarityType.PrincipalStandard:
285
- case ClarityType.PrincipalContract:
286
- return "'" + principalToString(val);
287
-
288
- case ClarityType.List:
289
- return "(list " + val.list.map(function (v) {
290
- return cvToString(v, encoding);
291
- }).join(' ') + ")";
292
-
293
- case ClarityType.Tuple:
294
- return "(tuple " + Object.keys(val.data).map(function (key) {
295
- return "(" + key + " " + cvToString(val.data[key], encoding) + ")";
296
- }).join(' ') + ")";
297
-
298
- case ClarityType.StringASCII:
299
- return "\"" + val.data + "\"";
300
-
301
- case ClarityType.StringUTF8:
302
- return "u\"" + val.data + "\"";
303
- }
304
- }
305
- function transformArgsToCV(func, args) {
306
- return args.map(function (arg, index) {
307
- return parseToCV(arg, func.args[index].type);
308
- });
309
- }
310
- function expectOk(response) {
311
- return response.match(function (ok) {
312
- return ok;
313
- }, function (err) {
314
- throw new Error("Expected OK, received error: " + err);
315
- });
316
- }
317
- function expectErr(response) {
318
- return response.match(function (ok) {
319
- throw new Error("Expected Err, received Ok: " + ok);
320
- }, function (err) {
321
- return err;
322
- });
323
- }
324
-
325
- function transformArguments(func, args) {
326
- return transformArgsToCV(func, args);
327
- }
328
-
329
- function getter(contract, property) {
330
- var foundFunction = contract.abi.functions.find(function (func) {
331
- return toCamelCase(func.name) === property;
332
- });
333
-
334
- if (foundFunction) {
335
- return function () {
336
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
337
- args[_key] = arguments[_key];
338
- }
339
-
340
- var functionArgs = transformArguments(foundFunction, args);
341
- return {
342
- functionArgs: functionArgs,
343
- contractAddress: contract.contractAddress,
344
- contractName: contract.contractName,
345
- "function": foundFunction,
346
- nativeArgs: args
347
- };
348
- };
349
- }
350
-
351
- var foundMap = contract.abi.maps.find(function (map) {
352
- return toCamelCase(map.name) === property;
353
- });
354
-
355
- if (foundMap) {
356
- return function (key) {
357
- var keyCV = parseToCV(key, foundMap.key);
358
- var mapGet = {
359
- contractAddress: contract.contractAddress,
360
- contractName: contract.contractName,
361
- map: foundMap,
362
- nativeKey: key,
363
- key: keyCV
364
- };
365
- return mapGet;
366
- };
367
- } // TODO: variables, tokens
368
-
369
-
370
- throw new Error("Invalid function call: no function exists for " + String(property));
371
- }
372
-
373
- var proxyHandler = {
374
- get: getter
375
- };
376
- var pureProxy = function pureProxy(target) {
377
- return new Proxy(target, proxyHandler);
378
- };
379
-
380
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
381
- try {
382
- var info = gen[key](arg);
383
- var value = info.value;
384
- } catch (error) {
385
- reject(error);
386
- return;
387
- }
388
-
389
- if (info.done) {
390
- resolve(value);
391
- } else {
392
- Promise.resolve(value).then(_next, _throw);
393
- }
394
- }
395
-
396
- function _asyncToGenerator(fn) {
397
- return function () {
398
- var self = this,
399
- args = arguments;
400
- return new Promise(function (resolve, reject) {
401
- var gen = fn.apply(self, args);
402
-
403
- function _next(value) {
404
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
405
- }
406
-
407
- function _throw(err) {
408
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
409
- }
410
-
411
- _next(undefined);
412
- });
413
- };
414
- }
415
-
416
- function createCommonjsModule(fn, module) {
417
- return module = { exports: {} }, fn(module, module.exports), module.exports;
418
- }
419
-
420
- var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
421
- /**
422
- * Copyright (c) 2014-present, Facebook, Inc.
423
- *
424
- * This source code is licensed under the MIT license found in the
425
- * LICENSE file in the root directory of this source tree.
426
- */
427
- var runtime = function (exports) {
428
-
429
- var Op = Object.prototype;
430
- var hasOwn = Op.hasOwnProperty;
431
- var undefined$1; // More compressible than void 0.
432
-
433
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
434
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
435
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
436
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
437
-
438
- function define(obj, key, value) {
439
- Object.defineProperty(obj, key, {
440
- value: value,
441
- enumerable: true,
442
- configurable: true,
443
- writable: true
444
- });
445
- return obj[key];
446
- }
447
-
448
- try {
449
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
450
- define({}, "");
451
- } catch (err) {
452
- define = function define(obj, key, value) {
453
- return obj[key] = value;
454
- };
455
- }
456
-
457
- function wrap(innerFn, outerFn, self, tryLocsList) {
458
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
459
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
460
- var generator = Object.create(protoGenerator.prototype);
461
- var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
462
- // .throw, and .return methods.
463
-
464
- generator._invoke = makeInvokeMethod(innerFn, self, context);
465
- return generator;
466
- }
467
-
468
- exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
469
- // record like context.tryEntries[i].completion. This interface could
470
- // have been (and was previously) designed to take a closure to be
471
- // invoked without arguments, but in all the cases we care about we
472
- // already have an existing method we want to call, so there's no need
473
- // to create a new function object. We can even get away with assuming
474
- // the method takes exactly one argument, since that happens to be true
475
- // in every case, so we don't have to touch the arguments object. The
476
- // only additional allocation required is the completion record, which
477
- // has a stable shape and so hopefully should be cheap to allocate.
478
-
479
- function tryCatch(fn, obj, arg) {
480
- try {
481
- return {
482
- type: "normal",
483
- arg: fn.call(obj, arg)
484
- };
485
- } catch (err) {
486
- return {
487
- type: "throw",
488
- arg: err
489
- };
490
- }
491
- }
492
-
493
- var GenStateSuspendedStart = "suspendedStart";
494
- var GenStateSuspendedYield = "suspendedYield";
495
- var GenStateExecuting = "executing";
496
- var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
497
- // breaking out of the dispatch switch statement.
498
-
499
- var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
500
- // .constructor.prototype properties for functions that return Generator
501
- // objects. For full spec compliance, you may wish to configure your
502
- // minifier not to mangle the names of these two functions.
503
-
504
- function Generator() {}
505
-
506
- function GeneratorFunction() {}
507
-
508
- function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
509
- // don't natively support it.
510
-
511
-
512
- var IteratorPrototype = {};
513
-
514
- IteratorPrototype[iteratorSymbol] = function () {
515
- return this;
516
- };
517
-
518
- var getProto = Object.getPrototypeOf;
519
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
520
-
521
- if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
522
- // This environment has a native %IteratorPrototype%; use it instead
523
- // of the polyfill.
524
- IteratorPrototype = NativeIteratorPrototype;
525
- }
526
-
527
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
528
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
529
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
530
- GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
531
- // Iterator interface in terms of a single ._invoke method.
532
-
533
- function defineIteratorMethods(prototype) {
534
- ["next", "throw", "return"].forEach(function (method) {
535
- define(prototype, method, function (arg) {
536
- return this._invoke(method, arg);
537
- });
538
- });
539
- }
540
-
541
- exports.isGeneratorFunction = function (genFun) {
542
- var ctor = typeof genFun === "function" && genFun.constructor;
543
- return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
544
- // do is to check its .name property.
545
- (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
546
- };
547
-
548
- exports.mark = function (genFun) {
549
- if (Object.setPrototypeOf) {
550
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
551
- } else {
552
- genFun.__proto__ = GeneratorFunctionPrototype;
553
- define(genFun, toStringTagSymbol, "GeneratorFunction");
554
- }
555
-
556
- genFun.prototype = Object.create(Gp);
557
- return genFun;
558
- }; // Within the body of any async function, `await x` is transformed to
559
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
560
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
561
- // meant to be awaited.
562
-
563
-
564
- exports.awrap = function (arg) {
565
- return {
566
- __await: arg
567
- };
568
- };
569
-
570
- function AsyncIterator(generator, PromiseImpl) {
571
- function invoke(method, arg, resolve, reject) {
572
- var record = tryCatch(generator[method], generator, arg);
573
-
574
- if (record.type === "throw") {
575
- reject(record.arg);
576
- } else {
577
- var result = record.arg;
578
- var value = result.value;
579
-
580
- if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
581
- return PromiseImpl.resolve(value.__await).then(function (value) {
582
- invoke("next", value, resolve, reject);
583
- }, function (err) {
584
- invoke("throw", err, resolve, reject);
585
- });
586
- }
587
-
588
- return PromiseImpl.resolve(value).then(function (unwrapped) {
589
- // When a yielded Promise is resolved, its final value becomes
590
- // the .value of the Promise<{value,done}> result for the
591
- // current iteration.
592
- result.value = unwrapped;
593
- resolve(result);
594
- }, function (error) {
595
- // If a rejected Promise was yielded, throw the rejection back
596
- // into the async generator function so it can be handled there.
597
- return invoke("throw", error, resolve, reject);
598
- });
599
- }
600
- }
601
-
602
- var previousPromise;
603
-
604
- function enqueue(method, arg) {
605
- function callInvokeWithMethodAndArg() {
606
- return new PromiseImpl(function (resolve, reject) {
607
- invoke(method, arg, resolve, reject);
608
- });
609
- }
610
-
611
- return previousPromise = // If enqueue has been called before, then we want to wait until
612
- // all previous Promises have been resolved before calling invoke,
613
- // so that results are always delivered in the correct order. If
614
- // enqueue has not been called before, then it is important to
615
- // call invoke immediately, without waiting on a callback to fire,
616
- // so that the async generator function has the opportunity to do
617
- // any necessary setup in a predictable way. This predictability
618
- // is why the Promise constructor synchronously invokes its
619
- // executor callback, and why async functions synchronously
620
- // execute code before the first await. Since we implement simple
621
- // async functions in terms of async generators, it is especially
622
- // important to get this right, even though it requires care.
623
- previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
624
- // invocations of the iterator.
625
- callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
626
- } // Define the unified helper method that is used to implement .next,
627
- // .throw, and .return (see defineIteratorMethods).
628
-
629
-
630
- this._invoke = enqueue;
631
- }
632
-
633
- defineIteratorMethods(AsyncIterator.prototype);
634
-
635
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
636
- return this;
637
- };
638
-
639
- exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
640
- // AsyncIterator objects; they just return a Promise for the value of
641
- // the final result produced by the iterator.
642
-
643
- exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
644
- if (PromiseImpl === void 0) PromiseImpl = Promise;
645
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
646
- return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
647
- : iter.next().then(function (result) {
648
- return result.done ? result.value : iter.next();
649
- });
650
- };
651
-
652
- function makeInvokeMethod(innerFn, self, context) {
653
- var state = GenStateSuspendedStart;
654
- return function invoke(method, arg) {
655
- if (state === GenStateExecuting) {
656
- throw new Error("Generator is already running");
657
- }
658
-
659
- if (state === GenStateCompleted) {
660
- if (method === "throw") {
661
- throw arg;
662
- } // Be forgiving, per 25.3.3.3.3 of the spec:
663
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
664
-
665
-
666
- return doneResult();
667
- }
668
-
669
- context.method = method;
670
- context.arg = arg;
671
-
672
- while (true) {
673
- var delegate = context.delegate;
674
-
675
- if (delegate) {
676
- var delegateResult = maybeInvokeDelegate(delegate, context);
677
-
678
- if (delegateResult) {
679
- if (delegateResult === ContinueSentinel) continue;
680
- return delegateResult;
681
- }
682
- }
683
-
684
- if (context.method === "next") {
685
- // Setting context._sent for legacy support of Babel's
686
- // function.sent implementation.
687
- context.sent = context._sent = context.arg;
688
- } else if (context.method === "throw") {
689
- if (state === GenStateSuspendedStart) {
690
- state = GenStateCompleted;
691
- throw context.arg;
692
- }
693
-
694
- context.dispatchException(context.arg);
695
- } else if (context.method === "return") {
696
- context.abrupt("return", context.arg);
697
- }
698
-
699
- state = GenStateExecuting;
700
- var record = tryCatch(innerFn, self, context);
701
-
702
- if (record.type === "normal") {
703
- // If an exception is thrown from innerFn, we leave state ===
704
- // GenStateExecuting and loop back for another invocation.
705
- state = context.done ? GenStateCompleted : GenStateSuspendedYield;
706
-
707
- if (record.arg === ContinueSentinel) {
708
- continue;
709
- }
710
-
711
- return {
712
- value: record.arg,
713
- done: context.done
714
- };
715
- } else if (record.type === "throw") {
716
- state = GenStateCompleted; // Dispatch the exception by looping back around to the
717
- // context.dispatchException(context.arg) call above.
718
-
719
- context.method = "throw";
720
- context.arg = record.arg;
721
- }
722
- }
723
- };
724
- } // Call delegate.iterator[context.method](context.arg) and handle the
725
- // result, either by returning a { value, done } result from the
726
- // delegate iterator, or by modifying context.method and context.arg,
727
- // setting context.delegate to null, and returning the ContinueSentinel.
728
-
729
-
730
- function maybeInvokeDelegate(delegate, context) {
731
- var method = delegate.iterator[context.method];
732
-
733
- if (method === undefined$1) {
734
- // A .throw or .return when the delegate iterator has no .throw
735
- // method always terminates the yield* loop.
736
- context.delegate = null;
737
-
738
- if (context.method === "throw") {
739
- // Note: ["return"] must be used for ES3 parsing compatibility.
740
- if (delegate.iterator["return"]) {
741
- // If the delegate iterator has a return method, give it a
742
- // chance to clean up.
743
- context.method = "return";
744
- context.arg = undefined$1;
745
- maybeInvokeDelegate(delegate, context);
746
-
747
- if (context.method === "throw") {
748
- // If maybeInvokeDelegate(context) changed context.method from
749
- // "return" to "throw", let that override the TypeError below.
750
- return ContinueSentinel;
751
- }
752
- }
753
-
754
- context.method = "throw";
755
- context.arg = new TypeError("The iterator does not provide a 'throw' method");
756
- }
757
-
758
- return ContinueSentinel;
759
- }
760
-
761
- var record = tryCatch(method, delegate.iterator, context.arg);
762
-
763
- if (record.type === "throw") {
764
- context.method = "throw";
765
- context.arg = record.arg;
766
- context.delegate = null;
767
- return ContinueSentinel;
768
- }
769
-
770
- var info = record.arg;
771
-
772
- if (!info) {
773
- context.method = "throw";
774
- context.arg = new TypeError("iterator result is not an object");
775
- context.delegate = null;
776
- return ContinueSentinel;
777
- }
778
-
779
- if (info.done) {
780
- // Assign the result of the finished delegate to the temporary
781
- // variable specified by delegate.resultName (see delegateYield).
782
- context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
783
-
784
- context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
785
- // exception, let the outer generator proceed normally. If
786
- // context.method was "next", forget context.arg since it has been
787
- // "consumed" by the delegate iterator. If context.method was
788
- // "return", allow the original .return call to continue in the
789
- // outer generator.
790
-
791
- if (context.method !== "return") {
792
- context.method = "next";
793
- context.arg = undefined$1;
794
- }
795
- } else {
796
- // Re-yield the result returned by the delegate method.
797
- return info;
798
- } // The delegate iterator is finished, so forget it and continue with
799
- // the outer generator.
800
-
801
-
802
- context.delegate = null;
803
- return ContinueSentinel;
804
- } // Define Generator.prototype.{next,throw,return} in terms of the
805
- // unified ._invoke helper method.
806
-
807
-
808
- defineIteratorMethods(Gp);
809
- define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
810
- // @@iterator function is called on it. Some browsers' implementations of the
811
- // iterator prototype chain incorrectly implement this, causing the Generator
812
- // object to not be returned from this call. This ensures that doesn't happen.
813
- // See https://github.com/facebook/regenerator/issues/274 for more details.
814
-
815
- Gp[iteratorSymbol] = function () {
816
- return this;
817
- };
818
-
819
- Gp.toString = function () {
820
- return "[object Generator]";
821
- };
822
-
823
- function pushTryEntry(locs) {
824
- var entry = {
825
- tryLoc: locs[0]
826
- };
827
-
828
- if (1 in locs) {
829
- entry.catchLoc = locs[1];
830
- }
831
-
832
- if (2 in locs) {
833
- entry.finallyLoc = locs[2];
834
- entry.afterLoc = locs[3];
835
- }
836
-
837
- this.tryEntries.push(entry);
838
- }
839
-
840
- function resetTryEntry(entry) {
841
- var record = entry.completion || {};
842
- record.type = "normal";
843
- delete record.arg;
844
- entry.completion = record;
845
- }
846
-
847
- function Context(tryLocsList) {
848
- // The root entry object (effectively a try statement without a catch
849
- // or a finally block) gives us a place to store values thrown from
850
- // locations where there is no enclosing try statement.
851
- this.tryEntries = [{
852
- tryLoc: "root"
853
- }];
854
- tryLocsList.forEach(pushTryEntry, this);
855
- this.reset(true);
856
- }
857
-
858
- exports.keys = function (object) {
859
- var keys = [];
860
-
861
- for (var key in object) {
862
- keys.push(key);
863
- }
864
-
865
- keys.reverse(); // Rather than returning an object with a next method, we keep
866
- // things simple and return the next function itself.
867
-
868
- return function next() {
869
- while (keys.length) {
870
- var key = keys.pop();
871
-
872
- if (key in object) {
873
- next.value = key;
874
- next.done = false;
875
- return next;
876
- }
877
- } // To avoid creating an additional object, we just hang the .value
878
- // and .done properties off the next function object itself. This
879
- // also ensures that the minifier will not anonymize the function.
880
-
881
-
882
- next.done = true;
883
- return next;
884
- };
885
- };
886
-
887
- function values(iterable) {
888
- if (iterable) {
889
- var iteratorMethod = iterable[iteratorSymbol];
890
-
891
- if (iteratorMethod) {
892
- return iteratorMethod.call(iterable);
893
- }
894
-
895
- if (typeof iterable.next === "function") {
896
- return iterable;
897
- }
898
-
899
- if (!isNaN(iterable.length)) {
900
- var i = -1,
901
- next = function next() {
902
- while (++i < iterable.length) {
903
- if (hasOwn.call(iterable, i)) {
904
- next.value = iterable[i];
905
- next.done = false;
906
- return next;
907
- }
908
- }
909
-
910
- next.value = undefined$1;
911
- next.done = true;
912
- return next;
913
- };
914
-
915
- return next.next = next;
916
- }
917
- } // Return an iterator with no values.
918
-
919
-
920
- return {
921
- next: doneResult
922
- };
923
- }
924
-
925
- exports.values = values;
926
-
927
- function doneResult() {
928
- return {
929
- value: undefined$1,
930
- done: true
931
- };
932
- }
933
-
934
- Context.prototype = {
935
- constructor: Context,
936
- reset: function reset(skipTempReset) {
937
- this.prev = 0;
938
- this.next = 0; // Resetting context._sent for legacy support of Babel's
939
- // function.sent implementation.
940
-
941
- this.sent = this._sent = undefined$1;
942
- this.done = false;
943
- this.delegate = null;
944
- this.method = "next";
945
- this.arg = undefined$1;
946
- this.tryEntries.forEach(resetTryEntry);
947
-
948
- if (!skipTempReset) {
949
- for (var name in this) {
950
- // Not sure about the optimal order of these conditions:
951
- if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
952
- this[name] = undefined$1;
953
- }
954
- }
955
- }
956
- },
957
- stop: function stop() {
958
- this.done = true;
959
- var rootEntry = this.tryEntries[0];
960
- var rootRecord = rootEntry.completion;
961
-
962
- if (rootRecord.type === "throw") {
963
- throw rootRecord.arg;
964
- }
965
-
966
- return this.rval;
967
- },
968
- dispatchException: function dispatchException(exception) {
969
- if (this.done) {
970
- throw exception;
971
- }
972
-
973
- var context = this;
974
-
975
- function handle(loc, caught) {
976
- record.type = "throw";
977
- record.arg = exception;
978
- context.next = loc;
979
-
980
- if (caught) {
981
- // If the dispatched exception was caught by a catch block,
982
- // then let that catch block handle the exception normally.
983
- context.method = "next";
984
- context.arg = undefined$1;
985
- }
986
-
987
- return !!caught;
988
- }
989
-
990
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
991
- var entry = this.tryEntries[i];
992
- var record = entry.completion;
993
-
994
- if (entry.tryLoc === "root") {
995
- // Exception thrown outside of any try block that could handle
996
- // it, so set the completion value of the entire function to
997
- // throw the exception.
998
- return handle("end");
999
- }
1000
-
1001
- if (entry.tryLoc <= this.prev) {
1002
- var hasCatch = hasOwn.call(entry, "catchLoc");
1003
- var hasFinally = hasOwn.call(entry, "finallyLoc");
1004
-
1005
- if (hasCatch && hasFinally) {
1006
- if (this.prev < entry.catchLoc) {
1007
- return handle(entry.catchLoc, true);
1008
- } else if (this.prev < entry.finallyLoc) {
1009
- return handle(entry.finallyLoc);
1010
- }
1011
- } else if (hasCatch) {
1012
- if (this.prev < entry.catchLoc) {
1013
- return handle(entry.catchLoc, true);
1014
- }
1015
- } else if (hasFinally) {
1016
- if (this.prev < entry.finallyLoc) {
1017
- return handle(entry.finallyLoc);
1018
- }
1019
- } else {
1020
- throw new Error("try statement without catch or finally");
1021
- }
1022
- }
1023
- }
1024
- },
1025
- abrupt: function abrupt(type, arg) {
1026
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1027
- var entry = this.tryEntries[i];
1028
-
1029
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
1030
- var finallyEntry = entry;
1031
- break;
1032
- }
1033
- }
1034
-
1035
- if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
1036
- // Ignore the finally entry if control is not jumping to a
1037
- // location outside the try/catch block.
1038
- finallyEntry = null;
1039
- }
1040
-
1041
- var record = finallyEntry ? finallyEntry.completion : {};
1042
- record.type = type;
1043
- record.arg = arg;
1044
-
1045
- if (finallyEntry) {
1046
- this.method = "next";
1047
- this.next = finallyEntry.finallyLoc;
1048
- return ContinueSentinel;
1049
- }
1050
-
1051
- return this.complete(record);
1052
- },
1053
- complete: function complete(record, afterLoc) {
1054
- if (record.type === "throw") {
1055
- throw record.arg;
1056
- }
1057
-
1058
- if (record.type === "break" || record.type === "continue") {
1059
- this.next = record.arg;
1060
- } else if (record.type === "return") {
1061
- this.rval = this.arg = record.arg;
1062
- this.method = "return";
1063
- this.next = "end";
1064
- } else if (record.type === "normal" && afterLoc) {
1065
- this.next = afterLoc;
1066
- }
1067
-
1068
- return ContinueSentinel;
1069
- },
1070
- finish: function finish(finallyLoc) {
1071
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1072
- var entry = this.tryEntries[i];
1073
-
1074
- if (entry.finallyLoc === finallyLoc) {
1075
- this.complete(entry.completion, entry.afterLoc);
1076
- resetTryEntry(entry);
1077
- return ContinueSentinel;
1078
- }
1079
- }
1080
- },
1081
- "catch": function _catch(tryLoc) {
1082
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1083
- var entry = this.tryEntries[i];
1084
-
1085
- if (entry.tryLoc === tryLoc) {
1086
- var record = entry.completion;
1087
-
1088
- if (record.type === "throw") {
1089
- var thrown = record.arg;
1090
- resetTryEntry(entry);
1091
- }
1092
-
1093
- return thrown;
1094
- }
1095
- } // The context.catch method must only be called with a location
1096
- // argument that corresponds to a known catch block.
1097
-
1098
-
1099
- throw new Error("illegal catch attempt");
1100
- },
1101
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
1102
- this.delegate = {
1103
- iterator: values(iterable),
1104
- resultName: resultName,
1105
- nextLoc: nextLoc
1106
- };
1107
-
1108
- if (this.method === "next") {
1109
- // Deliberately forget the last sent value so that we don't
1110
- // accidentally pass it on to the delegate.
1111
- this.arg = undefined$1;
1112
- }
1113
-
1114
- return ContinueSentinel;
1115
- }
1116
- }; // Regardless of whether this script is executing as a CommonJS module
1117
- // or not, return the runtime object so that we can declare the variable
1118
- // regeneratorRuntime in the outer scope, which allows this module to be
1119
- // injected easily by `bin/regenerator --include-runtime script.js`.
1120
-
1121
- return exports;
1122
- }( // If this script is executing as a CommonJS module, use module.exports
1123
- // as the regeneratorRuntime namespace. Otherwise create a new empty
1124
- // object. Either way, the resulting object will be used to initialize
1125
- // the regeneratorRuntime variable at the top of this file.
1126
- module.exports );
1127
-
1128
- try {
1129
- regeneratorRuntime = runtime;
1130
- } catch (accidentalStrictMode) {
1131
- // This module should not be running in strict mode, so the above
1132
- // assignment should always work unless something is misconfigured. Just
1133
- // in case runtime.js accidentally runs in strict mode, we can escape
1134
- // strict mode using a global Function call. This could conceivably fail
1135
- // if a Content Security Policy forbids using Function, but in that case
1136
- // the proper solution is to fix the accidental strict mode problem. If
1137
- // you've misconfigured your bundler to force strict mode and applied a
1138
- // CSP to forbid Function, and you're not willing to fix either of those
1139
- // problems, please detail your unique predicament in a GitHub issue.
1140
- Function("r", "regeneratorRuntime = r")(runtime);
1141
- }
1142
- });
1143
-
1144
- var BaseProvider = /*#__PURE__*/function () {
1145
- function BaseProvider() {}
1146
-
1147
- var _proto = BaseProvider.prototype;
1148
-
1149
- // eslint-disable-next-line @typescript-eslint/require-await
1150
- _proto.callReadOnly =
1151
- /*#__PURE__*/
1152
- function () {
1153
- var _callReadOnly = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(func, args) {
1154
- return runtime_1.wrap(function _callee$(_context) {
1155
- while (1) {
1156
- switch (_context.prev = _context.next) {
1157
- case 0:
1158
- throw new Error('Not implemented');
1159
-
1160
- case 1:
1161
- case "end":
1162
- return _context.stop();
1163
- }
1164
- }
1165
- }, _callee);
1166
- }));
1167
-
1168
- function callReadOnly(_x, _x2) {
1169
- return _callReadOnly.apply(this, arguments);
1170
- }
1171
-
1172
- return callReadOnly;
1173
- }();
1174
-
1175
- _proto.callPublic = function callPublic(func, args) {
1176
- throw new Error('Not implemented');
1177
- };
1178
-
1179
- return BaseProvider;
1180
- }();
1181
-
1182
- function ro(_x, _x2) {
1183
- return _ro.apply(this, arguments);
1184
- }
1185
-
1186
- function _ro() {
1187
- _ro = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(tx, options) {
1188
- var urlBase, url, body, response, msg, parsed;
1189
- return runtime_1.wrap(function _callee$(_context) {
1190
- while (1) {
1191
- switch (_context.prev = _context.next) {
1192
- case 0:
1193
- urlBase = options.network.getReadOnlyFunctionCallApiUrl(tx.contractAddress, tx.contractName, tx["function"].name);
1194
- url = urlBase + "?tip=latest";
1195
- body = JSON.stringify({
1196
- sender: tx.contractAddress,
1197
- arguments: tx.functionArgs.map(function (arg) {
1198
- return typeof arg === 'string' ? arg : cvToHex(arg);
1199
- })
1200
- });
1201
- _context.next = 5;
1202
- return fetchPrivate(url, {
1203
- method: 'POST',
1204
- body: body,
1205
- headers: {
1206
- 'Content-Type': 'application/json'
1207
- }
1208
- });
1209
-
1210
- case 5:
1211
- response = _context.sent;
1212
-
1213
- if (response.ok) {
1214
- _context.next = 17;
1215
- break;
1216
- }
1217
-
1218
- msg = '';
1219
- _context.prev = 8;
1220
- _context.next = 11;
1221
- return response.text();
1222
-
1223
- case 11:
1224
- msg = _context.sent;
1225
- _context.next = 16;
1226
- break;
1227
-
1228
- case 14:
1229
- _context.prev = 14;
1230
- _context.t0 = _context["catch"](8);
1231
-
1232
- case 16:
1233
- throw new Error("Error calling read-only function. Response " + response.status + ": " + response.statusText + ". Attempted to fetch " + url + " and failed with the message: \"" + msg + "\"");
1234
-
1235
- case 17:
1236
- _context.t1 = parseReadOnlyResponse;
1237
- _context.next = 20;
1238
- return response.json();
1239
-
1240
- case 20:
1241
- _context.t2 = _context.sent;
1242
- parsed = (0, _context.t1)(_context.t2);
1243
- return _context.abrupt("return", cvToValue(parsed, true));
1244
-
1245
- case 23:
1246
- case "end":
1247
- return _context.stop();
1248
- }
1249
- }
1250
- }, _callee, null, [[8, 14]]);
1251
- }));
1252
- return _ro.apply(this, arguments);
1253
- }
1254
-
1255
- function roOk(_x3, _x4) {
1256
- return _roOk.apply(this, arguments);
1257
- }
1258
-
1259
- function _roOk() {
1260
- _roOk = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(tx, options) {
1261
- var result;
1262
- return runtime_1.wrap(function _callee2$(_context2) {
1263
- while (1) {
1264
- switch (_context2.prev = _context2.next) {
1265
- case 0:
1266
- _context2.next = 2;
1267
- return ro(tx, options);
1268
-
1269
- case 2:
1270
- result = _context2.sent;
1271
- return _context2.abrupt("return", expectOk(result));
1272
-
1273
- case 4:
1274
- case "end":
1275
- return _context2.stop();
1276
- }
1277
- }
1278
- }, _callee2);
1279
- }));
1280
- return _roOk.apply(this, arguments);
1281
- }
1282
-
1283
- function roErr(_x5, _x6) {
1284
- return _roErr.apply(this, arguments);
1285
- }
1286
-
1287
- function _roErr() {
1288
- _roErr = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(tx, options) {
1289
- var result;
1290
- return runtime_1.wrap(function _callee3$(_context3) {
1291
- while (1) {
1292
- switch (_context3.prev = _context3.next) {
1293
- case 0:
1294
- _context3.next = 2;
1295
- return ro(tx, options);
1296
-
1297
- case 2:
1298
- result = _context3.sent;
1299
- return _context3.abrupt("return", expectErr(result));
1300
-
1301
- case 4:
1302
- case "end":
1303
- return _context3.stop();
1304
- }
1305
- }
1306
- }, _callee3);
1307
- }));
1308
- return _roErr.apply(this, arguments);
1309
- }
1310
-
1311
- function fetchMapGet(_x7, _x8) {
1312
- return _fetchMapGet.apply(this, arguments);
1313
- }
1314
-
1315
- function _fetchMapGet() {
1316
- _fetchMapGet = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(map, options) {
1317
- var lookupKey, response, valueCV;
1318
- return runtime_1.wrap(function _callee4$(_context4) {
1319
- while (1) {
1320
- switch (_context4.prev = _context4.next) {
1321
- case 0:
1322
- lookupKey = cvToHex(map.key);
1323
- _context4.next = 3;
1324
- return fetchContractDataMapEntry({
1325
- contract_address: map.contractAddress,
1326
- contract_name: map.contractName,
1327
- map_name: map.map.name,
1328
- lookup_key: lookupKey,
1329
- tip: 'latest',
1330
- url: options.network.getCoreApiUrl(),
1331
- proof: 0
1332
- });
1333
-
1334
- case 3:
1335
- response = _context4.sent;
1336
- valueCV = hexToCV(response.data);
1337
- return _context4.abrupt("return", cvToValue(valueCV, true));
1338
-
1339
- case 6:
1340
- case "end":
1341
- return _context4.stop();
1342
- }
1343
- }
1344
- }, _callee4);
1345
- }));
1346
- return _fetchMapGet.apply(this, arguments);
1347
- }
1348
-
1349
- function broadcast(_x9, _x10) {
1350
- return _broadcast.apply(this, arguments);
1351
- }
1352
-
1353
- function _broadcast() {
1354
- _broadcast = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(transaction, options) {
1355
- var result;
1356
- return runtime_1.wrap(function _callee5$(_context5) {
1357
- while (1) {
1358
- switch (_context5.prev = _context5.next) {
1359
- case 0:
1360
- _context5.next = 2;
1361
- return broadcastTransaction(transaction, options.network);
1362
-
1363
- case 2:
1364
- result = _context5.sent;
1365
-
1366
- if (!('error' in result)) {
1367
- _context5.next = 7;
1368
- break;
1369
- }
1370
-
1371
- throw new Error("Error broadcasting tx: " + result.error + " - " + result.reason + " - " + result.reason_data);
1372
-
1373
- case 7:
1374
- return _context5.abrupt("return", {
1375
- txId: result.txid,
1376
- stacksTransaction: transaction
1377
- });
1378
-
1379
- case 8:
1380
- case "end":
1381
- return _context5.stop();
1382
- }
1383
- }
1384
- }, _callee5);
1385
- }));
1386
- return _broadcast.apply(this, arguments);
1387
- }
1388
-
1389
- var makeHandler = function makeHandler(provider) {
1390
- var handler = {
1391
- get: function get(contract, property) {
1392
- var foundFunction = contract.functions.find(function (func) {
1393
- return toCamelCase(func.name) === property;
1394
- });
1395
-
1396
- if (foundFunction) {
1397
- if (foundFunction.access === 'read_only') {
1398
- return function () {
1399
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1400
- args[_key] = arguments[_key];
1401
- }
1402
-
1403
- return provider.callReadOnly(foundFunction, args);
1404
- };
1405
- } else if (foundFunction.access === 'public') {
1406
- return function () {
1407
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1408
- args[_key2] = arguments[_key2];
1409
- }
1410
-
1411
- return provider.callPublic(foundFunction, args);
1412
- };
1413
- }
1414
- }
1415
-
1416
- return null;
1417
- }
1418
- };
1419
- return handler;
1420
- };
1421
-
1422
- var proxy = function proxy(target, provider) {
1423
- return new Proxy(target, makeHandler(provider));
1424
- };
1425
-
1426
- export { BaseProvider, CoreNodeEventType, MAINNET_BURN_ADDRESS, TESTNET_BURN_ADDRESS, bootContractIdentifier, broadcast, cvToString, cvToValue, expectErr, expectOk, fetchMapGet, getContractIdentifier, getContractNameFromPath, getContractPrincipalCV, hexToCvValue, makeContracts, parseToCV, proxy, pureProxy, ro, roErr, roOk, toCamelCase };
1427
- //# sourceMappingURL=core.esm.js.map