@fastnear/api 0.9.10 → 0.9.11

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.10) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.10 */
1
+ /* ⋈ 🏃🏻💨 FastNear API - CJS (@fastnear/api version 0.9.11) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.11 */
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
package/dist/cjs/near.cjs CHANGED
@@ -1,5 +1,5 @@
1
- /* ⋈ 🏃🏻💨 FastNear API - CJS (@fastnear/api version 0.9.10) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.10 */
1
+ /* ⋈ 🏃🏻💨 FastNear API - CJS (@fastnear/api version 0.9.11) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.11 */
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.10) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.10 */
1
+ /* ⋈ 🏃🏻💨 FastNear API - CJS (@fastnear/api version 0.9.11) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.11 */
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.10) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.10 */
1
+ /* ⋈ 🏃🏻💨 FastNear API - ESM (@fastnear/api version 0.9.11) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.11 */
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.10) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.10 */
1
+ /* ⋈ 🏃🏻💨 FastNear API - ESM (@fastnear/api version 0.9.11) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.11 */
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.10) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.10 */
1
+ /* ⋈ 🏃🏻💨 FastNear API - ESM (@fastnear/api version 0.9.11) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.11 */
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.10) */
2
- /* https://www.npmjs.com/package/@fastnear/api/v/0.9.10 */
1
+ /* ⋈ 🏃🏻💨 FastNear API - IIFE/UMD (@fastnear/api version 0.9.11) */
2
+ /* https://www.npmjs.com/package/@fastnear/api/v/0.9.11 */
3
3
  "use strict";
