@fastnear/api 0.9.5 → 0.9.7

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.
@@ -1,5 +1,5 @@
1
- /* ⋈ 🏃🏻💨 FastNEAR API - CJS (@fastnear/api version 0.9.5) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.5 */
1
+ /* ⋈ 🏃🏻💨 FastNEAR API - CJS (@fastnear/api version 0.9.7) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.7 */
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -15,9 +15,9 @@ var __copyProps = (to, from, except, desc) => {
15
15
  };
16
16
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var src_exports = {};
19
- module.exports = __toCommonJS(src_exports);
20
- __reExport(src_exports, require("./near.js"), module.exports);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./near.js"), module.exports);
21
21
  // Annotate the CommonJS export names for ESM import in node:
22
22
  0 && (module.exports = {
23
23
  ...require("./near.js")
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// See tsup.config.ts for additional banner/footer js\nexport * from \"./near.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AACA,wBAAc,sBADd;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// See tsup.config.ts for additional banner/footer js\nexport * from \"./near.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AACA,0BAAc,sBADd;","names":[]}
package/dist/cjs/near.cjs CHANGED
@@ -1,5 +1,5 @@
1
- /* ⋈ 🏃🏻💨 FastNEAR API - CJS (@fastnear/api version 0.9.5) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.5 */
1
+ /* ⋈ 🏃🏻💨 FastNEAR API - CJS (@fastnear/api version 0.9.7) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.7 */
3
3
  "use strict";
4
4
  var __create = Object.create;
5
5
  var __defProp = Object.defineProperty;
@@ -1,5 +1,5 @@
1
- /* ⋈ 🏃🏻💨 FastNEAR API - CJS (@fastnear/api version 0.9.5) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.5 */
1
+ /* ⋈ 🏃🏻💨 FastNEAR API - CJS (@fastnear/api version 0.9.7) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.7 */
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* ⋈ 🏃🏻💨 FastNEAR API - ESM (@fastnear/api version 0.9.5) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.5 */
1
+ /* ⋈ 🏃🏻💨 FastNEAR API - ESM (@fastnear/api version 0.9.7) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.7 */
3
3
  export * from "./near.js";
4
4
  //# sourceMappingURL=index.js.map
package/dist/esm/near.js CHANGED
@@ -1,5 +1,5 @@
1
- /* ⋈ 🏃🏻💨 FastNEAR API - ESM (@fastnear/api version 0.9.5) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.5 */
1
+ /* ⋈ 🏃🏻💨 FastNEAR API - ESM (@fastnear/api version 0.9.7) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.7 */
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
5
  import Big from "big.js";
package/dist/esm/state.js CHANGED
@@ -1,5 +1,5 @@
1
- /* ⋈ 🏃🏻💨 FastNEAR API - ESM (@fastnear/api version 0.9.5) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.5 */
1
+ /* ⋈ 🏃🏻💨 FastNEAR API - ESM (@fastnear/api version 0.9.7) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.7 */
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
5
  import {
@@ -1,5 +1,5 @@
1
- /* ⋈ 🏃🏻💨 FastNEAR API - IIFE/UMD (@fastnear/api version 0.9.5) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.5 */
1
+ /* ⋈ 🏃🏻💨 FastNEAR API - IIFE/UMD (@fastnear/api version 0.9.7) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.7 */
3
3
  "use strict";
4
4
  var near = (() => {
5
5
  var __defProp = Object.defineProperty;
@@ -579,7 +579,7 @@ var near = (() => {
579
579
  txToJsonStringified: () => txToJsonStringified
580
580
  });
581
581
 
582
- // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/_assert.js
582
+ // ../../node_modules/@noble/hashes/esm/_assert.js
583
583
  function isBytes(a) {
584
584
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
585
585
  }
@@ -607,11 +607,18 @@ var near = (() => {
607
607
  }
608
608
  __name(aoutput, "aoutput");
609
609
 
610
- // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/crypto.js
610
+ // ../../node_modules/@noble/hashes/esm/crypto.js
611
611
  var crypto2 = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
612
612
 
613
- // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/utils.js
614
- var createView = /* @__PURE__ */ __name((arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength), "createView");
613
+ // ../../node_modules/@noble/hashes/esm/utils.js
614
+ function createView(arr) {
615
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
616
+ }
617
+ __name(createView, "createView");
618
+ function rotr(word, shift) {
619
+ return word << 32 - shift | word >>> shift;
620
+ }
621
+ __name(rotr, "rotr");
615
622
  function utf8ToBytes(str) {
616
623
  if (typeof str !== "string")
617
624
  throw new Error("utf8ToBytes expected string, got " + typeof str);
@@ -654,7 +661,7 @@ var near = (() => {
654
661
  }
655
662
  __name(randomBytes, "randomBytes");
656
663
 
657
- // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/_md.js
664
+ // ../../node_modules/@noble/hashes/esm/_md.js
658
665
  function setBigUint64(view2, byteOffset, value, isLE) {
659
666
  if (typeof view2.setBigUint64 === "function")
660
667
  return view2.setBigUint64(byteOffset, value, isLE);
@@ -668,6 +675,14 @@ var near = (() => {
668
675
  view2.setUint32(byteOffset + l, wl, isLE);
669
676
  }
670
677
  __name(setBigUint64, "setBigUint64");
678
+ function Chi(a, b, c) {
679
+ return a & b ^ ~a & c;
680
+ }
681
+ __name(Chi, "Chi");
682
+ function Maj(a, b, c) {
683
+ return a & b ^ a & c ^ b & c;
684
+ }
685
+ __name(Maj, "Maj");
671
686
  var HashMD = class extends Hash {
672
687
  static {
673
688
  __name(this, "HashMD");
@@ -758,7 +773,7 @@ var near = (() => {
758
773
  }
759
774
  };
760
775
 
761
- // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/_u64.js
776
+ // ../../node_modules/@noble/hashes/esm/_u64.js
762
777
  var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
763
778
  var _32n = /* @__PURE__ */ BigInt(32);
764
779
  function fromBig(n, le = false) {
@@ -827,7 +842,7 @@ var near = (() => {
827
842
  };
828
843
  var u64_default = u64;
829
844
 
830
- // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/sha512.js
845
+ // ../../node_modules/@noble/hashes/esm/sha512.js
831
846
  var [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64_default.split([
832
847
  "0x428a2f98d728ae22",
833
848
  "0x7137449123ef65cd",
@@ -1427,6 +1442,7 @@ var near = (() => {
1427
1442
  let sqrtP;
1428
1443
  const f = Object.freeze({
1429
1444
  ORDER,
1445
+ isLE,
1430
1446
  BITS,
1431
1447
  BYTES,
1432
1448
  MASK: bitMask(BITS),
@@ -2193,175 +2209,6 @@ var near = (() => {
2193
2209
  }))();
2194
2210
  var ed25519 = /* @__PURE__ */ (() => twistedEdwards(ed25519Defaults))();
2195
2211
 
2196
- // ../../node_modules/@noble/hashes/esm/_assert.js
2197
- function isBytes3(a) {
2198
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
2199
- }
2200
- __name(isBytes3, "isBytes");
2201
- function abytes3(b, ...lengths) {
2202
- if (!isBytes3(b))
2203
- throw new Error("Uint8Array expected");
2204
- if (lengths.length > 0 && !lengths.includes(b.length))
2205
- throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
2206
- }
2207
- __name(abytes3, "abytes");
2208
- function aexists2(instance, checkFinished = true) {
2209
- if (instance.destroyed)
2210
- throw new Error("Hash instance has been destroyed");
2211
- if (checkFinished && instance.finished)
2212
- throw new Error("Hash#digest() has already been called");
2213
- }
2214
- __name(aexists2, "aexists");
2215
- function aoutput2(out, instance) {
2216
- abytes3(out);
2217
- const min = instance.outputLen;
2218
- if (out.length < min) {
2219
- throw new Error("digestInto() expects output buffer of length at least " + min);
2220
- }
2221
- }
2222
- __name(aoutput2, "aoutput");
2223
-
2224
- // ../../node_modules/@noble/hashes/esm/utils.js
2225
- var createView2 = /* @__PURE__ */ __name((arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength), "createView");
2226
- var rotr = /* @__PURE__ */ __name((word, shift) => word << 32 - shift | word >>> shift, "rotr");
2227
- function utf8ToBytes2(str) {
2228
- if (typeof str !== "string")
2229
- throw new Error("utf8ToBytes expected string, got " + typeof str);
2230
- return new Uint8Array(new TextEncoder().encode(str));
2231
- }
2232
- __name(utf8ToBytes2, "utf8ToBytes");
2233
- function toBytes2(data) {
2234
- if (typeof data === "string")
2235
- data = utf8ToBytes2(data);
2236
- abytes3(data);
2237
- return data;
2238
- }
2239
- __name(toBytes2, "toBytes");
2240
- var Hash2 = class {
2241
- static {
2242
- __name(this, "Hash");
2243
- }
2244
- // Safe version that clones internal state
2245
- clone() {
2246
- return this._cloneInto();
2247
- }
2248
- };
2249
- function wrapConstructor2(hashCons) {
2250
- const hashC = /* @__PURE__ */ __name((msg) => hashCons().update(toBytes2(msg)).digest(), "hashC");
2251
- const tmp = hashCons();
2252
- hashC.outputLen = tmp.outputLen;
2253
- hashC.blockLen = tmp.blockLen;
2254
- hashC.create = () => hashCons();
2255
- return hashC;
2256
- }
2257
- __name(wrapConstructor2, "wrapConstructor");
2258
-
2259
- // ../../node_modules/@noble/hashes/esm/_md.js
2260
- function setBigUint642(view2, byteOffset, value, isLE) {
2261
- if (typeof view2.setBigUint64 === "function")
2262
- return view2.setBigUint64(byteOffset, value, isLE);
2263
- const _32n2 = BigInt(32);
2264
- const _u32_max = BigInt(4294967295);
2265
- const wh = Number(value >> _32n2 & _u32_max);
2266
- const wl = Number(value & _u32_max);
2267
- const h = isLE ? 4 : 0;
2268
- const l = isLE ? 0 : 4;
2269
- view2.setUint32(byteOffset + h, wh, isLE);
2270
- view2.setUint32(byteOffset + l, wl, isLE);
2271
- }
2272
- __name(setBigUint642, "setBigUint64");
2273
- var Chi = /* @__PURE__ */ __name((a, b, c) => a & b ^ ~a & c, "Chi");
2274
- var Maj = /* @__PURE__ */ __name((a, b, c) => a & b ^ a & c ^ b & c, "Maj");
2275
- var HashMD2 = class extends Hash2 {
2276
- static {
2277
- __name(this, "HashMD");
2278
- }
2279
- constructor(blockLen, outputLen, padOffset, isLE) {
2280
- super();
2281
- this.blockLen = blockLen;
2282
- this.outputLen = outputLen;
2283
- this.padOffset = padOffset;
2284
- this.isLE = isLE;
2285
- this.finished = false;
2286
- this.length = 0;
2287
- this.pos = 0;
2288
- this.destroyed = false;
2289
- this.buffer = new Uint8Array(blockLen);
2290
- this.view = createView2(this.buffer);
2291
- }
2292
- update(data) {
2293
- aexists2(this);
2294
- const { view: view2, buffer, blockLen } = this;
2295
- data = toBytes2(data);
2296
- const len = data.length;
2297
- for (let pos = 0; pos < len; ) {
2298
- const take = Math.min(blockLen - this.pos, len - pos);
2299
- if (take === blockLen) {
2300
- const dataView = createView2(data);
2301
- for (; blockLen <= len - pos; pos += blockLen)
2302
- this.process(dataView, pos);
2303
- continue;
2304
- }
2305
- buffer.set(data.subarray(pos, pos + take), this.pos);
2306
- this.pos += take;
2307
- pos += take;
2308
- if (this.pos === blockLen) {
2309
- this.process(view2, 0);
2310
- this.pos = 0;
2311
- }
2312
- }
2313
- this.length += data.length;
2314
- this.roundClean();
2315
- return this;
2316
- }
2317
- digestInto(out) {
2318
- aexists2(this);
2319
- aoutput2(out, this);
2320
- this.finished = true;
2321
- const { buffer, view: view2, blockLen, isLE } = this;
2322
- let { pos } = this;
2323
- buffer[pos++] = 128;
2324
- this.buffer.subarray(pos).fill(0);
2325
- if (this.padOffset > blockLen - pos) {
2326
- this.process(view2, 0);
2327
- pos = 0;
2328
- }
2329
- for (let i = pos; i < blockLen; i++)
2330
- buffer[i] = 0;
2331
- setBigUint642(view2, blockLen - 8, BigInt(this.length * 8), isLE);
2332
- this.process(view2, 0);
2333
- const oview = createView2(out);
2334
- const len = this.outputLen;
2335
- if (len % 4)
2336
- throw new Error("_sha2: outputLen should be aligned to 32bit");
2337
- const outLen = len / 4;
2338
- const state2 = this.get();
2339
- if (outLen > state2.length)
2340
- throw new Error("_sha2: outputLen bigger than state");
2341
- for (let i = 0; i < outLen; i++)
2342
- oview.setUint32(4 * i, state2[i], isLE);
2343
- }
2344
- digest() {
2345
- const { buffer, outputLen } = this;
2346
- this.digestInto(buffer);
2347
- const res = buffer.slice(0, outputLen);
2348
- this.destroy();
2349
- return res;
2350
- }
2351
- _cloneInto(to) {
2352
- to || (to = new this.constructor());
2353
- to.set(...this.get());
2354
- const { blockLen, buffer, length, finished, destroyed, pos } = this;
2355
- to.length = length;
2356
- to.pos = pos;
2357
- to.finished = finished;
2358
- to.destroyed = destroyed;
2359
- if (length % blockLen)
2360
- to.buffer.set(buffer);
2361
- return to;
2362
- }
2363
- };
2364
-
2365
2212
  // ../../node_modules/@noble/hashes/esm/sha256.js
2366
2213
  var SHA256_K = /* @__PURE__ */ new Uint32Array([
2367
2214
  1116352408,
@@ -2440,7 +2287,7 @@ var near = (() => {
2440
2287
  1541459225
2441
2288
  ]);
2442
2289
  var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
2443
- var SHA256 = class extends HashMD2 {
2290
+ var SHA256 = class extends HashMD {
2444
2291
  static {
2445
2292
  __name(this, "SHA256");
2446
2293
  }
@@ -2513,7 +2360,7 @@ var near = (() => {
2513
2360
  this.buffer.fill(0);
2514
2361
  }
2515
2362
  };
2516
- var sha256 = /* @__PURE__ */ wrapConstructor2(() => new SHA256());
2363
+ var sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
2517
2364
 
2518
2365
  // ../../node_modules/base58-js/base58_chars.mjs
2519
2366
  var base58_chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
@@ -3611,21 +3458,17 @@ var near = (() => {
3611
3458
  case "DeployContract": {
3612
3459
  return {
3613
3460
  deployContract: {
3614
- code: fromBase64(action.codeBase64)
3461
+ code: base64ToBytes(action.codeBase64)
3615
3462
  }
3616
3463
  };
3617
3464
  }
3618
3465
  case "FunctionCall": {
3619
- const argsAsString = JSON.stringify(action.args);
3620
- const argsEncoded = new TextEncoder().encode(argsAsString);
3621
- const defaultGas = BigInt("225000000000000");
3622
- const defaultDeposit = BigInt("0");
3623
3466
  return {
3624
3467
  functionCall: {
3625
3468
  methodName: action.methodName,
3626
- args: argsEncoded,
3627
- gas: BigInt(action.gas ?? defaultGas),
3628
- deposit: BigInt(action.deposit ?? defaultDeposit)
3469
+ args: action.argsBase64 !== null && action.argsBase64 !== void 0 ? base64ToBytes(action.argsBase64) : new TextEncoder().encode(JSON.stringify(action.args)),
3470
+ gas: BigInt(action.gas ?? "300000000000000"),
3471
+ deposit: BigInt(action.deposit ?? "0")
3629
3472
  }
3630
3473
  };
3631
3474
  }
@@ -4518,9 +4361,6 @@ message: ${decodedErrMsg}`));
4518
4361
 
4519
4362
  @noble/curves/esm/ed25519.js:
4520
4363
  (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
4521
-
4522
- @noble/hashes/esm/utils.js:
4523
- (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
4524
4364
  */
4525
4365
 
4526
4366
  try {