4
4
  var near = (() => {
5
5
  var __defProp = Object.defineProperty;
@@ -581,7 +581,7 @@ var near = (() => {
581
581
  txToJsonStringified: () => txToJsonStringified
582
582
  });
583
583
 
584
- // ../utils/node_modules/@noble/hashes/utils.js
584
+ // ../../node_modules/@noble/hashes/utils.js
585
585
  function isBytes(a) {
586
586
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
587
587
  }
@@ -721,7 +721,7 @@ var near = (() => {
721
721
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
722
722
  }), "oidNist");
723
723
 
724
- // ../utils/node_modules/@noble/hashes/_md.js
724
+ // ../../node_modules/@noble/hashes/_md.js
725
725
  function Chi(a, b, c) {
726
726
  return a & b ^ ~a & c;
727
727
  }
@@ -857,7 +857,7 @@ var near = (() => {
857
857
  327033209
858
858
  ]);
859
859
 
860
- // ../utils/node_modules/@noble/hashes/_u64.js
860
+ // ../../node_modules/@noble/hashes/_u64.js
861
861
  var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
862
862
  var _32n = /* @__PURE__ */ BigInt(32);
863
863
  function fromBig(n, le = false) {
@@ -895,7 +895,7 @@ var near = (() => {
895
895
  var add5L = /* @__PURE__ */ __name((Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0), "add5L");
896
896
  var add5H = /* @__PURE__ */ __name((low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0, "add5H");
897
897
 
898
- // ../utils/node_modules/@noble/hashes/sha2.js
898
+ // ../../node_modules/@noble/hashes/sha2.js
899
899
  var SHA256_K = /* @__PURE__ */ Uint32Array.from([
900
900
  1116352408,
901
901
  1899447441,
@@ -1263,7 +1263,7 @@ var near = (() => {
1263
1263
  /* @__PURE__ */ oidNist(3)
1264
1264
  );
1265
1265
 
1266
- // ../utils/node_modules/@noble/curves/utils.js
1266
+ // ../../node_modules/@noble/curves/utils.js
1267
1267
  var _0n = /* @__PURE__ */ BigInt(0);
1268
1268
  var _1n = /* @__PURE__ */ BigInt(1);
1269
1269
  function abool(value, title = "") {
@@ -1355,7 +1355,7 @@ var near = (() => {
1355
1355
  }
1356
1356
  __name(memoized, "memoized");
1357
1357
 
1358
- // ../utils/node_modules/@noble/curves/abstract/modular.js
1358
+ // ../../node_modules/@noble/curves/abstract/modular.js
1359
1359
  var _0n2 = /* @__PURE__ */ BigInt(0);
1360
1360
  var _1n2 = /* @__PURE__ */ BigInt(1);
1361
1361
  var _2n = /* @__PURE__ */ BigInt(2);
@@ -1739,7 +1739,7 @@ var near = (() => {
1739
1739
  }
1740
1740
  __name(Field, "Field");
1741
1741
 
1742
- // ../utils/node_modules/@noble/curves/abstract/curve.js
1742
+ // ../../node_modules/@noble/curves/abstract/curve.js
1743
1743
  var _0n3 = /* @__PURE__ */ BigInt(0);
1744
1744
  var _1n3 = /* @__PURE__ */ BigInt(1);
1745
1745
  function negateCt(condition, item) {
@@ -1970,7 +1970,7 @@ var near = (() => {
1970
1970
  }
1971
1971
  __name(createKeygen, "createKeygen");
1972
1972
 
1973
- // ../utils/node_modules/@noble/curves/abstract/edwards.js
1973
+ // ../../node_modules/@noble/curves/abstract/edwards.js
1974
1974
  var _0n4 = BigInt(0);
1975
1975
  var _1n4 = BigInt(1);
1976
1976
  var _2n2 = BigInt(2);
@@ -2408,7 +2408,7 @@ var near = (() => {
2408
2408
  }
2409
2409
  __name(eddsa, "eddsa");
2410
2410
 
2411
- // ../utils/node_modules/@noble/curves/ed25519.js
2411
+ // ../../node_modules/@noble/curves/ed25519.js
2412
2412
  var _1n5 = BigInt(1);
2413
2413
  var _2n3 = BigInt(2);
2414
2414
  var _5n2 = BigInt(5);
@@ -3815,341 +3815,6 @@ var near = (() => {
3815
3815
  lsSet("txHistory", _txHistory);
3816
3816
  }, "resetTxHistory");
3817
3817
 
3818
- // node_modules/@noble/hashes/utils.js
3819
- function isBytes2(a) {
3820
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
3821
- }
3822
- __name(isBytes2, "isBytes");
3823
- function abytes2(value, length, title = "") {
3824
- const bytes = isBytes2(value);
3825
- const len = value?.length;
3826
- const needsLen = length !== void 0;
3827
- if (!bytes || needsLen && len !== length) {
3828
- const prefix = title && `"${title}" `;
3829
- const ofLen = needsLen ? ` of length ${length}` : "";
3830
- const got = bytes ? `length=${len}` : `type=${typeof value}`;
3831
- throw new Error(prefix + "expected Uint8Array" + ofLen + ", got " + got);
3832
- }
3833
- return value;
3834
- }
3835
- __name(abytes2, "abytes");
3836
- function aexists2(instance, checkFinished = true) {
3837
- if (instance.destroyed)
3838
- throw new Error("Hash instance has been destroyed");
3839
- if (checkFinished && instance.finished)
3840
- throw new Error("Hash#digest() has already been called");
3841
- }
3842
- __name(aexists2, "aexists");
3843
- function aoutput2(out, instance) {
3844
- abytes2(out, void 0, "digestInto() output");
3845
- const min = instance.outputLen;
3846
- if (out.length < min) {
3847
- throw new Error('"digestInto() output" expected to be of length >=' + min);
3848
- }
3849
- }
3850
- __name(aoutput2, "aoutput");
3851
- function clean2(...arrays) {
3852
- for (let i = 0; i < arrays.length; i++) {
3853
- arrays[i].fill(0);
3854
- }
3855
- }
3856
- __name(clean2, "clean");
3857
- function createView2(arr) {
3858
- return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
3859
- }
3860
- __name(createView2, "createView");
3861
- function rotr2(word, shift) {
3862
- return word << 32 - shift | word >>> shift;
3863
- }
3864
- __name(rotr2, "rotr");
3865
- function createHasher2(hashCons, info = {}) {
3866
- const hashC = /* @__PURE__ */ __name((msg, opts) => hashCons(opts).update(msg).digest(), "hashC");
3867
- const tmp = hashCons(void 0);
3868
- hashC.outputLen = tmp.outputLen;
3869
- hashC.blockLen = tmp.blockLen;
3870
- hashC.create = (opts) => hashCons(opts);
3871
- Object.assign(hashC, info);
3872
- return Object.freeze(hashC);
3873
- }
3874
- __name(createHasher2, "createHasher");
3875
- var oidNist2 = /* @__PURE__ */ __name((suffix) => ({
3876
- oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
3877
- }), "oidNist");
3878
-
3879
- // node_modules/@noble/hashes/_md.js
3880
- function Chi2(a, b, c) {
3881
- return a & b ^ ~a & c;
3882
- }
3883
- __name(Chi2, "Chi");
3884
- function Maj2(a, b, c) {
3885
- return a & b ^ a & c ^ b & c;
3886
- }
3887
- __name(Maj2, "Maj");
3888
- var HashMD2 = class {
3889
- static {
3890
- __name(this, "HashMD");
3891
- }
3892
- blockLen;
3893
- outputLen;
3894
- padOffset;
3895
- isLE;
3896
- // For partial updates less than block size
3897
- buffer;
3898
- view;
3899
- finished = false;
3900
- length = 0;
3901
- pos = 0;
3902
- destroyed = false;
3903
- constructor(blockLen, outputLen, padOffset, isLE) {
3904
- this.blockLen = blockLen;
3905
- this.outputLen = outputLen;
3906
- this.padOffset = padOffset;
3907
- this.isLE = isLE;
3908
- this.buffer = new Uint8Array(blockLen);
3909
- this.view = createView2(this.buffer);
3910
- }
3911
- update(data) {
3912
- aexists2(this);
3913
- abytes2(data);
3914
- const { view: view2, buffer, blockLen } = this;
3915
- const len = data.length;
3916
- for (let pos = 0; pos < len; ) {
3917
- const take = Math.min(blockLen - this.pos, len - pos);
3918
- if (take === blockLen) {
3919
- const dataView = createView2(data);
3920
- for (; blockLen <= len - pos; pos += blockLen)
3921
- this.process(dataView, pos);
3922
- continue;
3923
- }
3924
- buffer.set(data.subarray(pos, pos + take), this.pos);
3925
- this.pos += take;
3926
- pos += take;
3927
- if (this.pos === blockLen) {
3928
- this.process(view2, 0);
3929
- this.pos = 0;
3930
- }
3931
- }
3932
- this.length += data.length;
3933
- this.roundClean();
3934
- return this;
3935
- }
3936
- digestInto(out) {
3937
- aexists2(this);
3938
- aoutput2(out, this);
3939
- this.finished = true;
3940
- const { buffer, view: view2, blockLen, isLE } = this;
3941
- let { pos } = this;
3942
- buffer[pos++] = 128;
3943
- clean2(this.buffer.subarray(pos));
3944
- if (this.padOffset > blockLen - pos) {
3945
- this.process(view2, 0);
3946
- pos = 0;
3947
- }
3948
- for (let i = pos; i < blockLen; i++)
3949
- buffer[i] = 0;
3950
- view2.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);
3951
- this.process(view2, 0);
3952
- const oview = createView2(out);
3953
- const len = this.outputLen;
3954
- if (len % 4)
3955
- throw new Error("_sha2: outputLen must be aligned to 32bit");
3956
- const outLen = len / 4;
3957
- const state2 = this.get();
3958
- if (outLen > state2.length)
3959
- throw new Error("_sha2: outputLen bigger than state");
3960
- for (let i = 0; i < outLen; i++)
3961
- oview.setUint32(4 * i, state2[i], isLE);
3962
- }
3963
- digest() {
3964
- const { buffer, outputLen } = this;
3965
- this.digestInto(buffer);
3966
- const res = buffer.slice(0, outputLen);
3967
- this.destroy();
3968
- return res;
3969
- }
3970
- _cloneInto(to) {
3971
- to ||= new this.constructor();
3972
- to.set(...this.get());
3973
- const { blockLen, buffer, length, finished, destroyed, pos } = this;
3974
- to.destroyed = destroyed;
3975
- to.finished = finished;
3976
- to.length = length;
3977
- to.pos = pos;
3978
- if (length % blockLen)
3979
- to.buffer.set(buffer);
3980
- return to;
3981
- }
3982
- clone() {
3983
- return this._cloneInto();
3984
- }
3985
- };
3986
- var SHA256_IV2 = /* @__PURE__ */ Uint32Array.from([
3987
- 1779033703,
3988
- 3144134277,
3989
- 1013904242,
3990
- 2773480762,
3991
- 1359893119,
3992
- 2600822924,
3993
- 528734635,
3994
- 1541459225
3995
- ]);
3996
-
3997
- // node_modules/@noble/hashes/sha2.js
3998
- var SHA256_K2 = /* @__PURE__ */ Uint32Array.from([
3999
- 1116352408,
4000
- 1899447441,
4001
- 3049323471,
4002
- 3921009573,
4003
- 961987163,
4004
- 1508970993,
4005
- 2453635748,
4006
- 2870763221,
4007
- 3624381080,
4008
- 310598401,
4009
- 607225278,
4010
- 1426881987,
4011
- 1925078388,
4012
- 2162078206,
4013
- 2614888103,
4014
- 3248222580,
4015
- 3835390401,
4016
- 4022224774,
4017
- 264347078,
4018
- 604807628,
4019
- 770255983,
4020
- 1249150122,
4021
- 1555081692,
4022
- 1996064986,
4023
- 2554220882,
4024
- 2821834349,
4025
- 2952996808,
4026
- 3210313671,
4027
- 3336571891,
4028
- 3584528711,
4029
- 113926993,
4030
- 338241895,
4031
- 666307205,
4032
- 773529912,
4033
- 1294757372,
4034
- 1396182291,
4035
- 1695183700,
4036
- 1986661051,
4037
- 2177026350,
4038
- 2456956037,
4039
- 2730485921,
4040
- 2820302411,
4041
- 3259730800,
4042
- 3345764771,
4043
- 3516065817,
4044
- 3600352804,
4045
- 4094571909,
4046
- 275423344,
4047
- 430227734,
4048
- 506948616,
4049
- 659060556,
4050
- 883997877,
4051
- 958139571,
4052
- 1322822218,
4053
- 1537002063,
4054
- 1747873779,
4055
- 1955562222,
4056
- 2024104815,
4057
- 2227730452,
4058
- 2361852424,
4059
- 2428436474,
4060
- 2756734187,
4061
- 3204031479,
4062
- 3329325298
4063
- ]);
4064
- var SHA256_W2 = /* @__PURE__ */ new Uint32Array(64);
4065
- var SHA2_32B2 = class extends HashMD2 {
4066
- static {
4067
- __name(this, "SHA2_32B");
4068
- }
4069
- constructor(outputLen) {
4070
- super(64, outputLen, 8, false);
4071
- }
4072
- get() {
4073
- const { A, B, C, D, E, F, G, H } = this;
4074
- return [A, B, C, D, E, F, G, H];
4075
- }
4076
- // prettier-ignore
4077
- set(A, B, C, D, E, F, G, H) {
4078
- this.A = A | 0;
4079
- this.B = B | 0;
4080
- this.C = C | 0;
4081
- this.D = D | 0;
4082
- this.E = E | 0;
4083
- this.F = F | 0;
4084
- this.G = G | 0;
4085
- this.H = H | 0;
4086
- }
4087
- process(view2, offset) {
4088
- for (let i = 0; i < 16; i++, offset += 4)
4089
- SHA256_W2[i] = view2.getUint32(offset, false);
4090
- for (let i = 16; i < 64; i++) {
4091
- const W15 = SHA256_W2[i - 15];
4092
- const W2 = SHA256_W2[i - 2];
4093
- const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3;
4094
- const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10;
4095
- SHA256_W2[i] = s1 + SHA256_W2[i - 7] + s0 + SHA256_W2[i - 16] | 0;
4096
- }
4097
- let { A, B, C, D, E, F, G, H } = this;
4098
- for (let i = 0; i < 64; i++) {
4099
- const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25);
4100
- const T1 = H + sigma1 + Chi2(E, F, G) + SHA256_K2[i] + SHA256_W2[i] | 0;
4101
- const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22);
4102
- const T2 = sigma0 + Maj2(A, B, C) | 0;
4103
- H = G;
4104
- G = F;
4105
- F = E;
4106
- E = D + T1 | 0;
4107
- D = C;
4108
- C = B;
4109
- B = A;
4110
- A = T1 + T2 | 0;
4111
- }
4112
- A = A + this.A | 0;
4113
- B = B + this.B | 0;
4114
- C = C + this.C | 0;
4115
- D = D + this.D | 0;
4116
- E = E + this.E | 0;
4117
- F = F + this.F | 0;
4118
- G = G + this.G | 0;
4119
- H = H + this.H | 0;
4120
- this.set(A, B, C, D, E, F, G, H);
4121
- }
4122
- roundClean() {
4123
- clean2(SHA256_W2);
4124
- }
4125
- destroy() {
4126
- this.set(0, 0, 0, 0, 0, 0, 0, 0);
4127
- clean2(this.buffer);
4128
- }
4129
- };
4130
- var _SHA2562 = class extends SHA2_32B2 {
4131
- static {
4132
- __name(this, "_SHA256");
4133
- }
4134
- // We cannot use array here since array allows indexing by variable
4135
- // which means optimizer/compiler cannot use registers.
4136
- A = SHA256_IV2[0] | 0;
4137
- B = SHA256_IV2[1] | 0;
4138
- C = SHA256_IV2[2] | 0;
4139
- D = SHA256_IV2[3] | 0;
4140
- E = SHA256_IV2[4] | 0;
4141
- F = SHA256_IV2[5] | 0;
4142
- G = SHA256_IV2[6] | 0;
4143
- H = SHA256_IV2[7] | 0;
4144
- constructor() {
4145
- super(32);
4146
- }
4147
- };
4148
- var sha2562 = /* @__PURE__ */ createHasher2(
4149
- () => new _SHA2562(),
4150
- /* @__PURE__ */ oidNist2(1)
4151
- );
4152
-
4153
3818
  // src/near.ts
4154
3819
  big_default.DP = 27;
4155
3820
  var MaxBlockDelayMs = 1e3 * 60 * 60 * 6;
@@ -4440,7 +4105,7 @@ var near = (() => {
4440
4105
  actions: actions2
4441
4106
  };
4442
4107
  const txBytes = serializeTransaction(plainTransactionObj);
4443
- const txHashBytes = sha2562(txBytes);
4108
+ const txHashBytes = sha256(txBytes);
4444
4109
  const txHash58 = binary_to_base58_default(txHashBytes);
4445
4110
  const signatureBase58 = signHash(txHashBytes, privKey, { returnBase58: true });
4446
4111
  const signedTransactionBytes = serializeSignedTransaction(plainTransactionObj, signatureBase58);
@@ -4570,9 +4235,6 @@ var near = (() => {
4570
4235
 
4571
4236
  @noble/curves/ed25519.js:
4572
4237
  (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
4573
-
4574
- @noble/hashes/utils.js:
4575
- (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
4576
4238
  */
4577
4239
 
4578
4240
  try {