koilib 4.1.2 → 5.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/koinos.js +1036 -502
- package/dist/koinos.min.js +1 -1
- package/lib/Contract.d.ts +2 -0
- package/lib/Contract.js +4 -2
- package/lib/Contract.js.map +1 -1
- package/lib/Provider.d.ts +13 -4
- package/lib/Provider.js +16 -8
- package/lib/Provider.js.map +1 -1
- package/lib/Serializer.js +2 -0
- package/lib/Serializer.js.map +1 -1
- package/lib/Signer.d.ts +4 -2
- package/lib/Signer.js +9 -3
- package/lib/Signer.js.map +1 -1
- package/lib/browser/Contract.d.ts +2 -0
- package/lib/browser/Contract.js +4 -2
- package/lib/browser/Contract.js.map +1 -1
- package/lib/browser/Provider.d.ts +13 -4
- package/lib/browser/Provider.js +16 -8
- package/lib/browser/Provider.js.map +1 -1
- package/lib/browser/Serializer.js +2 -0
- package/lib/browser/Serializer.js.map +1 -1
- package/lib/browser/Signer.d.ts +4 -2
- package/lib/browser/Signer.js +9 -3
- package/lib/browser/Signer.js.map +1 -1
- package/lib/browser/index.js +5 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/index2.js +5 -1
- package/lib/browser/index2.js.map +1 -1
- package/lib/browser/indexUtils.js +5 -1
- package/lib/browser/indexUtils.js.map +1 -1
- package/lib/browser/interface.d.ts +12 -2
- package/lib/browser/jsonDescriptors/chain-proto.json +50 -0
- package/lib/browser/jsonDescriptors/token-proto.json +37 -8
- package/lib/browser/protoModules/protocol-proto.js +518 -201
- package/lib/browser/protoModules/protocol-proto.js.map +1 -1
- package/lib/browser/utils.js +5 -1
- package/lib/browser/utils.js.map +1 -1
- package/lib/browser/utilsNode.d.ts +50 -0
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/index2.js +5 -1
- package/lib/index2.js.map +1 -1
- package/lib/indexUtils.js +5 -1
- package/lib/indexUtils.js.map +1 -1
- package/lib/interface.d.ts +12 -2
- package/lib/jsonDescriptors/chain-proto.json +50 -0
- package/lib/jsonDescriptors/token-proto.json +37 -8
- package/lib/protoModules/protocol-proto.js +518 -201
- package/lib/protoModules/protocol-proto.js.map +1 -1
- package/lib/utils.js +5 -1
- package/lib/utils.js.map +1 -1
- package/lib/utilsNode.d.ts +50 -0
- package/package.json +29 -28
package/dist/koinos.js
CHANGED
|
@@ -132,6 +132,65 @@ function base (ALPHABET) {
|
|
|
132
132
|
module.exports = base
|
|
133
133
|
|
|
134
134
|
|
|
135
|
+
/***/ }),
|
|
136
|
+
|
|
137
|
+
/***/ 7320:
|
|
138
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
139
|
+
|
|
140
|
+
"use strict";
|
|
141
|
+
|
|
142
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
143
|
+
exports.output = exports.exists = exports.hash = exports.bytes = exports.bool = exports.number = void 0;
|
|
144
|
+
function number(n) {
|
|
145
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
146
|
+
throw new Error(`Wrong positive integer: ${n}`);
|
|
147
|
+
}
|
|
148
|
+
exports.number = number;
|
|
149
|
+
function bool(b) {
|
|
150
|
+
if (typeof b !== 'boolean')
|
|
151
|
+
throw new Error(`Expected boolean, not ${b}`);
|
|
152
|
+
}
|
|
153
|
+
exports.bool = bool;
|
|
154
|
+
function bytes(b, ...lengths) {
|
|
155
|
+
if (!(b instanceof Uint8Array))
|
|
156
|
+
throw new TypeError('Expected Uint8Array');
|
|
157
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
158
|
+
throw new TypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
|
159
|
+
}
|
|
160
|
+
exports.bytes = bytes;
|
|
161
|
+
function hash(hash) {
|
|
162
|
+
if (typeof hash !== 'function' || typeof hash.create !== 'function')
|
|
163
|
+
throw new Error('Hash should be wrapped by utils.wrapConstructor');
|
|
164
|
+
number(hash.outputLen);
|
|
165
|
+
number(hash.blockLen);
|
|
166
|
+
}
|
|
167
|
+
exports.hash = hash;
|
|
168
|
+
function exists(instance, checkFinished = true) {
|
|
169
|
+
if (instance.destroyed)
|
|
170
|
+
throw new Error('Hash instance has been destroyed');
|
|
171
|
+
if (checkFinished && instance.finished)
|
|
172
|
+
throw new Error('Hash#digest() has already been called');
|
|
173
|
+
}
|
|
174
|
+
exports.exists = exists;
|
|
175
|
+
function output(out, instance) {
|
|
176
|
+
bytes(out);
|
|
177
|
+
const min = instance.outputLen;
|
|
178
|
+
if (out.length < min) {
|
|
179
|
+
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.output = output;
|
|
183
|
+
const assert = {
|
|
184
|
+
number,
|
|
185
|
+
bool,
|
|
186
|
+
bytes,
|
|
187
|
+
hash,
|
|
188
|
+
exists,
|
|
189
|
+
output,
|
|
190
|
+
};
|
|
191
|
+
exports["default"] = assert;
|
|
192
|
+
|
|
193
|
+
|
|
135
194
|
/***/ }),
|
|
136
195
|
|
|
137
196
|
/***/ 7505:
|
|
@@ -141,6 +200,7 @@ module.exports = base
|
|
|
141
200
|
|
|
142
201
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
143
202
|
exports.SHA2 = void 0;
|
|
203
|
+
const _assert_js_1 = __webpack_require__(7320);
|
|
144
204
|
const utils_js_1 = __webpack_require__(8089);
|
|
145
205
|
// Polyfill for Safari 14
|
|
146
206
|
function setBigUint64(view, byteOffset, value, isLE) {
|
|
@@ -171,11 +231,8 @@ class SHA2 extends utils_js_1.Hash {
|
|
|
171
231
|
this.view = (0, utils_js_1.createView)(this.buffer);
|
|
172
232
|
}
|
|
173
233
|
update(data) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const { view, buffer, blockLen, finished } = this;
|
|
177
|
-
if (finished)
|
|
178
|
-
throw new Error('digest() was already called');
|
|
234
|
+
_assert_js_1.default.exists(this);
|
|
235
|
+
const { view, buffer, blockLen } = this;
|
|
179
236
|
data = (0, utils_js_1.toBytes)(data);
|
|
180
237
|
const len = data.length;
|
|
181
238
|
for (let pos = 0; pos < len;) {
|
|
@@ -200,12 +257,8 @@ class SHA2 extends utils_js_1.Hash {
|
|
|
200
257
|
return this;
|
|
201
258
|
}
|
|
202
259
|
digestInto(out) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (!(out instanceof Uint8Array) || out.length < this.outputLen)
|
|
206
|
-
throw new Error('_Sha2: Invalid output buffer');
|
|
207
|
-
if (this.finished)
|
|
208
|
-
throw new Error('digest() was already called');
|
|
260
|
+
_assert_js_1.default.exists(this);
|
|
261
|
+
_assert_js_1.default.output(out, this);
|
|
209
262
|
this.finished = true;
|
|
210
263
|
// Padding
|
|
211
264
|
// We can avoid allocation of buffer for padding completely if it
|
|
@@ -223,9 +276,9 @@ class SHA2 extends utils_js_1.Hash {
|
|
|
223
276
|
// Pad until full block byte with zeros
|
|
224
277
|
for (let i = pos; i < blockLen; i++)
|
|
225
278
|
buffer[i] = 0;
|
|
226
|
-
//
|
|
279
|
+
// Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
|
|
227
280
|
// You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
|
|
228
|
-
// So we just write lowest
|
|
281
|
+
// So we just write lowest 64 bits of that value.
|
|
229
282
|
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
230
283
|
this.process(view, 0);
|
|
231
284
|
const oview = (0, utils_js_1.createView)(out);
|
|
@@ -501,14 +554,13 @@ exports.sha256 = (0, utils_js_1.wrapConstructor)(() => new SHA256());
|
|
|
501
554
|
/***/ }),
|
|
502
555
|
|
|
503
556
|
/***/ 8089:
|
|
504
|
-
/***/ ((
|
|
557
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
505
558
|
|
|
506
559
|
"use strict";
|
|
507
|
-
/* module decorator */ module = __webpack_require__.nmd(module);
|
|
508
560
|
|
|
509
561
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
510
562
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
511
|
-
exports.randomBytes = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.
|
|
563
|
+
exports.randomBytes = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.isLE = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0;
|
|
512
564
|
// The import here is via the package name. This is to ensure
|
|
513
565
|
// that exports mapping/resolution does fall into place.
|
|
514
566
|
const crypto_1 = __webpack_require__(4421);
|
|
@@ -524,7 +576,7 @@ exports.createView = createView;
|
|
|
524
576
|
const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);
|
|
525
577
|
exports.rotr = rotr;
|
|
526
578
|
exports.isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
|
|
527
|
-
// There is almost no big endian hardware, but js typed arrays uses platform specific
|
|
579
|
+
// There is almost no big endian hardware, but js typed arrays uses platform specific endianness.
|
|
528
580
|
// So, just to be sure not to corrupt anything.
|
|
529
581
|
if (!exports.isLE)
|
|
530
582
|
throw new Error('Non little-endian hardware is not supported');
|
|
@@ -534,6 +586,8 @@ const hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '
|
|
|
534
586
|
*/
|
|
535
587
|
function bytesToHex(uint8a) {
|
|
536
588
|
// pre-caching improves the speed 6x
|
|
589
|
+
if (!(uint8a instanceof Uint8Array))
|
|
590
|
+
throw new Error('Uint8Array expected');
|
|
537
591
|
let hex = '';
|
|
538
592
|
for (let i = 0; i < uint8a.length; i++) {
|
|
539
593
|
hex += hexes[uint8a[i]];
|
|
@@ -555,28 +609,17 @@ function hexToBytes(hex) {
|
|
|
555
609
|
const j = i * 2;
|
|
556
610
|
const hexByte = hex.slice(j, j + 2);
|
|
557
611
|
const byte = Number.parseInt(hexByte, 16);
|
|
558
|
-
if (Number.isNaN(byte))
|
|
612
|
+
if (Number.isNaN(byte) || byte < 0)
|
|
559
613
|
throw new Error('Invalid byte sequence');
|
|
560
614
|
array[i] = byte;
|
|
561
615
|
}
|
|
562
616
|
return array;
|
|
563
617
|
}
|
|
564
618
|
exports.hexToBytes = hexToBytes;
|
|
565
|
-
//
|
|
566
|
-
//
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
typeof module.require === 'function' &&
|
|
570
|
-
module.require.bind(module);
|
|
571
|
-
try {
|
|
572
|
-
if (nodeRequire) {
|
|
573
|
-
const { setImmediate } = nodeRequire('timers');
|
|
574
|
-
return () => new Promise((resolve) => setImmediate(resolve));
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
catch (e) { }
|
|
578
|
-
return () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
579
|
-
})();
|
|
619
|
+
// There is no setImmediate in browser and setTimeout is slow. However, call to async function will return Promise
|
|
620
|
+
// which will be fullfiled only on next scheduler queue processing step and this is exactly what we need.
|
|
621
|
+
const nextTick = async () => { };
|
|
622
|
+
exports.nextTick = nextTick;
|
|
580
623
|
// Returns control to thread each 'tick' ms to avoid blocking
|
|
581
624
|
async function asyncLoop(iters, tick, cb) {
|
|
582
625
|
let ts = Date.now();
|
|
@@ -625,31 +668,6 @@ function concatBytes(...arrays) {
|
|
|
625
668
|
return result;
|
|
626
669
|
}
|
|
627
670
|
exports.concatBytes = concatBytes;
|
|
628
|
-
function assertNumber(n) {
|
|
629
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
|
630
|
-
throw new Error(`Wrong positive integer: ${n}`);
|
|
631
|
-
}
|
|
632
|
-
exports.assertNumber = assertNumber;
|
|
633
|
-
function assertBool(b) {
|
|
634
|
-
if (typeof b !== 'boolean') {
|
|
635
|
-
throw new Error(`Expected boolean, not ${b}`);
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
exports.assertBool = assertBool;
|
|
639
|
-
function assertBytes(bytes, ...lengths) {
|
|
640
|
-
if (bytes instanceof Uint8Array && (!lengths.length || lengths.includes(bytes.length))) {
|
|
641
|
-
return;
|
|
642
|
-
}
|
|
643
|
-
throw new TypeError(`Expected ${lengths} bytes, not ${typeof bytes} with length=${bytes.length}`);
|
|
644
|
-
}
|
|
645
|
-
exports.assertBytes = assertBytes;
|
|
646
|
-
function assertHash(hash) {
|
|
647
|
-
if (typeof hash !== 'function' || typeof hash.create !== 'function')
|
|
648
|
-
throw new Error('Hash should be wrapped by utils.wrapConstructor');
|
|
649
|
-
assertNumber(hash.outputLen);
|
|
650
|
-
assertNumber(hash.blockLen);
|
|
651
|
-
}
|
|
652
|
-
exports.assertHash = assertHash;
|
|
653
671
|
// For runtime check if class implements interface
|
|
654
672
|
class Hash {
|
|
655
673
|
// Safe version that clones internal state
|
|
@@ -660,11 +678,11 @@ class Hash {
|
|
|
660
678
|
exports.Hash = Hash;
|
|
661
679
|
// Check if object doens't have custom constructor (like Uint8Array/Array)
|
|
662
680
|
const isPlainObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]' && obj.constructor === Object;
|
|
663
|
-
function checkOpts(
|
|
664
|
-
if (
|
|
681
|
+
function checkOpts(defaults, opts) {
|
|
682
|
+
if (opts !== undefined && (typeof opts !== 'object' || !isPlainObject(opts)))
|
|
665
683
|
throw new TypeError('Options should be object or undefined');
|
|
666
|
-
const
|
|
667
|
-
return
|
|
684
|
+
const merged = Object.assign(defaults, opts);
|
|
685
|
+
return merged;
|
|
668
686
|
}
|
|
669
687
|
exports.checkOpts = checkOpts;
|
|
670
688
|
function wrapConstructor(hashConstructor) {
|
|
@@ -705,17 +723,14 @@ exports.randomBytes = randomBytes;
|
|
|
705
723
|
/***/ }),
|
|
706
724
|
|
|
707
725
|
/***/ 9656:
|
|
708
|
-
/***/ (
|
|
726
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
709
727
|
|
|
710
728
|
"use strict";
|
|
711
729
|
|
|
712
730
|
/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
|
|
713
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
714
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
715
|
-
};
|
|
716
731
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
717
732
|
exports.utils = exports.schnorr = exports.verify = exports.signSync = exports.sign = exports.getSharedSecret = exports.recoverPublicKey = exports.getPublicKey = exports.Signature = exports.Point = exports.CURVE = void 0;
|
|
718
|
-
const
|
|
733
|
+
const nodeCrypto = __webpack_require__(9159);
|
|
719
734
|
const _0n = BigInt(0);
|
|
720
735
|
const _1n = BigInt(1);
|
|
721
736
|
const _2n = BigInt(2);
|
|
@@ -760,25 +775,27 @@ class JacobianPoint {
|
|
|
760
775
|
return JacobianPoint.toAffineBatch(points).map(JacobianPoint.fromAffine);
|
|
761
776
|
}
|
|
762
777
|
equals(other) {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
const
|
|
766
|
-
const
|
|
767
|
-
const
|
|
768
|
-
const
|
|
769
|
-
|
|
778
|
+
if (!(other instanceof JacobianPoint))
|
|
779
|
+
throw new TypeError('JacobianPoint expected');
|
|
780
|
+
const { x: X1, y: Y1, z: Z1 } = this;
|
|
781
|
+
const { x: X2, y: Y2, z: Z2 } = other;
|
|
782
|
+
const Z1Z1 = mod(Z1 ** _2n);
|
|
783
|
+
const Z2Z2 = mod(Z2 ** _2n);
|
|
784
|
+
const U1 = mod(X1 * Z2Z2);
|
|
785
|
+
const U2 = mod(X2 * Z1Z1);
|
|
786
|
+
const S1 = mod(mod(Y1 * Z2) * Z2Z2);
|
|
787
|
+
const S2 = mod(mod(Y2 * Z1) * Z1Z1);
|
|
788
|
+
return U1 === U2 && S1 === S2;
|
|
770
789
|
}
|
|
771
790
|
negate() {
|
|
772
791
|
return new JacobianPoint(this.x, mod(-this.y), this.z);
|
|
773
792
|
}
|
|
774
793
|
double() {
|
|
775
|
-
const X1 = this
|
|
776
|
-
const Y1 = this.y;
|
|
777
|
-
const Z1 = this.z;
|
|
794
|
+
const { x: X1, y: Y1, z: Z1 } = this;
|
|
778
795
|
const A = mod(X1 ** _2n);
|
|
779
796
|
const B = mod(Y1 ** _2n);
|
|
780
797
|
const C = mod(B ** _2n);
|
|
781
|
-
const D = mod(_2n * (mod(
|
|
798
|
+
const D = mod(_2n * (mod((X1 + B) ** _2n) - A - C));
|
|
782
799
|
const E = mod(_3n * A);
|
|
783
800
|
const F = mod(E ** _2n);
|
|
784
801
|
const X3 = mod(F - _2n * D);
|
|
@@ -787,15 +804,10 @@ class JacobianPoint {
|
|
|
787
804
|
return new JacobianPoint(X3, Y3, Z3);
|
|
788
805
|
}
|
|
789
806
|
add(other) {
|
|
790
|
-
if (!(other instanceof JacobianPoint))
|
|
791
|
-
throw new TypeError('JacobianPoint
|
|
792
|
-
}
|
|
793
|
-
const
|
|
794
|
-
const Y1 = this.y;
|
|
795
|
-
const Z1 = this.z;
|
|
796
|
-
const X2 = other.x;
|
|
797
|
-
const Y2 = other.y;
|
|
798
|
-
const Z2 = other.z;
|
|
807
|
+
if (!(other instanceof JacobianPoint))
|
|
808
|
+
throw new TypeError('JacobianPoint expected');
|
|
809
|
+
const { x: X1, y: Y1, z: Z1 } = this;
|
|
810
|
+
const { x: X2, y: Y2, z: Z2 } = other;
|
|
799
811
|
if (X2 === _0n || Y2 === _0n)
|
|
800
812
|
return this;
|
|
801
813
|
if (X1 === _0n || Y1 === _0n)
|
|
@@ -804,7 +816,7 @@ class JacobianPoint {
|
|
|
804
816
|
const Z2Z2 = mod(Z2 ** _2n);
|
|
805
817
|
const U1 = mod(X1 * Z2Z2);
|
|
806
818
|
const U2 = mod(X2 * Z1Z1);
|
|
807
|
-
const S1 = mod(Y1 * Z2 * Z2Z2);
|
|
819
|
+
const S1 = mod(mod(Y1 * Z2) * Z2Z2);
|
|
808
820
|
const S2 = mod(mod(Y2 * Z1) * Z1Z1);
|
|
809
821
|
const H = mod(U2 - U1);
|
|
810
822
|
const r = mod(S2 - S1);
|
|
@@ -828,9 +840,14 @@ class JacobianPoint {
|
|
|
828
840
|
return this.add(other.negate());
|
|
829
841
|
}
|
|
830
842
|
multiplyUnsafe(scalar) {
|
|
843
|
+
const P0 = JacobianPoint.ZERO;
|
|
844
|
+
if (typeof scalar === 'bigint' && scalar === _0n)
|
|
845
|
+
return P0;
|
|
831
846
|
let n = normalizeScalar(scalar);
|
|
847
|
+
if (n === _1n)
|
|
848
|
+
return this;
|
|
832
849
|
if (!USE_ENDOMORPHISM) {
|
|
833
|
-
let p =
|
|
850
|
+
let p = P0;
|
|
834
851
|
let d = this;
|
|
835
852
|
while (n > _0n) {
|
|
836
853
|
if (n & _1n)
|
|
@@ -841,8 +858,8 @@ class JacobianPoint {
|
|
|
841
858
|
return p;
|
|
842
859
|
}
|
|
843
860
|
let { k1neg, k1, k2neg, k2 } = splitScalarEndo(n);
|
|
844
|
-
let k1p =
|
|
845
|
-
let k2p =
|
|
861
|
+
let k1p = P0;
|
|
862
|
+
let k2p = P0;
|
|
846
863
|
let d = this;
|
|
847
864
|
while (k1 > _0n || k2 > _0n) {
|
|
848
865
|
if (k1 & _1n)
|
|
@@ -893,7 +910,7 @@ class JacobianPoint {
|
|
|
893
910
|
}
|
|
894
911
|
let p = JacobianPoint.ZERO;
|
|
895
912
|
let f = JacobianPoint.ZERO;
|
|
896
|
-
const windows = USE_ENDOMORPHISM ? 128 / W
|
|
913
|
+
const windows = 1 + (USE_ENDOMORPHISM ? 128 / W : 256 / W);
|
|
897
914
|
const windowSize = 2 ** (W - 1);
|
|
898
915
|
const mask = BigInt(2 ** W - 1);
|
|
899
916
|
const maxNumber = 2 ** W;
|
|
@@ -926,7 +943,7 @@ class JacobianPoint {
|
|
|
926
943
|
let point;
|
|
927
944
|
let fake;
|
|
928
945
|
if (USE_ENDOMORPHISM) {
|
|
929
|
-
|
|
946
|
+
const { k1neg, k1, k2neg, k2 } = splitScalarEndo(n);
|
|
930
947
|
let { p: k1p, f: f1p } = this.wNAF(k1, affinePoint);
|
|
931
948
|
let { p: k2p, f: f2p } = this.wNAF(k2, affinePoint);
|
|
932
949
|
if (k1neg)
|
|
@@ -938,17 +955,23 @@ class JacobianPoint {
|
|
|
938
955
|
fake = f1p.add(f2p);
|
|
939
956
|
}
|
|
940
957
|
else {
|
|
941
|
-
|
|
958
|
+
const { p, f } = this.wNAF(n, affinePoint);
|
|
942
959
|
point = p;
|
|
943
960
|
fake = f;
|
|
944
961
|
}
|
|
945
962
|
return JacobianPoint.normalizeZ([point, fake])[0];
|
|
946
963
|
}
|
|
947
964
|
toAffine(invZ = invert(this.z)) {
|
|
948
|
-
const
|
|
949
|
-
const
|
|
950
|
-
const
|
|
951
|
-
|
|
965
|
+
const { x, y, z } = this;
|
|
966
|
+
const iz1 = invZ;
|
|
967
|
+
const iz2 = mod(iz1 * iz1);
|
|
968
|
+
const iz3 = mod(iz2 * iz1);
|
|
969
|
+
const ax = mod(x * iz2);
|
|
970
|
+
const ay = mod(y * iz3);
|
|
971
|
+
const zz = mod(z * iz1);
|
|
972
|
+
if (zz !== _1n)
|
|
973
|
+
throw new Error('invZ was invalid');
|
|
974
|
+
return new Point(ax, ay);
|
|
952
975
|
}
|
|
953
976
|
}
|
|
954
977
|
JacobianPoint.BASE = new JacobianPoint(CURVE.Gx, CURVE.Gy, _1n);
|
|
@@ -965,7 +988,9 @@ class Point {
|
|
|
965
988
|
}
|
|
966
989
|
static fromCompressedHex(bytes) {
|
|
967
990
|
const isShort = bytes.length === 32;
|
|
968
|
-
const x = bytesToNumber(isShort ? bytes : bytes.
|
|
991
|
+
const x = bytesToNumber(isShort ? bytes : bytes.subarray(1));
|
|
992
|
+
if (!isValidFieldElement(x))
|
|
993
|
+
throw new Error('Point is not on curve');
|
|
969
994
|
const y2 = weistrass(x);
|
|
970
995
|
let y = sqrtMod(y2);
|
|
971
996
|
const isYOdd = (y & _1n) === _1n;
|
|
@@ -983,52 +1008,56 @@ class Point {
|
|
|
983
1008
|
return point;
|
|
984
1009
|
}
|
|
985
1010
|
static fromUncompressedHex(bytes) {
|
|
986
|
-
const x = bytesToNumber(bytes.
|
|
987
|
-
const y = bytesToNumber(bytes.
|
|
1011
|
+
const x = bytesToNumber(bytes.subarray(1, 33));
|
|
1012
|
+
const y = bytesToNumber(bytes.subarray(33, 65));
|
|
988
1013
|
const point = new Point(x, y);
|
|
989
1014
|
point.assertValidity();
|
|
990
1015
|
return point;
|
|
991
1016
|
}
|
|
992
1017
|
static fromHex(hex) {
|
|
993
1018
|
const bytes = ensureBytes(hex);
|
|
1019
|
+
const len = bytes.length;
|
|
994
1020
|
const header = bytes[0];
|
|
995
|
-
if (
|
|
1021
|
+
if (len === 32 || (len === 33 && (header === 0x02 || header === 0x03))) {
|
|
996
1022
|
return this.fromCompressedHex(bytes);
|
|
997
1023
|
}
|
|
998
|
-
if (
|
|
1024
|
+
if (len === 65 && header === 0x04)
|
|
999
1025
|
return this.fromUncompressedHex(bytes);
|
|
1000
|
-
throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${
|
|
1026
|
+
throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${len}`);
|
|
1001
1027
|
}
|
|
1002
1028
|
static fromPrivateKey(privateKey) {
|
|
1003
1029
|
return Point.BASE.multiply(normalizePrivateKey(privateKey));
|
|
1004
1030
|
}
|
|
1005
1031
|
static fromSignature(msgHash, signature, recovery) {
|
|
1006
|
-
|
|
1007
|
-
const
|
|
1008
|
-
const { r, s } =
|
|
1032
|
+
msgHash = ensureBytes(msgHash);
|
|
1033
|
+
const h = truncateHash(msgHash);
|
|
1034
|
+
const { r, s } = normalizeSignature(signature);
|
|
1009
1035
|
if (recovery !== 0 && recovery !== 1) {
|
|
1010
1036
|
throw new Error('Cannot recover signature: invalid recovery bit');
|
|
1011
1037
|
}
|
|
1012
|
-
const prefix =
|
|
1013
|
-
const
|
|
1014
|
-
const
|
|
1015
|
-
const
|
|
1016
|
-
const
|
|
1017
|
-
const
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1020
|
-
|
|
1038
|
+
const prefix = recovery & 1 ? '03' : '02';
|
|
1039
|
+
const R = Point.fromHex(prefix + numTo32bStr(r));
|
|
1040
|
+
const { n } = CURVE;
|
|
1041
|
+
const rinv = invert(r, n);
|
|
1042
|
+
const u1 = mod(-h * rinv, n);
|
|
1043
|
+
const u2 = mod(s * rinv, n);
|
|
1044
|
+
const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2);
|
|
1045
|
+
if (!Q)
|
|
1046
|
+
throw new Error('Cannot recover signature: point at infinify');
|
|
1047
|
+
Q.assertValidity();
|
|
1048
|
+
return Q;
|
|
1021
1049
|
}
|
|
1022
1050
|
toRawBytes(isCompressed = false) {
|
|
1023
1051
|
return hexToBytes(this.toHex(isCompressed));
|
|
1024
1052
|
}
|
|
1025
1053
|
toHex(isCompressed = false) {
|
|
1026
|
-
const x =
|
|
1054
|
+
const x = numTo32bStr(this.x);
|
|
1027
1055
|
if (isCompressed) {
|
|
1028
|
-
|
|
1056
|
+
const prefix = this.y & _1n ? '03' : '02';
|
|
1057
|
+
return `${prefix}${x}`;
|
|
1029
1058
|
}
|
|
1030
1059
|
else {
|
|
1031
|
-
return `04${x}${
|
|
1060
|
+
return `04${x}${numTo32bStr(this.y)}`;
|
|
1032
1061
|
}
|
|
1033
1062
|
}
|
|
1034
1063
|
toHexX() {
|
|
@@ -1040,7 +1069,7 @@ class Point {
|
|
|
1040
1069
|
assertValidity() {
|
|
1041
1070
|
const msg = 'Point is not on elliptic curve';
|
|
1042
1071
|
const { x, y } = this;
|
|
1043
|
-
if (!
|
|
1072
|
+
if (!isValidFieldElement(x) || !isValidFieldElement(y))
|
|
1044
1073
|
throw new Error(msg);
|
|
1045
1074
|
const left = mod(y * y);
|
|
1046
1075
|
const right = weistrass(x);
|
|
@@ -1065,6 +1094,13 @@ class Point {
|
|
|
1065
1094
|
multiply(scalar) {
|
|
1066
1095
|
return JacobianPoint.fromAffine(this).multiply(scalar, this).toAffine();
|
|
1067
1096
|
}
|
|
1097
|
+
multiplyAndAddUnsafe(Q, a, b) {
|
|
1098
|
+
const P = JacobianPoint.fromAffine(this);
|
|
1099
|
+
const aP = a === _0n || a === _1n || this !== Point.BASE ? P.multiplyUnsafe(a) : P.multiply(a);
|
|
1100
|
+
const bQ = JacobianPoint.fromAffine(Q).multiplyUnsafe(b);
|
|
1101
|
+
const sum = aP.add(bQ);
|
|
1102
|
+
return sum.equals(JacobianPoint.ZERO) ? undefined : sum.toAffine();
|
|
1103
|
+
}
|
|
1068
1104
|
}
|
|
1069
1105
|
exports.Point = Point;
|
|
1070
1106
|
Point.BASE = new Point(CURVE.Gx, CURVE.Gy);
|
|
@@ -1107,7 +1143,7 @@ class Signature {
|
|
|
1107
1143
|
this.assertValidity();
|
|
1108
1144
|
}
|
|
1109
1145
|
static fromCompact(hex) {
|
|
1110
|
-
const arr = hex
|
|
1146
|
+
const arr = isUint8a(hex);
|
|
1111
1147
|
const name = 'Signature.fromCompact';
|
|
1112
1148
|
if (typeof hex !== 'string' && !arr)
|
|
1113
1149
|
throw new TypeError(`${name}: Expected string or Uint8Array`);
|
|
@@ -1117,7 +1153,7 @@ class Signature {
|
|
|
1117
1153
|
return new Signature(hexToNumber(str.slice(0, 64)), hexToNumber(str.slice(64, 128)));
|
|
1118
1154
|
}
|
|
1119
1155
|
static fromDER(hex) {
|
|
1120
|
-
const arr = hex
|
|
1156
|
+
const arr = isUint8a(hex);
|
|
1121
1157
|
if (typeof hex !== 'string' && !arr)
|
|
1122
1158
|
throw new TypeError(`Signature.fromDER: Expected string or Uint8Array`);
|
|
1123
1159
|
const { r, s } = parseDERSignature(arr ? hex : hexToBytes(hex));
|
|
@@ -1144,13 +1180,13 @@ class Signature {
|
|
|
1144
1180
|
return hexToBytes(this.toDERHex(isCompressed));
|
|
1145
1181
|
}
|
|
1146
1182
|
toDERHex(isCompressed = false) {
|
|
1147
|
-
const sHex = sliceDER(
|
|
1183
|
+
const sHex = sliceDER(numberToHexUnpadded(this.s));
|
|
1148
1184
|
if (isCompressed)
|
|
1149
1185
|
return sHex;
|
|
1150
|
-
const rHex = sliceDER(
|
|
1151
|
-
const rLen =
|
|
1152
|
-
const sLen =
|
|
1153
|
-
const length =
|
|
1186
|
+
const rHex = sliceDER(numberToHexUnpadded(this.r));
|
|
1187
|
+
const rLen = numberToHexUnpadded(rHex.length / 2);
|
|
1188
|
+
const sLen = numberToHexUnpadded(sHex.length / 2);
|
|
1189
|
+
const length = numberToHexUnpadded(rHex.length / 2 + sHex.length / 2 + 4);
|
|
1154
1190
|
return `30${length}02${rLen}${rHex}02${sLen}${sHex}`;
|
|
1155
1191
|
}
|
|
1156
1192
|
toRawBytes() {
|
|
@@ -1163,12 +1199,12 @@ class Signature {
|
|
|
1163
1199
|
return hexToBytes(this.toCompactHex());
|
|
1164
1200
|
}
|
|
1165
1201
|
toCompactHex() {
|
|
1166
|
-
return
|
|
1202
|
+
return numTo32bStr(this.r) + numTo32bStr(this.s);
|
|
1167
1203
|
}
|
|
1168
1204
|
}
|
|
1169
1205
|
exports.Signature = Signature;
|
|
1170
1206
|
function concatBytes(...arrays) {
|
|
1171
|
-
if (!arrays.every(
|
|
1207
|
+
if (!arrays.every(isUint8a))
|
|
1172
1208
|
throw new Error('Uint8Array list expected');
|
|
1173
1209
|
if (arrays.length === 1)
|
|
1174
1210
|
return arrays[0];
|
|
@@ -1181,23 +1217,28 @@ function concatBytes(...arrays) {
|
|
|
1181
1217
|
}
|
|
1182
1218
|
return result;
|
|
1183
1219
|
}
|
|
1220
|
+
function isUint8a(bytes) {
|
|
1221
|
+
return bytes instanceof Uint8Array;
|
|
1222
|
+
}
|
|
1184
1223
|
const hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));
|
|
1185
1224
|
function bytesToHex(uint8a) {
|
|
1225
|
+
if (!(uint8a instanceof Uint8Array))
|
|
1226
|
+
throw new Error('Expected Uint8Array');
|
|
1186
1227
|
let hex = '';
|
|
1187
1228
|
for (let i = 0; i < uint8a.length; i++) {
|
|
1188
1229
|
hex += hexes[uint8a[i]];
|
|
1189
1230
|
}
|
|
1190
1231
|
return hex;
|
|
1191
1232
|
}
|
|
1192
|
-
function
|
|
1233
|
+
function numTo32bStr(num) {
|
|
1193
1234
|
if (num > POW_2_256)
|
|
1194
|
-
throw new Error('
|
|
1235
|
+
throw new Error('Expected number < 2^256');
|
|
1195
1236
|
return num.toString(16).padStart(64, '0');
|
|
1196
1237
|
}
|
|
1197
|
-
function
|
|
1198
|
-
return hexToBytes(
|
|
1238
|
+
function numTo32b(num) {
|
|
1239
|
+
return hexToBytes(numTo32bStr(num));
|
|
1199
1240
|
}
|
|
1200
|
-
function
|
|
1241
|
+
function numberToHexUnpadded(num) {
|
|
1201
1242
|
const hex = num.toString(16);
|
|
1202
1243
|
return hex.length & 1 ? `0${hex}` : hex;
|
|
1203
1244
|
}
|
|
@@ -1218,22 +1259,20 @@ function hexToBytes(hex) {
|
|
|
1218
1259
|
const j = i * 2;
|
|
1219
1260
|
const hexByte = hex.slice(j, j + 2);
|
|
1220
1261
|
const byte = Number.parseInt(hexByte, 16);
|
|
1221
|
-
if (Number.isNaN(byte))
|
|
1262
|
+
if (Number.isNaN(byte) || byte < 0)
|
|
1222
1263
|
throw new Error('Invalid byte sequence');
|
|
1223
1264
|
array[i] = byte;
|
|
1224
1265
|
}
|
|
1225
1266
|
return array;
|
|
1226
1267
|
}
|
|
1227
|
-
function ensureBytes(hex) {
|
|
1228
|
-
return hex instanceof Uint8Array ? hex : hexToBytes(hex);
|
|
1229
|
-
}
|
|
1230
1268
|
function bytesToNumber(bytes) {
|
|
1231
|
-
if (!(bytes instanceof Uint8Array))
|
|
1232
|
-
throw new Error('Expected Uint8Array');
|
|
1233
1269
|
return hexToNumber(bytesToHex(bytes));
|
|
1234
1270
|
}
|
|
1271
|
+
function ensureBytes(hex) {
|
|
1272
|
+
return hex instanceof Uint8Array ? Uint8Array.from(hex) : hexToBytes(hex);
|
|
1273
|
+
}
|
|
1235
1274
|
function normalizeScalar(num) {
|
|
1236
|
-
if (typeof num === 'number' &&
|
|
1275
|
+
if (typeof num === 'number' && Number.isSafeInteger(num) && num > 0)
|
|
1237
1276
|
return BigInt(num);
|
|
1238
1277
|
if (typeof num === 'bigint' && isWithinCurveOrder(num))
|
|
1239
1278
|
return num;
|
|
@@ -1241,7 +1280,7 @@ function normalizeScalar(num) {
|
|
|
1241
1280
|
}
|
|
1242
1281
|
function mod(a, b = CURVE.P) {
|
|
1243
1282
|
const result = a % b;
|
|
1244
|
-
return result >=
|
|
1283
|
+
return result >= _0n ? result : b + result;
|
|
1245
1284
|
}
|
|
1246
1285
|
function pow2(x, power) {
|
|
1247
1286
|
const { P } = CURVE;
|
|
@@ -1294,25 +1333,22 @@ function invert(number, modulo = CURVE.P) {
|
|
|
1294
1333
|
throw new Error('invert: does not exist');
|
|
1295
1334
|
return mod(x, modulo);
|
|
1296
1335
|
}
|
|
1297
|
-
function invertBatch(nums,
|
|
1298
|
-
const
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
if (nums[i] === _0n)
|
|
1303
|
-
continue;
|
|
1336
|
+
function invertBatch(nums, p = CURVE.P) {
|
|
1337
|
+
const scratch = new Array(nums.length);
|
|
1338
|
+
const lastMultiplied = nums.reduce((acc, num, i) => {
|
|
1339
|
+
if (num === _0n)
|
|
1340
|
+
return acc;
|
|
1304
1341
|
scratch[i] = acc;
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
if (
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
return nums;
|
|
1342
|
+
return mod(acc * num, p);
|
|
1343
|
+
}, _1n);
|
|
1344
|
+
const inverted = invert(lastMultiplied, p);
|
|
1345
|
+
nums.reduceRight((acc, num, i) => {
|
|
1346
|
+
if (num === _0n)
|
|
1347
|
+
return acc;
|
|
1348
|
+
scratch[i] = mod(acc * scratch[i], p);
|
|
1349
|
+
return mod(acc * num, p);
|
|
1350
|
+
}, inverted);
|
|
1351
|
+
return scratch;
|
|
1316
1352
|
}
|
|
1317
1353
|
const divNearest = (a, b) => (a + b / _2n) / b;
|
|
1318
1354
|
const POW_2_128 = _2n ** BigInt(128);
|
|
@@ -1332,23 +1368,21 @@ function splitScalarEndo(k) {
|
|
|
1332
1368
|
k1 = n - k1;
|
|
1333
1369
|
if (k2neg)
|
|
1334
1370
|
k2 = n - k2;
|
|
1335
|
-
if (k1 > POW_2_128 || k2 > POW_2_128)
|
|
1336
|
-
throw new Error('splitScalarEndo: Endomorphism failed');
|
|
1371
|
+
if (k1 > POW_2_128 || k2 > POW_2_128) {
|
|
1372
|
+
throw new Error('splitScalarEndo: Endomorphism failed, k=' + k);
|
|
1373
|
+
}
|
|
1337
1374
|
return { k1neg, k1, k2neg, k2 };
|
|
1338
1375
|
}
|
|
1339
1376
|
function truncateHash(hash) {
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
let msg = hexToNumber(hash || '0');
|
|
1343
|
-
const byteLength = hash.length / 2;
|
|
1377
|
+
const { n } = CURVE;
|
|
1378
|
+
const byteLength = hash.length;
|
|
1344
1379
|
const delta = byteLength * 8 - 256;
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
if (
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
return msg;
|
|
1380
|
+
let h = bytesToNumber(hash);
|
|
1381
|
+
if (delta > 0)
|
|
1382
|
+
h = h >> BigInt(delta);
|
|
1383
|
+
if (h >= n)
|
|
1384
|
+
h -= n;
|
|
1385
|
+
return h;
|
|
1352
1386
|
}
|
|
1353
1387
|
class HmacDrbg {
|
|
1354
1388
|
constructor() {
|
|
@@ -1403,8 +1437,8 @@ class HmacDrbg {
|
|
|
1403
1437
|
function isWithinCurveOrder(num) {
|
|
1404
1438
|
return _0n < num && num < CURVE.n;
|
|
1405
1439
|
}
|
|
1406
|
-
function
|
|
1407
|
-
return
|
|
1440
|
+
function isValidFieldElement(num) {
|
|
1441
|
+
return _0n < num && num < CURVE.P;
|
|
1408
1442
|
}
|
|
1409
1443
|
function kmdToSig(kBytes, m, d) {
|
|
1410
1444
|
const k = bytesToNumber(kBytes);
|
|
@@ -1435,7 +1469,7 @@ function normalizePrivateKey(key) {
|
|
|
1435
1469
|
throw new Error('Expected 32 bytes of private key');
|
|
1436
1470
|
num = hexToNumber(key);
|
|
1437
1471
|
}
|
|
1438
|
-
else if (key
|
|
1472
|
+
else if (isUint8a(key)) {
|
|
1439
1473
|
if (key.length !== 32)
|
|
1440
1474
|
throw new Error('Expected 32 bytes of private key');
|
|
1441
1475
|
num = bytesToNumber(key);
|
|
@@ -1472,12 +1506,12 @@ function getPublicKey(privateKey, isCompressed = false) {
|
|
|
1472
1506
|
return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);
|
|
1473
1507
|
}
|
|
1474
1508
|
exports.getPublicKey = getPublicKey;
|
|
1475
|
-
function recoverPublicKey(msgHash, signature, recovery) {
|
|
1476
|
-
return Point.fromSignature(msgHash, signature, recovery).toRawBytes();
|
|
1509
|
+
function recoverPublicKey(msgHash, signature, recovery, isCompressed = false) {
|
|
1510
|
+
return Point.fromSignature(msgHash, signature, recovery).toRawBytes(isCompressed);
|
|
1477
1511
|
}
|
|
1478
1512
|
exports.recoverPublicKey = recoverPublicKey;
|
|
1479
1513
|
function isPub(item) {
|
|
1480
|
-
const arr = item
|
|
1514
|
+
const arr = isUint8a(item);
|
|
1481
1515
|
const str = typeof item === 'string';
|
|
1482
1516
|
const len = (arr || str) && item.length;
|
|
1483
1517
|
if (arr)
|
|
@@ -1510,21 +1544,21 @@ function bits2octets(bytes) {
|
|
|
1510
1544
|
function int2octets(num) {
|
|
1511
1545
|
if (typeof num !== 'bigint')
|
|
1512
1546
|
throw new Error('Expected bigint');
|
|
1513
|
-
const hex =
|
|
1547
|
+
const hex = numTo32bStr(num);
|
|
1514
1548
|
return hexToBytes(hex);
|
|
1515
1549
|
}
|
|
1516
1550
|
function initSigArgs(msgHash, privateKey, extraEntropy) {
|
|
1517
1551
|
if (msgHash == null)
|
|
1518
|
-
throw new Error(`sign: expected valid
|
|
1552
|
+
throw new Error(`sign: expected valid message hash, not "${msgHash}"`);
|
|
1519
1553
|
const h1 = ensureBytes(msgHash);
|
|
1520
1554
|
const d = normalizePrivateKey(privateKey);
|
|
1521
1555
|
const seedArgs = [int2octets(d), bits2octets(h1)];
|
|
1522
1556
|
if (extraEntropy != null) {
|
|
1523
1557
|
if (extraEntropy === true)
|
|
1524
1558
|
extraEntropy = exports.utils.randomBytes(32);
|
|
1525
|
-
const e =
|
|
1559
|
+
const e = ensureBytes(extraEntropy);
|
|
1526
1560
|
if (e.length !== 32)
|
|
1527
|
-
throw new Error('
|
|
1561
|
+
throw new Error('sign: Expected 32 bytes of extra data');
|
|
1528
1562
|
seedArgs.push(e);
|
|
1529
1563
|
}
|
|
1530
1564
|
const seed = concatBytes(...seedArgs);
|
|
@@ -1566,6 +1600,7 @@ function verify(signature, msgHash, publicKey, opts = vopts) {
|
|
|
1566
1600
|
let sig;
|
|
1567
1601
|
try {
|
|
1568
1602
|
sig = normalizeSignature(signature);
|
|
1603
|
+
msgHash = ensureBytes(msgHash);
|
|
1569
1604
|
}
|
|
1570
1605
|
catch (error) {
|
|
1571
1606
|
return false;
|
|
@@ -1574,57 +1609,51 @@ function verify(signature, msgHash, publicKey, opts = vopts) {
|
|
|
1574
1609
|
if (opts.strict && sig.hasHighS())
|
|
1575
1610
|
return false;
|
|
1576
1611
|
const h = truncateHash(msgHash);
|
|
1577
|
-
|
|
1578
|
-
return false;
|
|
1579
|
-
let pubKey;
|
|
1612
|
+
let P;
|
|
1580
1613
|
try {
|
|
1581
|
-
|
|
1614
|
+
P = normalizePublicKey(publicKey);
|
|
1582
1615
|
}
|
|
1583
1616
|
catch (error) {
|
|
1584
1617
|
return false;
|
|
1585
1618
|
}
|
|
1586
1619
|
const { n } = CURVE;
|
|
1587
|
-
const
|
|
1588
|
-
const u1 = mod(h *
|
|
1589
|
-
const u2 = mod(r *
|
|
1590
|
-
const
|
|
1591
|
-
|
|
1592
|
-
|
|
1620
|
+
const sinv = invert(s, n);
|
|
1621
|
+
const u1 = mod(h * sinv, n);
|
|
1622
|
+
const u2 = mod(r * sinv, n);
|
|
1623
|
+
const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2);
|
|
1624
|
+
if (!R)
|
|
1625
|
+
return false;
|
|
1593
1626
|
const v = mod(R.x, n);
|
|
1594
1627
|
return v === r;
|
|
1595
1628
|
}
|
|
1596
1629
|
exports.verify = verify;
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
const tagH = await exports.utils.sha256(tagB);
|
|
1600
|
-
const h = await exports.utils.sha256(concatBytes(tagH, tagH, ...messages));
|
|
1601
|
-
return bytesToNumber(h);
|
|
1602
|
-
}
|
|
1603
|
-
async function createChallenge(x, P, message) {
|
|
1604
|
-
const rx = pad32b(x);
|
|
1605
|
-
const t = await taggedHash('BIP0340/challenge', rx, P.toRawX(), message);
|
|
1606
|
-
return mod(t, CURVE.n);
|
|
1630
|
+
function finalizeSchnorrChallenge(ch) {
|
|
1631
|
+
return mod(bytesToNumber(ch), CURVE.n);
|
|
1607
1632
|
}
|
|
1608
1633
|
function hasEvenY(point) {
|
|
1609
|
-
return
|
|
1634
|
+
return (point.y & _1n) === _0n;
|
|
1610
1635
|
}
|
|
1611
1636
|
class SchnorrSignature {
|
|
1612
1637
|
constructor(r, s) {
|
|
1613
1638
|
this.r = r;
|
|
1614
1639
|
this.s = s;
|
|
1615
|
-
|
|
1616
|
-
throw new Error('Invalid signature');
|
|
1640
|
+
this.assertValidity();
|
|
1617
1641
|
}
|
|
1618
1642
|
static fromHex(hex) {
|
|
1619
1643
|
const bytes = ensureBytes(hex);
|
|
1620
1644
|
if (bytes.length !== 64)
|
|
1621
1645
|
throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${bytes.length}`);
|
|
1622
|
-
const r = bytesToNumber(bytes.
|
|
1623
|
-
const s = bytesToNumber(bytes.
|
|
1646
|
+
const r = bytesToNumber(bytes.subarray(0, 32));
|
|
1647
|
+
const s = bytesToNumber(bytes.subarray(32, 64));
|
|
1624
1648
|
return new SchnorrSignature(r, s);
|
|
1625
1649
|
}
|
|
1650
|
+
assertValidity() {
|
|
1651
|
+
const { r, s } = this;
|
|
1652
|
+
if (!isValidFieldElement(r) || !isWithinCurveOrder(s))
|
|
1653
|
+
throw new Error('Invalid signature');
|
|
1654
|
+
}
|
|
1626
1655
|
toHex() {
|
|
1627
|
-
return
|
|
1656
|
+
return numTo32bStr(this.r) + numTo32bStr(this.s);
|
|
1628
1657
|
}
|
|
1629
1658
|
toRawBytes() {
|
|
1630
1659
|
return hexToBytes(this.toHex());
|
|
@@ -1633,55 +1662,112 @@ class SchnorrSignature {
|
|
|
1633
1662
|
function schnorrGetPublicKey(privateKey) {
|
|
1634
1663
|
return Point.fromPrivateKey(privateKey).toRawX();
|
|
1635
1664
|
}
|
|
1636
|
-
|
|
1665
|
+
function initSchnorrSigArgs(message, privateKey, auxRand) {
|
|
1637
1666
|
if (message == null)
|
|
1638
1667
|
throw new TypeError(`sign: Expected valid message, not "${message}"`);
|
|
1639
|
-
const { n } = CURVE;
|
|
1640
1668
|
const m = ensureBytes(message);
|
|
1641
1669
|
const d0 = normalizePrivateKey(privateKey);
|
|
1642
1670
|
const rand = ensureBytes(auxRand);
|
|
1643
1671
|
if (rand.length !== 32)
|
|
1644
1672
|
throw new TypeError('sign: Expected 32 bytes of aux randomness');
|
|
1645
1673
|
const P = Point.fromPrivateKey(d0);
|
|
1646
|
-
const
|
|
1647
|
-
const
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1674
|
+
const px = P.toRawX();
|
|
1675
|
+
const d = hasEvenY(P) ? d0 : CURVE.n - d0;
|
|
1676
|
+
return { m, P, px, d, rand };
|
|
1677
|
+
}
|
|
1678
|
+
function initSchnorrNonce(d, t0h) {
|
|
1679
|
+
return numTo32b(d ^ bytesToNumber(t0h));
|
|
1680
|
+
}
|
|
1681
|
+
function finalizeSchnorrNonce(k0h) {
|
|
1682
|
+
const k0 = mod(bytesToNumber(k0h), CURVE.n);
|
|
1651
1683
|
if (k0 === _0n)
|
|
1652
1684
|
throw new Error('sign: Creation of signature failed. k is zero');
|
|
1653
1685
|
const R = Point.fromPrivateKey(k0);
|
|
1654
|
-
const
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1657
|
-
|
|
1686
|
+
const rx = R.toRawX();
|
|
1687
|
+
const k = hasEvenY(R) ? k0 : CURVE.n - k0;
|
|
1688
|
+
return { R, rx, k };
|
|
1689
|
+
}
|
|
1690
|
+
function finalizeSchnorrSig(R, k, e, d) {
|
|
1691
|
+
return new SchnorrSignature(R.x, mod(k + e * d, CURVE.n)).toRawBytes();
|
|
1692
|
+
}
|
|
1693
|
+
async function schnorrSign(message, privateKey, auxRand = exports.utils.randomBytes()) {
|
|
1694
|
+
const { m, px, d, rand } = initSchnorrSigArgs(message, privateKey, auxRand);
|
|
1695
|
+
const t = initSchnorrNonce(d, await exports.utils.taggedHash(TAGS.aux, rand));
|
|
1696
|
+
const { R, rx, k } = finalizeSchnorrNonce(await exports.utils.taggedHash(TAGS.nonce, t, px, m));
|
|
1697
|
+
const e = finalizeSchnorrChallenge(await exports.utils.taggedHash(TAGS.challenge, rx, px, m));
|
|
1698
|
+
const sig = finalizeSchnorrSig(R, k, e, d);
|
|
1699
|
+
const isValid = await schnorrVerify(sig, m, px);
|
|
1658
1700
|
if (!isValid)
|
|
1659
1701
|
throw new Error('sign: Invalid signature produced');
|
|
1660
|
-
return sig
|
|
1702
|
+
return sig;
|
|
1661
1703
|
}
|
|
1662
|
-
|
|
1663
|
-
const
|
|
1664
|
-
const
|
|
1665
|
-
const
|
|
1666
|
-
const e =
|
|
1667
|
-
const
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1670
|
-
|
|
1704
|
+
function schnorrSignSync(message, privateKey, auxRand = exports.utils.randomBytes()) {
|
|
1705
|
+
const { m, px, d, rand } = initSchnorrSigArgs(message, privateKey, auxRand);
|
|
1706
|
+
const t = initSchnorrNonce(d, exports.utils.taggedHashSync(TAGS.aux, rand));
|
|
1707
|
+
const { R, rx, k } = finalizeSchnorrNonce(exports.utils.taggedHashSync(TAGS.nonce, t, px, m));
|
|
1708
|
+
const e = finalizeSchnorrChallenge(exports.utils.taggedHashSync(TAGS.challenge, rx, px, m));
|
|
1709
|
+
const sig = finalizeSchnorrSig(R, k, e, d);
|
|
1710
|
+
const isValid = schnorrVerifySync(sig, m, px);
|
|
1711
|
+
if (!isValid)
|
|
1712
|
+
throw new Error('sign: Invalid signature produced');
|
|
1713
|
+
return sig;
|
|
1714
|
+
}
|
|
1715
|
+
function initSchnorrVerify(signature, message, publicKey) {
|
|
1716
|
+
const raw = signature instanceof SchnorrSignature;
|
|
1717
|
+
const sig = raw ? signature : SchnorrSignature.fromHex(signature);
|
|
1718
|
+
if (raw)
|
|
1719
|
+
sig.assertValidity();
|
|
1720
|
+
return {
|
|
1721
|
+
...sig,
|
|
1722
|
+
m: ensureBytes(message),
|
|
1723
|
+
P: normalizePublicKey(publicKey),
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
function finalizeSchnorrVerify(r, P, s, e) {
|
|
1727
|
+
const R = Point.BASE.multiplyAndAddUnsafe(P, normalizePrivateKey(s), mod(-e, CURVE.n));
|
|
1728
|
+
if (!R || !hasEvenY(R) || R.x !== r)
|
|
1671
1729
|
return false;
|
|
1672
1730
|
return true;
|
|
1673
1731
|
}
|
|
1732
|
+
async function schnorrVerify(signature, message, publicKey) {
|
|
1733
|
+
try {
|
|
1734
|
+
const { r, s, m, P } = initSchnorrVerify(signature, message, publicKey);
|
|
1735
|
+
const e = finalizeSchnorrChallenge(await exports.utils.taggedHash(TAGS.challenge, numTo32b(r), P.toRawX(), m));
|
|
1736
|
+
return finalizeSchnorrVerify(r, P, s, e);
|
|
1737
|
+
}
|
|
1738
|
+
catch (error) {
|
|
1739
|
+
return false;
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
function schnorrVerifySync(signature, message, publicKey) {
|
|
1743
|
+
try {
|
|
1744
|
+
const { r, s, m, P } = initSchnorrVerify(signature, message, publicKey);
|
|
1745
|
+
const e = finalizeSchnorrChallenge(exports.utils.taggedHashSync(TAGS.challenge, numTo32b(r), P.toRawX(), m));
|
|
1746
|
+
return finalizeSchnorrVerify(r, P, s, e);
|
|
1747
|
+
}
|
|
1748
|
+
catch (error) {
|
|
1749
|
+
return false;
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1674
1752
|
exports.schnorr = {
|
|
1675
1753
|
Signature: SchnorrSignature,
|
|
1676
1754
|
getPublicKey: schnorrGetPublicKey,
|
|
1677
1755
|
sign: schnorrSign,
|
|
1678
1756
|
verify: schnorrVerify,
|
|
1757
|
+
signSync: schnorrSignSync,
|
|
1758
|
+
verifySync: schnorrVerifySync,
|
|
1679
1759
|
};
|
|
1680
1760
|
Point.BASE._setWindowSize(8);
|
|
1681
1761
|
const crypto = {
|
|
1682
|
-
node:
|
|
1762
|
+
node: nodeCrypto,
|
|
1683
1763
|
web: typeof self === 'object' && 'crypto' in self ? self.crypto : undefined,
|
|
1684
1764
|
};
|
|
1765
|
+
const TAGS = {
|
|
1766
|
+
challenge: 'BIP0340/challenge',
|
|
1767
|
+
aux: 'BIP0340/aux',
|
|
1768
|
+
nonce: 'BIP0340/nonce',
|
|
1769
|
+
};
|
|
1770
|
+
const TAGGED_HASH_PREFIXES = {};
|
|
1685
1771
|
exports.utils = {
|
|
1686
1772
|
isValidPrivateKey(privateKey) {
|
|
1687
1773
|
try {
|
|
@@ -1692,6 +1778,35 @@ exports.utils = {
|
|
|
1692
1778
|
return false;
|
|
1693
1779
|
}
|
|
1694
1780
|
},
|
|
1781
|
+
privateAdd: (privateKey, tweak) => {
|
|
1782
|
+
const p = normalizePrivateKey(privateKey);
|
|
1783
|
+
const t = normalizePrivateKey(tweak);
|
|
1784
|
+
return numTo32b(mod(p + t, CURVE.n));
|
|
1785
|
+
},
|
|
1786
|
+
privateNegate: (privateKey) => {
|
|
1787
|
+
const p = normalizePrivateKey(privateKey);
|
|
1788
|
+
return numTo32b(CURVE.n - p);
|
|
1789
|
+
},
|
|
1790
|
+
pointAddScalar: (p, tweak, isCompressed) => {
|
|
1791
|
+
const P = Point.fromHex(p);
|
|
1792
|
+
const t = normalizePrivateKey(tweak);
|
|
1793
|
+
const Q = Point.BASE.multiplyAndAddUnsafe(P, t, _1n);
|
|
1794
|
+
if (!Q)
|
|
1795
|
+
throw new Error('Tweaked point at infinity');
|
|
1796
|
+
return Q.toRawBytes(isCompressed);
|
|
1797
|
+
},
|
|
1798
|
+
pointMultiply: (p, tweak, isCompressed) => {
|
|
1799
|
+
const P = Point.fromHex(p);
|
|
1800
|
+
const t = bytesToNumber(ensureBytes(tweak));
|
|
1801
|
+
return P.multiply(t).toRawBytes(isCompressed);
|
|
1802
|
+
},
|
|
1803
|
+
hashToPrivateKey: (hash) => {
|
|
1804
|
+
hash = ensureBytes(hash);
|
|
1805
|
+
if (hash.length < 40 || hash.length > 1024)
|
|
1806
|
+
throw new Error('Expected 40-1024 bytes of private key as per FIPS 186');
|
|
1807
|
+
const num = mod(bytesToNumber(hash), CURVE.n - _1n) + _1n;
|
|
1808
|
+
return numTo32b(num);
|
|
1809
|
+
},
|
|
1695
1810
|
randomBytes: (bytesLength = 32) => {
|
|
1696
1811
|
if (crypto.web) {
|
|
1697
1812
|
return crypto.web.getRandomValues(new Uint8Array(bytesLength));
|
|
@@ -1705,24 +1820,23 @@ exports.utils = {
|
|
|
1705
1820
|
}
|
|
1706
1821
|
},
|
|
1707
1822
|
randomPrivateKey: () => {
|
|
1708
|
-
|
|
1709
|
-
while (i--) {
|
|
1710
|
-
const b32 = exports.utils.randomBytes(32);
|
|
1711
|
-
const num = bytesToNumber(b32);
|
|
1712
|
-
if (isWithinCurveOrder(num) && num !== _1n)
|
|
1713
|
-
return b32;
|
|
1714
|
-
}
|
|
1715
|
-
throw new Error('Valid private key was not found in 8 iterations. PRNG is broken');
|
|
1823
|
+
return exports.utils.hashToPrivateKey(exports.utils.randomBytes(40));
|
|
1716
1824
|
},
|
|
1717
1825
|
bytesToHex,
|
|
1718
|
-
|
|
1826
|
+
hexToBytes,
|
|
1827
|
+
concatBytes,
|
|
1828
|
+
mod,
|
|
1829
|
+
invert,
|
|
1830
|
+
sha256: async (...messages) => {
|
|
1719
1831
|
if (crypto.web) {
|
|
1720
|
-
const buffer = await crypto.web.subtle.digest('SHA-256',
|
|
1832
|
+
const buffer = await crypto.web.subtle.digest('SHA-256', concatBytes(...messages));
|
|
1721
1833
|
return new Uint8Array(buffer);
|
|
1722
1834
|
}
|
|
1723
1835
|
else if (crypto.node) {
|
|
1724
1836
|
const { createHash } = crypto.node;
|
|
1725
|
-
|
|
1837
|
+
const hash = createHash('sha256');
|
|
1838
|
+
messages.forEach((m) => hash.update(m));
|
|
1839
|
+
return Uint8Array.from(hash.digest());
|
|
1726
1840
|
}
|
|
1727
1841
|
else {
|
|
1728
1842
|
throw new Error("The environment doesn't have sha256 function");
|
|
@@ -1747,6 +1861,26 @@ exports.utils = {
|
|
|
1747
1861
|
},
|
|
1748
1862
|
sha256Sync: undefined,
|
|
1749
1863
|
hmacSha256Sync: undefined,
|
|
1864
|
+
taggedHash: async (tag, ...messages) => {
|
|
1865
|
+
let tagP = TAGGED_HASH_PREFIXES[tag];
|
|
1866
|
+
if (tagP === undefined) {
|
|
1867
|
+
const tagH = await exports.utils.sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0)));
|
|
1868
|
+
tagP = concatBytes(tagH, tagH);
|
|
1869
|
+
TAGGED_HASH_PREFIXES[tag] = tagP;
|
|
1870
|
+
}
|
|
1871
|
+
return exports.utils.sha256(tagP, ...messages);
|
|
1872
|
+
},
|
|
1873
|
+
taggedHashSync: (tag, ...messages) => {
|
|
1874
|
+
if (typeof exports.utils.sha256Sync !== 'function')
|
|
1875
|
+
throw new Error('utils.sha256Sync is undefined, you need to set it');
|
|
1876
|
+
let tagP = TAGGED_HASH_PREFIXES[tag];
|
|
1877
|
+
if (tagP === undefined) {
|
|
1878
|
+
const tagH = exports.utils.sha256Sync(Uint8Array.from(tag, (c) => c.charCodeAt(0)));
|
|
1879
|
+
tagP = concatBytes(tagH, tagH);
|
|
1880
|
+
TAGGED_HASH_PREFIXES[tag] = tagP;
|
|
1881
|
+
}
|
|
1882
|
+
return exports.utils.sha256Sync(tagP, ...messages);
|
|
1883
|
+
},
|
|
1750
1884
|
precompute(windowSize = 8, point = Point.BASE) {
|
|
1751
1885
|
const cached = point === Point.BASE ? point : new Point(point.x, point.y);
|
|
1752
1886
|
cached._setWindowSize(windowSize);
|
|
@@ -3455,7 +3589,7 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
|
|
|
3455
3589
|
case "bytes": gen
|
|
3456
3590
|
("if(typeof d%s===\"string\")", prop)
|
|
3457
3591
|
("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop)
|
|
3458
|
-
("else if(d%s.length)", prop)
|
|
3592
|
+
("else if(d%s.length >= 0)", prop)
|
|
3459
3593
|
("m%s=d%s", prop, prop);
|
|
3460
3594
|
break;
|
|
3461
3595
|
case "string": gen
|
|
@@ -3718,7 +3852,7 @@ function decoder(mtype) {
|
|
|
3718
3852
|
var field = mtype._fieldsArray[i].resolve(),
|
|
3719
3853
|
type = field.resolvedType instanceof Enum ? "int32" : field.type,
|
|
3720
3854
|
ref = "m" + util.safeProp(field.name); gen
|
|
3721
|
-
("case %i:", field.id);
|
|
3855
|
+
("case %i: {", field.id);
|
|
3722
3856
|
|
|
3723
3857
|
// Map fields
|
|
3724
3858
|
if (field.map) { gen
|
|
@@ -3789,8 +3923,9 @@ function decoder(mtype) {
|
|
|
3789
3923
|
else gen
|
|
3790
3924
|
("%s=r.%s()", ref, type);
|
|
3791
3925
|
gen
|
|
3792
|
-
("break")
|
|
3793
|
-
|
|
3926
|
+
("break")
|
|
3927
|
+
("}");
|
|
3928
|
+
// Unknown fields
|
|
3794
3929
|
} gen
|
|
3795
3930
|
("default:")
|
|
3796
3931
|
("r.skipType(t&7)")
|
|
@@ -4196,13 +4331,13 @@ function Field(name, id, type, rule, extend, options, comment) {
|
|
|
4196
4331
|
if (extend !== undefined && !util.isString(extend))
|
|
4197
4332
|
throw TypeError("extend must be a string");
|
|
4198
4333
|
|
|
4199
|
-
if (rule === "proto3_optional") {
|
|
4200
|
-
rule = "optional";
|
|
4201
|
-
}
|
|
4202
4334
|
/**
|
|
4203
4335
|
* Field rule, if any.
|
|
4204
4336
|
* @type {string|undefined}
|
|
4205
4337
|
*/
|
|
4338
|
+
if (rule === "proto3_optional") {
|
|
4339
|
+
rule = "optional";
|
|
4340
|
+
}
|
|
4206
4341
|
this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON
|
|
4207
4342
|
|
|
4208
4343
|
/**
|
|
@@ -4388,6 +4523,9 @@ Field.prototype.resolve = function resolve() {
|
|
|
4388
4523
|
this.typeDefault = null;
|
|
4389
4524
|
else // instanceof Enum
|
|
4390
4525
|
this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined
|
|
4526
|
+
} else if (this.options && this.options.proto3_optional) {
|
|
4527
|
+
// proto3 scalar value marked optional; should default to null
|
|
4528
|
+
this.typeDefault = null;
|
|
4391
4529
|
}
|
|
4392
4530
|
|
|
4393
4531
|
// use explicitly set default value if present
|
|
@@ -5110,7 +5248,6 @@ var ReflectionObject = __webpack_require__(3243);
|
|
|
5110
5248
|
((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace";
|
|
5111
5249
|
|
|
5112
5250
|
var Field = __webpack_require__(3548),
|
|
5113
|
-
OneOf = __webpack_require__(7598),
|
|
5114
5251
|
util = __webpack_require__(9935);
|
|
5115
5252
|
|
|
5116
5253
|
var Type, // cyclic
|
|
@@ -5322,7 +5459,7 @@ Namespace.prototype.getEnum = function getEnum(name) {
|
|
|
5322
5459
|
*/
|
|
5323
5460
|
Namespace.prototype.add = function add(object) {
|
|
5324
5461
|
|
|
5325
|
-
if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace
|
|
5462
|
+
if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))
|
|
5326
5463
|
throw TypeError("object must be a valid nested object");
|
|
5327
5464
|
|
|
5328
5465
|
if (!this.nested)
|
|
@@ -6861,7 +6998,7 @@ module.exports = {};
|
|
|
6861
6998
|
/**
|
|
6862
6999
|
* Named roots.
|
|
6863
7000
|
* This is where pbjs stores generated structures (the option `-r, --root` specifies a name).
|
|
6864
|
-
* Can also be used manually to make roots available
|
|
7001
|
+
* Can also be used manually to make roots available across modules.
|
|
6865
7002
|
* @name roots
|
|
6866
7003
|
* @type {Object.<string,Root>}
|
|
6867
7004
|
* @example
|
|
@@ -8229,6 +8366,9 @@ util.decorateEnum = function decorateEnum(object) {
|
|
|
8229
8366
|
util.setProperty = function setProperty(dst, path, value) {
|
|
8230
8367
|
function setProp(dst, path, value) {
|
|
8231
8368
|
var part = path.shift();
|
|
8369
|
+
if (part === "__proto__") {
|
|
8370
|
+
return dst;
|
|
8371
|
+
}
|
|
8232
8372
|
if (path.length > 0) {
|
|
8233
8373
|
dst[part] = setProp(dst[part] || {}, path, value);
|
|
8234
8374
|
} else {
|
|
@@ -8758,13 +8898,30 @@ function newError(name) {
|
|
|
8758
8898
|
merge(this, properties);
|
|
8759
8899
|
}
|
|
8760
8900
|
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8901
|
+
CustomError.prototype = Object.create(Error.prototype, {
|
|
8902
|
+
constructor: {
|
|
8903
|
+
value: CustomError,
|
|
8904
|
+
writable: true,
|
|
8905
|
+
enumerable: false,
|
|
8906
|
+
configurable: true,
|
|
8907
|
+
},
|
|
8908
|
+
name: {
|
|
8909
|
+
get() { return name; },
|
|
8910
|
+
set: undefined,
|
|
8911
|
+
enumerable: false,
|
|
8912
|
+
// configurable: false would accurately preserve the behavior of
|
|
8913
|
+
// the original, but I'm guessing that was not intentional.
|
|
8914
|
+
// For an actual error subclass, this property would
|
|
8915
|
+
// be configurable.
|
|
8916
|
+
configurable: true,
|
|
8917
|
+
},
|
|
8918
|
+
toString: {
|
|
8919
|
+
value() { return this.name + ": " + this.message; },
|
|
8920
|
+
writable: true,
|
|
8921
|
+
enumerable: false,
|
|
8922
|
+
configurable: true,
|
|
8923
|
+
},
|
|
8924
|
+
});
|
|
8768
8925
|
|
|
8769
8926
|
return CustomError;
|
|
8770
8927
|
}
|
|
@@ -9140,7 +9297,7 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
9140
9297
|
if (type) {
|
|
9141
9298
|
// type_url does not accept leading "."
|
|
9142
9299
|
var type_url = object["@type"].charAt(0) === "." ?
|
|
9143
|
-
object["@type"].
|
|
9300
|
+
object["@type"].slice(1) : object["@type"];
|
|
9144
9301
|
// type_url prefix is optional, but path seperator is required
|
|
9145
9302
|
if (type_url.indexOf("/") === -1) {
|
|
9146
9303
|
type_url = "/" + type_url;
|
|
@@ -9178,7 +9335,7 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
9178
9335
|
if (!(message instanceof this.ctor) && message instanceof Message) {
|
|
9179
9336
|
var object = message.$type.toObject(message, options);
|
|
9180
9337
|
var messageName = message.$type.fullName[0] === "." ?
|
|
9181
|
-
message.$type.fullName.
|
|
9338
|
+
message.$type.fullName.slice(1) : message.$type.fullName;
|
|
9182
9339
|
// Default to type.googleapis.com prefix if no prefix is used
|
|
9183
9340
|
if (prefix === "") {
|
|
9184
9341
|
prefix = googleApi;
|
|
@@ -9845,6 +10002,7 @@ class Contract {
|
|
|
9845
10002
|
this.options = {
|
|
9846
10003
|
signTransaction: true,
|
|
9847
10004
|
sendTransaction: true,
|
|
10005
|
+
broadcast: true,
|
|
9848
10006
|
sendAbis: true,
|
|
9849
10007
|
...c.options,
|
|
9850
10008
|
};
|
|
@@ -9916,7 +10074,7 @@ class Contract {
|
|
|
9916
10074
|
tx = await this.signer.signTransaction(tx, abis);
|
|
9917
10075
|
return { operation, transaction: { ...tx, wait: noWait } };
|
|
9918
10076
|
}
|
|
9919
|
-
const { transaction, receipt } = await this.signer.sendTransaction(tx, abis);
|
|
10077
|
+
const { transaction, receipt } = await this.signer.sendTransaction(tx, opts.broadcast, abis);
|
|
9920
10078
|
return { operation, transaction, receipt };
|
|
9921
10079
|
};
|
|
9922
10080
|
});
|
|
@@ -9966,6 +10124,7 @@ class Contract {
|
|
|
9966
10124
|
* // sign and broadcast
|
|
9967
10125
|
* signTransaction: true,
|
|
9968
10126
|
* sendTransaction: true,
|
|
10127
|
+
* broadcast: true,
|
|
9969
10128
|
* });
|
|
9970
10129
|
* console.log(receipt);
|
|
9971
10130
|
* // wait to be mined
|
|
@@ -10020,7 +10179,7 @@ class Contract {
|
|
|
10020
10179
|
tx = await this.signer.signTransaction(tx);
|
|
10021
10180
|
return { operation, transaction: { ...tx, wait: noWait } };
|
|
10022
10181
|
}
|
|
10023
|
-
const { transaction, receipt } = await this.signer.sendTransaction(tx);
|
|
10182
|
+
const { transaction, receipt } = await this.signer.sendTransaction(tx, opts.broadcast);
|
|
10024
10183
|
return { operation, transaction, receipt };
|
|
10025
10184
|
}
|
|
10026
10185
|
/**
|
|
@@ -10318,16 +10477,16 @@ class Provider {
|
|
|
10318
10477
|
*
|
|
10319
10478
|
* When _byTransactionId_ is used it returns the block id.
|
|
10320
10479
|
*
|
|
10321
|
-
* @param timeout - Timeout in milliseconds. By default it is
|
|
10480
|
+
* @param timeout - Timeout in milliseconds. By default it is 15000
|
|
10322
10481
|
* @example
|
|
10323
10482
|
* ```ts
|
|
10324
10483
|
* const blockNumber = await provider.wait(txId);
|
|
10325
|
-
* // const blockNumber = await provider.wait(txId, "byBlock",
|
|
10326
|
-
* // const blockId = await provider.wait(txId, "byTransactionId",
|
|
10484
|
+
* // const blockNumber = await provider.wait(txId, "byBlock", 15000);
|
|
10485
|
+
* // const blockId = await provider.wait(txId, "byTransactionId", 15000);
|
|
10327
10486
|
* console.log("Transaction mined")
|
|
10328
10487
|
* ```
|
|
10329
10488
|
*/
|
|
10330
|
-
async wait(txId, type = "byBlock", timeout =
|
|
10489
|
+
async wait(txId, type = "byBlock", timeout = 15000) {
|
|
10331
10490
|
const iniTime = Date.now();
|
|
10332
10491
|
if (type === "byTransactionId") {
|
|
10333
10492
|
while (Date.now() < iniTime + timeout) {
|
|
@@ -10343,7 +10502,7 @@ class Provider {
|
|
|
10343
10502
|
// byBlock
|
|
10344
10503
|
const findTxInBlocks = async (ini, numBlocks, idRef) => {
|
|
10345
10504
|
const blocks = await this.getBlocks(ini, numBlocks, idRef);
|
|
10346
|
-
let bNum = 0;
|
|
10505
|
+
let bNum = 0; //console.log(JSON.stringify(blocks,null,2))
|
|
10347
10506
|
blocks.forEach((block) => {
|
|
10348
10507
|
if (!block ||
|
|
10349
10508
|
!block.block ||
|
|
@@ -10391,12 +10550,20 @@ class Provider {
|
|
|
10391
10550
|
/**
|
|
10392
10551
|
* Function to call "chain.submit_transaction" to send a signed
|
|
10393
10552
|
* transaction to the blockchain.
|
|
10553
|
+
*
|
|
10554
|
+
* It also has the option to not broadcast the transaction (to not
|
|
10555
|
+
* include the transaction the mempool), which is useful if you
|
|
10556
|
+
* want to test the interaction with a contract and check the
|
|
10557
|
+
* possible events triggered.
|
|
10558
|
+
* @param transaction - Transaction
|
|
10559
|
+
* @param broadcast - Option to broadcast the transaction to the
|
|
10560
|
+
* whole network. By default it is true.
|
|
10394
10561
|
* @returns It returns the receipt received from the RPC node
|
|
10395
10562
|
* and the transaction with the arrow function "wait" (see [[wait]])
|
|
10396
10563
|
*/
|
|
10397
|
-
async sendTransaction(transaction) {
|
|
10398
|
-
const response = await this.call("chain.submit_transaction", { transaction });
|
|
10399
|
-
transaction.wait = async (type = "byBlock", timeout =
|
|
10564
|
+
async sendTransaction(transaction, broadcast = true) {
|
|
10565
|
+
const response = await this.call("chain.submit_transaction", { transaction, broadcast });
|
|
10566
|
+
transaction.wait = async (type = "byBlock", timeout = 15000) => {
|
|
10400
10567
|
return this.wait(transaction.id, type, timeout);
|
|
10401
10568
|
};
|
|
10402
10569
|
return { ...response, transaction: transaction };
|
|
@@ -10503,6 +10670,7 @@ class Serializer {
|
|
|
10503
10670
|
btypeDecode(valueBtypeEncoded, protobufType) {
|
|
10504
10671
|
const valueBtypeDecoded = {};
|
|
10505
10672
|
Object.keys(protobufType.fields).forEach((fieldName) => {
|
|
10673
|
+
// @ts-ignore
|
|
10506
10674
|
const { options, name, type, rule } = protobufType.fields[fieldName];
|
|
10507
10675
|
if (!valueBtypeEncoded[name])
|
|
10508
10676
|
return;
|
|
@@ -10540,6 +10708,7 @@ class Serializer {
|
|
|
10540
10708
|
btypeEncode(valueBtypeDecoded, protobufType) {
|
|
10541
10709
|
const valueBtypeEncoded = {};
|
|
10542
10710
|
Object.keys(protobufType.fields).forEach((fieldName) => {
|
|
10711
|
+
// @ts-ignore
|
|
10543
10712
|
const { options, name, type, rule } = protobufType.fields[fieldName];
|
|
10544
10713
|
if (!valueBtypeDecoded[name])
|
|
10545
10714
|
return;
|
|
@@ -10632,7 +10801,11 @@ exports["default"] = Serializer;
|
|
|
10632
10801
|
|
|
10633
10802
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10634
10803
|
if (k2 === undefined) k2 = k;
|
|
10635
|
-
Object.
|
|
10804
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10805
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10806
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10807
|
+
}
|
|
10808
|
+
Object.defineProperty(o, k2, desc);
|
|
10636
10809
|
}) : (function(o, m, k, k2) {
|
|
10637
10810
|
if (k2 === undefined) k2 = k;
|
|
10638
10811
|
o[k2] = m[k];
|
|
@@ -10953,17 +11126,19 @@ class Signer {
|
|
|
10953
11126
|
* [[Provider.sendTransaction]]
|
|
10954
11127
|
* @param tx - Transaction to send. It will be signed inside this function
|
|
10955
11128
|
* if it is not signed yet
|
|
11129
|
+
* @param broadcast - Option to broadcast the transaction to the
|
|
11130
|
+
* different nodes in the network
|
|
10956
11131
|
* @param _abis - Collection of Abis to parse the operations in the
|
|
10957
11132
|
* transaction. This parameter is optional.
|
|
10958
11133
|
* @returns
|
|
10959
11134
|
*/
|
|
10960
|
-
async sendTransaction(tx, _abis) {
|
|
11135
|
+
async sendTransaction(tx, broadcast, _abis) {
|
|
10961
11136
|
var _a;
|
|
10962
11137
|
if (!tx.signatures || !((_a = tx.signatures) === null || _a === void 0 ? void 0 : _a.length))
|
|
10963
11138
|
tx = await this.signTransaction(tx);
|
|
10964
11139
|
if (!this.provider)
|
|
10965
11140
|
throw new Error("provider is undefined");
|
|
10966
|
-
return this.provider.sendTransaction(tx);
|
|
11141
|
+
return this.provider.sendTransaction(tx, broadcast);
|
|
10967
11142
|
}
|
|
10968
11143
|
/**
|
|
10969
11144
|
* Function to recover the public key from hash and signature
|
|
@@ -11293,7 +11468,11 @@ exports["default"] = Signer;
|
|
|
11293
11468
|
/*! koilib - MIT License (c) Julian Gonzalez (joticajulian@gmail.com) */
|
|
11294
11469
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11295
11470
|
if (k2 === undefined) k2 = k;
|
|
11296
|
-
Object.
|
|
11471
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11472
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11473
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11474
|
+
}
|
|
11475
|
+
Object.defineProperty(o, k2, desc);
|
|
11297
11476
|
}) : (function(o, m, k, k2) {
|
|
11298
11477
|
if (k2 === undefined) k2 = k;
|
|
11299
11478
|
o[k2] = m[k];
|
|
@@ -11332,7 +11511,11 @@ window.Serializer = Serializer_1.Serializer;
|
|
|
11332
11511
|
|
|
11333
11512
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11334
11513
|
if (k2 === undefined) k2 = k;
|
|
11335
|
-
Object.
|
|
11514
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11515
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11516
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11517
|
+
}
|
|
11518
|
+
Object.defineProperty(o, k2, desc);
|
|
11336
11519
|
}) : (function(o, m, k, k2) {
|
|
11337
11520
|
if (k2 === undefined) k2 = k;
|
|
11338
11521
|
o[k2] = m[k];
|
|
@@ -11938,23 +12121,28 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
11938
12121
|
while (reader.pos < end) {
|
|
11939
12122
|
var tag = reader.uint32();
|
|
11940
12123
|
switch (tag >>> 3) {
|
|
11941
|
-
case 1:
|
|
12124
|
+
case 1: {
|
|
11942
12125
|
message.sequence = reader.uint32();
|
|
11943
12126
|
break;
|
|
11944
|
-
|
|
12127
|
+
}
|
|
12128
|
+
case 2: {
|
|
11945
12129
|
message.source = reader.bytes();
|
|
11946
12130
|
break;
|
|
11947
|
-
|
|
12131
|
+
}
|
|
12132
|
+
case 3: {
|
|
11948
12133
|
message.name = reader.string();
|
|
11949
12134
|
break;
|
|
11950
|
-
|
|
12135
|
+
}
|
|
12136
|
+
case 4: {
|
|
11951
12137
|
message.data = reader.bytes();
|
|
11952
12138
|
break;
|
|
11953
|
-
|
|
12139
|
+
}
|
|
12140
|
+
case 5: {
|
|
11954
12141
|
if (!(message.impacted && message.impacted.length))
|
|
11955
12142
|
message.impacted = [];
|
|
11956
12143
|
message.impacted.push(reader.bytes());
|
|
11957
12144
|
break;
|
|
12145
|
+
}
|
|
11958
12146
|
default:
|
|
11959
12147
|
reader.skipType(tag & 7);
|
|
11960
12148
|
break;
|
|
@@ -12047,7 +12235,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12047
12235
|
)),
|
|
12048
12236
|
0
|
|
12049
12237
|
);
|
|
12050
|
-
else if (object.source.length) message.source = object.source;
|
|
12238
|
+
else if (object.source.length >= 0) message.source = object.source;
|
|
12051
12239
|
if (object.name != null) message.name = String(object.name);
|
|
12052
12240
|
if (object.data != null)
|
|
12053
12241
|
if (typeof object.data === "string")
|
|
@@ -12058,7 +12246,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12058
12246
|
)),
|
|
12059
12247
|
0
|
|
12060
12248
|
);
|
|
12061
|
-
else if (object.data.length) message.data = object.data;
|
|
12249
|
+
else if (object.data.length >= 0) message.data = object.data;
|
|
12062
12250
|
if (object.impacted) {
|
|
12063
12251
|
if (!Array.isArray(object.impacted))
|
|
12064
12252
|
throw TypeError(
|
|
@@ -12074,7 +12262,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12074
12262
|
)),
|
|
12075
12263
|
0
|
|
12076
12264
|
);
|
|
12077
|
-
else if (object.impacted[i].length)
|
|
12265
|
+
else if (object.impacted[i].length >= 0)
|
|
12078
12266
|
message.impacted[i] = object.impacted[i];
|
|
12079
12267
|
}
|
|
12080
12268
|
return message;
|
|
@@ -12155,6 +12343,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12155
12343
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
12156
12344
|
};
|
|
12157
12345
|
|
|
12346
|
+
/**
|
|
12347
|
+
* Gets the default type url for event_data
|
|
12348
|
+
* @function getTypeUrl
|
|
12349
|
+
* @memberof koinos.protocol.event_data
|
|
12350
|
+
* @static
|
|
12351
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
12352
|
+
* @returns {string} The default type url
|
|
12353
|
+
*/
|
|
12354
|
+
event_data.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
12355
|
+
if (typeUrlPrefix === undefined) {
|
|
12356
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
12357
|
+
}
|
|
12358
|
+
return typeUrlPrefix + "/koinos.protocol.event_data";
|
|
12359
|
+
};
|
|
12360
|
+
|
|
12158
12361
|
return event_data;
|
|
12159
12362
|
})();
|
|
12160
12363
|
|
|
@@ -12276,12 +12479,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12276
12479
|
while (reader.pos < end) {
|
|
12277
12480
|
var tag = reader.uint32();
|
|
12278
12481
|
switch (tag >>> 3) {
|
|
12279
|
-
case 1:
|
|
12482
|
+
case 1: {
|
|
12280
12483
|
message.contract_id = reader.bytes();
|
|
12281
12484
|
break;
|
|
12282
|
-
|
|
12485
|
+
}
|
|
12486
|
+
case 2: {
|
|
12283
12487
|
message.entry_point = reader.uint32();
|
|
12284
12488
|
break;
|
|
12489
|
+
}
|
|
12285
12490
|
default:
|
|
12286
12491
|
reader.skipType(tag & 7);
|
|
12287
12492
|
break;
|
|
@@ -12360,7 +12565,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12360
12565
|
)),
|
|
12361
12566
|
0
|
|
12362
12567
|
);
|
|
12363
|
-
else if (object.contract_id.length)
|
|
12568
|
+
else if (object.contract_id.length >= 0)
|
|
12364
12569
|
message.contract_id = object.contract_id;
|
|
12365
12570
|
if (object.entry_point != null)
|
|
12366
12571
|
message.entry_point = object.entry_point >>> 0;
|
|
@@ -12421,6 +12626,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12421
12626
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
12422
12627
|
};
|
|
12423
12628
|
|
|
12629
|
+
/**
|
|
12630
|
+
* Gets the default type url for contract_call_bundle
|
|
12631
|
+
* @function getTypeUrl
|
|
12632
|
+
* @memberof koinos.protocol.contract_call_bundle
|
|
12633
|
+
* @static
|
|
12634
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
12635
|
+
* @returns {string} The default type url
|
|
12636
|
+
*/
|
|
12637
|
+
contract_call_bundle.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
12638
|
+
if (typeUrlPrefix === undefined) {
|
|
12639
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
12640
|
+
}
|
|
12641
|
+
return typeUrlPrefix + "/koinos.protocol.contract_call_bundle";
|
|
12642
|
+
};
|
|
12643
|
+
|
|
12424
12644
|
return contract_call_bundle;
|
|
12425
12645
|
})();
|
|
12426
12646
|
|
|
@@ -12559,16 +12779,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12559
12779
|
while (reader.pos < end) {
|
|
12560
12780
|
var tag = reader.uint32();
|
|
12561
12781
|
switch (tag >>> 3) {
|
|
12562
|
-
case 1:
|
|
12782
|
+
case 1: {
|
|
12563
12783
|
message.thunk_id = reader.uint32();
|
|
12564
12784
|
break;
|
|
12565
|
-
|
|
12785
|
+
}
|
|
12786
|
+
case 2: {
|
|
12566
12787
|
message.system_call_bundle =
|
|
12567
12788
|
$root.koinos.protocol.contract_call_bundle.decode(
|
|
12568
12789
|
reader,
|
|
12569
12790
|
reader.uint32()
|
|
12570
12791
|
);
|
|
12571
12792
|
break;
|
|
12793
|
+
}
|
|
12572
12794
|
default:
|
|
12573
12795
|
reader.skipType(tag & 7);
|
|
12574
12796
|
break;
|
|
@@ -12692,6 +12914,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12692
12914
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
12693
12915
|
};
|
|
12694
12916
|
|
|
12917
|
+
/**
|
|
12918
|
+
* Gets the default type url for system_call_target
|
|
12919
|
+
* @function getTypeUrl
|
|
12920
|
+
* @memberof koinos.protocol.system_call_target
|
|
12921
|
+
* @static
|
|
12922
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
12923
|
+
* @returns {string} The default type url
|
|
12924
|
+
*/
|
|
12925
|
+
system_call_target.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
12926
|
+
if (typeUrlPrefix === undefined) {
|
|
12927
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
12928
|
+
}
|
|
12929
|
+
return typeUrlPrefix + "/koinos.protocol.system_call_target";
|
|
12930
|
+
};
|
|
12931
|
+
|
|
12695
12932
|
return system_call_target;
|
|
12696
12933
|
})();
|
|
12697
12934
|
|
|
@@ -12873,24 +13110,30 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12873
13110
|
while (reader.pos < end) {
|
|
12874
13111
|
var tag = reader.uint32();
|
|
12875
13112
|
switch (tag >>> 3) {
|
|
12876
|
-
case 1:
|
|
13113
|
+
case 1: {
|
|
12877
13114
|
message.contract_id = reader.bytes();
|
|
12878
13115
|
break;
|
|
12879
|
-
|
|
13116
|
+
}
|
|
13117
|
+
case 2: {
|
|
12880
13118
|
message.bytecode = reader.bytes();
|
|
12881
13119
|
break;
|
|
12882
|
-
|
|
13120
|
+
}
|
|
13121
|
+
case 3: {
|
|
12883
13122
|
message.abi = reader.string();
|
|
12884
13123
|
break;
|
|
12885
|
-
|
|
13124
|
+
}
|
|
13125
|
+
case 4: {
|
|
12886
13126
|
message.authorizes_call_contract = reader.bool();
|
|
12887
13127
|
break;
|
|
12888
|
-
|
|
13128
|
+
}
|
|
13129
|
+
case 5: {
|
|
12889
13130
|
message.authorizes_transaction_application = reader.bool();
|
|
12890
13131
|
break;
|
|
12891
|
-
|
|
13132
|
+
}
|
|
13133
|
+
case 6: {
|
|
12892
13134
|
message.authorizes_upload_contract = reader.bool();
|
|
12893
13135
|
break;
|
|
13136
|
+
}
|
|
12894
13137
|
default:
|
|
12895
13138
|
reader.skipType(tag & 7);
|
|
12896
13139
|
break;
|
|
@@ -12992,7 +13235,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
12992
13235
|
)),
|
|
12993
13236
|
0
|
|
12994
13237
|
);
|
|
12995
|
-
else if (object.contract_id.length)
|
|
13238
|
+
else if (object.contract_id.length >= 0)
|
|
12996
13239
|
message.contract_id = object.contract_id;
|
|
12997
13240
|
if (object.bytecode != null)
|
|
12998
13241
|
if (typeof object.bytecode === "string")
|
|
@@ -13003,7 +13246,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13003
13246
|
)),
|
|
13004
13247
|
0
|
|
13005
13248
|
);
|
|
13006
|
-
else if (object.bytecode.length
|
|
13249
|
+
else if (object.bytecode.length >= 0)
|
|
13250
|
+
message.bytecode = object.bytecode;
|
|
13007
13251
|
if (object.abi != null) message.abi = String(object.abi);
|
|
13008
13252
|
if (object.authorizes_call_contract != null)
|
|
13009
13253
|
message.authorizes_call_contract = Boolean(
|
|
@@ -13111,6 +13355,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13111
13355
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
13112
13356
|
};
|
|
13113
13357
|
|
|
13358
|
+
/**
|
|
13359
|
+
* Gets the default type url for upload_contract_operation
|
|
13360
|
+
* @function getTypeUrl
|
|
13361
|
+
* @memberof koinos.protocol.upload_contract_operation
|
|
13362
|
+
* @static
|
|
13363
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
13364
|
+
* @returns {string} The default type url
|
|
13365
|
+
*/
|
|
13366
|
+
upload_contract_operation.getTypeUrl = function getTypeUrl(
|
|
13367
|
+
typeUrlPrefix
|
|
13368
|
+
) {
|
|
13369
|
+
if (typeUrlPrefix === undefined) {
|
|
13370
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
13371
|
+
}
|
|
13372
|
+
return typeUrlPrefix + "/koinos.protocol.upload_contract_operation";
|
|
13373
|
+
};
|
|
13374
|
+
|
|
13114
13375
|
return upload_contract_operation;
|
|
13115
13376
|
})();
|
|
13116
13377
|
|
|
@@ -13246,15 +13507,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13246
13507
|
while (reader.pos < end) {
|
|
13247
13508
|
var tag = reader.uint32();
|
|
13248
13509
|
switch (tag >>> 3) {
|
|
13249
|
-
case 1:
|
|
13510
|
+
case 1: {
|
|
13250
13511
|
message.contract_id = reader.bytes();
|
|
13251
13512
|
break;
|
|
13252
|
-
|
|
13513
|
+
}
|
|
13514
|
+
case 2: {
|
|
13253
13515
|
message.entry_point = reader.uint32();
|
|
13254
13516
|
break;
|
|
13255
|
-
|
|
13517
|
+
}
|
|
13518
|
+
case 3: {
|
|
13256
13519
|
message.args = reader.bytes();
|
|
13257
13520
|
break;
|
|
13521
|
+
}
|
|
13258
13522
|
default:
|
|
13259
13523
|
reader.skipType(tag & 7);
|
|
13260
13524
|
break;
|
|
@@ -13341,7 +13605,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13341
13605
|
)),
|
|
13342
13606
|
0
|
|
13343
13607
|
);
|
|
13344
|
-
else if (object.contract_id.length)
|
|
13608
|
+
else if (object.contract_id.length >= 0)
|
|
13345
13609
|
message.contract_id = object.contract_id;
|
|
13346
13610
|
if (object.entry_point != null)
|
|
13347
13611
|
message.entry_point = object.entry_point >>> 0;
|
|
@@ -13354,7 +13618,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13354
13618
|
)),
|
|
13355
13619
|
0
|
|
13356
13620
|
);
|
|
13357
|
-
else if (object.args.length) message.args = object.args;
|
|
13621
|
+
else if (object.args.length >= 0) message.args = object.args;
|
|
13358
13622
|
return message;
|
|
13359
13623
|
};
|
|
13360
13624
|
|
|
@@ -13425,6 +13689,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13425
13689
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
13426
13690
|
};
|
|
13427
13691
|
|
|
13692
|
+
/**
|
|
13693
|
+
* Gets the default type url for call_contract_operation
|
|
13694
|
+
* @function getTypeUrl
|
|
13695
|
+
* @memberof koinos.protocol.call_contract_operation
|
|
13696
|
+
* @static
|
|
13697
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
13698
|
+
* @returns {string} The default type url
|
|
13699
|
+
*/
|
|
13700
|
+
call_contract_operation.getTypeUrl = function getTypeUrl(
|
|
13701
|
+
typeUrlPrefix
|
|
13702
|
+
) {
|
|
13703
|
+
if (typeUrlPrefix === undefined) {
|
|
13704
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
13705
|
+
}
|
|
13706
|
+
return typeUrlPrefix + "/koinos.protocol.call_contract_operation";
|
|
13707
|
+
};
|
|
13708
|
+
|
|
13428
13709
|
return call_contract_operation;
|
|
13429
13710
|
})();
|
|
13430
13711
|
|
|
@@ -13547,16 +13828,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13547
13828
|
while (reader.pos < end) {
|
|
13548
13829
|
var tag = reader.uint32();
|
|
13549
13830
|
switch (tag >>> 3) {
|
|
13550
|
-
case 1:
|
|
13831
|
+
case 1: {
|
|
13551
13832
|
message.call_id = reader.uint32();
|
|
13552
13833
|
break;
|
|
13553
|
-
|
|
13834
|
+
}
|
|
13835
|
+
case 2: {
|
|
13554
13836
|
message.target =
|
|
13555
13837
|
$root.koinos.protocol.system_call_target.decode(
|
|
13556
13838
|
reader,
|
|
13557
13839
|
reader.uint32()
|
|
13558
13840
|
);
|
|
13559
13841
|
break;
|
|
13842
|
+
}
|
|
13560
13843
|
default:
|
|
13561
13844
|
reader.skipType(tag & 7);
|
|
13562
13845
|
break;
|
|
@@ -13671,6 +13954,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13671
13954
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
13672
13955
|
};
|
|
13673
13956
|
|
|
13957
|
+
/**
|
|
13958
|
+
* Gets the default type url for set_system_call_operation
|
|
13959
|
+
* @function getTypeUrl
|
|
13960
|
+
* @memberof koinos.protocol.set_system_call_operation
|
|
13961
|
+
* @static
|
|
13962
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
13963
|
+
* @returns {string} The default type url
|
|
13964
|
+
*/
|
|
13965
|
+
set_system_call_operation.getTypeUrl = function getTypeUrl(
|
|
13966
|
+
typeUrlPrefix
|
|
13967
|
+
) {
|
|
13968
|
+
if (typeUrlPrefix === undefined) {
|
|
13969
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
13970
|
+
}
|
|
13971
|
+
return typeUrlPrefix + "/koinos.protocol.set_system_call_operation";
|
|
13972
|
+
};
|
|
13973
|
+
|
|
13674
13974
|
return set_system_call_operation;
|
|
13675
13975
|
})();
|
|
13676
13976
|
|
|
@@ -13795,12 +14095,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13795
14095
|
while (reader.pos < end) {
|
|
13796
14096
|
var tag = reader.uint32();
|
|
13797
14097
|
switch (tag >>> 3) {
|
|
13798
|
-
case 1:
|
|
14098
|
+
case 1: {
|
|
13799
14099
|
message.contract_id = reader.bytes();
|
|
13800
14100
|
break;
|
|
13801
|
-
|
|
14101
|
+
}
|
|
14102
|
+
case 2: {
|
|
13802
14103
|
message.system_contract = reader.bool();
|
|
13803
14104
|
break;
|
|
14105
|
+
}
|
|
13804
14106
|
default:
|
|
13805
14107
|
reader.skipType(tag & 7);
|
|
13806
14108
|
break;
|
|
@@ -13882,7 +14184,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13882
14184
|
)),
|
|
13883
14185
|
0
|
|
13884
14186
|
);
|
|
13885
|
-
else if (object.contract_id.length)
|
|
14187
|
+
else if (object.contract_id.length >= 0)
|
|
13886
14188
|
message.contract_id = object.contract_id;
|
|
13887
14189
|
if (object.system_contract != null)
|
|
13888
14190
|
message.system_contract = Boolean(object.system_contract);
|
|
@@ -13946,6 +14248,25 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
13946
14248
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
13947
14249
|
};
|
|
13948
14250
|
|
|
14251
|
+
/**
|
|
14252
|
+
* Gets the default type url for set_system_contract_operation
|
|
14253
|
+
* @function getTypeUrl
|
|
14254
|
+
* @memberof koinos.protocol.set_system_contract_operation
|
|
14255
|
+
* @static
|
|
14256
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
14257
|
+
* @returns {string} The default type url
|
|
14258
|
+
*/
|
|
14259
|
+
set_system_contract_operation.getTypeUrl = function getTypeUrl(
|
|
14260
|
+
typeUrlPrefix
|
|
14261
|
+
) {
|
|
14262
|
+
if (typeUrlPrefix === undefined) {
|
|
14263
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
14264
|
+
}
|
|
14265
|
+
return (
|
|
14266
|
+
typeUrlPrefix + "/koinos.protocol.set_system_contract_operation"
|
|
14267
|
+
);
|
|
14268
|
+
};
|
|
14269
|
+
|
|
13949
14270
|
return set_system_contract_operation;
|
|
13950
14271
|
})();
|
|
13951
14272
|
|
|
@@ -14129,34 +14450,38 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
14129
14450
|
while (reader.pos < end) {
|
|
14130
14451
|
var tag = reader.uint32();
|
|
14131
14452
|
switch (tag >>> 3) {
|
|
14132
|
-
case 1:
|
|
14453
|
+
case 1: {
|
|
14133
14454
|
message.upload_contract =
|
|
14134
14455
|
$root.koinos.protocol.upload_contract_operation.decode(
|
|
14135
14456
|
reader,
|
|
14136
14457
|
reader.uint32()
|
|
14137
14458
|
);
|
|
14138
14459
|
break;
|
|
14139
|
-
|
|
14460
|
+
}
|
|
14461
|
+
case 2: {
|
|
14140
14462
|
message.call_contract =
|
|
14141
14463
|
$root.koinos.protocol.call_contract_operation.decode(
|
|
14142
14464
|
reader,
|
|
14143
14465
|
reader.uint32()
|
|
14144
14466
|
);
|
|
14145
14467
|
break;
|
|
14146
|
-
|
|
14468
|
+
}
|
|
14469
|
+
case 3: {
|
|
14147
14470
|
message.set_system_call =
|
|
14148
14471
|
$root.koinos.protocol.set_system_call_operation.decode(
|
|
14149
14472
|
reader,
|
|
14150
14473
|
reader.uint32()
|
|
14151
14474
|
);
|
|
14152
14475
|
break;
|
|
14153
|
-
|
|
14476
|
+
}
|
|
14477
|
+
case 4: {
|
|
14154
14478
|
message.set_system_contract =
|
|
14155
14479
|
$root.koinos.protocol.set_system_contract_operation.decode(
|
|
14156
14480
|
reader,
|
|
14157
14481
|
reader.uint32()
|
|
14158
14482
|
);
|
|
14159
14483
|
break;
|
|
14484
|
+
}
|
|
14160
14485
|
default:
|
|
14161
14486
|
reader.skipType(tag & 7);
|
|
14162
14487
|
break;
|
|
@@ -14373,6 +14698,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
14373
14698
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
14374
14699
|
};
|
|
14375
14700
|
|
|
14701
|
+
/**
|
|
14702
|
+
* Gets the default type url for operation
|
|
14703
|
+
* @function getTypeUrl
|
|
14704
|
+
* @memberof koinos.protocol.operation
|
|
14705
|
+
* @static
|
|
14706
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
14707
|
+
* @returns {string} The default type url
|
|
14708
|
+
*/
|
|
14709
|
+
operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
14710
|
+
if (typeUrlPrefix === undefined) {
|
|
14711
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
14712
|
+
}
|
|
14713
|
+
return typeUrlPrefix + "/koinos.protocol.operation";
|
|
14714
|
+
};
|
|
14715
|
+
|
|
14376
14716
|
return operation;
|
|
14377
14717
|
})();
|
|
14378
14718
|
|
|
@@ -14552,24 +14892,30 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
14552
14892
|
while (reader.pos < end) {
|
|
14553
14893
|
var tag = reader.uint32();
|
|
14554
14894
|
switch (tag >>> 3) {
|
|
14555
|
-
case 1:
|
|
14895
|
+
case 1: {
|
|
14556
14896
|
message.chain_id = reader.bytes();
|
|
14557
14897
|
break;
|
|
14558
|
-
|
|
14898
|
+
}
|
|
14899
|
+
case 2: {
|
|
14559
14900
|
message.rc_limit = reader.uint64();
|
|
14560
14901
|
break;
|
|
14561
|
-
|
|
14902
|
+
}
|
|
14903
|
+
case 3: {
|
|
14562
14904
|
message.nonce = reader.bytes();
|
|
14563
14905
|
break;
|
|
14564
|
-
|
|
14906
|
+
}
|
|
14907
|
+
case 4: {
|
|
14565
14908
|
message.operation_merkle_root = reader.bytes();
|
|
14566
14909
|
break;
|
|
14567
|
-
|
|
14910
|
+
}
|
|
14911
|
+
case 5: {
|
|
14568
14912
|
message.payer = reader.bytes();
|
|
14569
14913
|
break;
|
|
14570
|
-
|
|
14914
|
+
}
|
|
14915
|
+
case 6: {
|
|
14571
14916
|
message.payee = reader.bytes();
|
|
14572
14917
|
break;
|
|
14918
|
+
}
|
|
14573
14919
|
default:
|
|
14574
14920
|
reader.skipType(tag & 7);
|
|
14575
14921
|
break;
|
|
@@ -14683,7 +15029,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
14683
15029
|
)),
|
|
14684
15030
|
0
|
|
14685
15031
|
);
|
|
14686
|
-
else if (object.chain_id.length
|
|
15032
|
+
else if (object.chain_id.length >= 0)
|
|
15033
|
+
message.chain_id = object.chain_id;
|
|
14687
15034
|
if (object.rc_limit != null)
|
|
14688
15035
|
if ($util.Long)
|
|
14689
15036
|
(message.rc_limit = $util.Long.fromValue(
|
|
@@ -14707,7 +15054,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
14707
15054
|
)),
|
|
14708
15055
|
0
|
|
14709
15056
|
);
|
|
14710
|
-
else if (object.nonce.length) message.nonce = object.nonce;
|
|
15057
|
+
else if (object.nonce.length >= 0) message.nonce = object.nonce;
|
|
14711
15058
|
if (object.operation_merkle_root != null)
|
|
14712
15059
|
if (typeof object.operation_merkle_root === "string")
|
|
14713
15060
|
$util.base64.decode(
|
|
@@ -14717,7 +15064,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
14717
15064
|
)),
|
|
14718
15065
|
0
|
|
14719
15066
|
);
|
|
14720
|
-
else if (object.operation_merkle_root.length)
|
|
15067
|
+
else if (object.operation_merkle_root.length >= 0)
|
|
14721
15068
|
message.operation_merkle_root = object.operation_merkle_root;
|
|
14722
15069
|
if (object.payer != null)
|
|
14723
15070
|
if (typeof object.payer === "string")
|
|
@@ -14728,7 +15075,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
14728
15075
|
)),
|
|
14729
15076
|
0
|
|
14730
15077
|
);
|
|
14731
|
-
else if (object.payer.length) message.payer = object.payer;
|
|
15078
|
+
else if (object.payer.length >= 0) message.payer = object.payer;
|
|
14732
15079
|
if (object.payee != null)
|
|
14733
15080
|
if (typeof object.payee === "string")
|
|
14734
15081
|
$util.base64.decode(
|
|
@@ -14738,7 +15085,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
14738
15085
|
)),
|
|
14739
15086
|
0
|
|
14740
15087
|
);
|
|
14741
|
-
else if (object.payee.length) message.payee = object.payee;
|
|
15088
|
+
else if (object.payee.length >= 0) message.payee = object.payee;
|
|
14742
15089
|
return message;
|
|
14743
15090
|
};
|
|
14744
15091
|
|
|
@@ -14873,6 +15220,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
14873
15220
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
14874
15221
|
};
|
|
14875
15222
|
|
|
15223
|
+
/**
|
|
15224
|
+
* Gets the default type url for transaction_header
|
|
15225
|
+
* @function getTypeUrl
|
|
15226
|
+
* @memberof koinos.protocol.transaction_header
|
|
15227
|
+
* @static
|
|
15228
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
15229
|
+
* @returns {string} The default type url
|
|
15230
|
+
*/
|
|
15231
|
+
transaction_header.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
15232
|
+
if (typeUrlPrefix === undefined) {
|
|
15233
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
15234
|
+
}
|
|
15235
|
+
return typeUrlPrefix + "/koinos.protocol.transaction_header";
|
|
15236
|
+
};
|
|
15237
|
+
|
|
14876
15238
|
return transaction_header;
|
|
14877
15239
|
})();
|
|
14878
15240
|
|
|
@@ -15025,17 +15387,19 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
15025
15387
|
while (reader.pos < end) {
|
|
15026
15388
|
var tag = reader.uint32();
|
|
15027
15389
|
switch (tag >>> 3) {
|
|
15028
|
-
case 1:
|
|
15390
|
+
case 1: {
|
|
15029
15391
|
message.id = reader.bytes();
|
|
15030
15392
|
break;
|
|
15031
|
-
|
|
15393
|
+
}
|
|
15394
|
+
case 2: {
|
|
15032
15395
|
message.header =
|
|
15033
15396
|
$root.koinos.protocol.transaction_header.decode(
|
|
15034
15397
|
reader,
|
|
15035
15398
|
reader.uint32()
|
|
15036
15399
|
);
|
|
15037
15400
|
break;
|
|
15038
|
-
|
|
15401
|
+
}
|
|
15402
|
+
case 3: {
|
|
15039
15403
|
if (!(message.operations && message.operations.length))
|
|
15040
15404
|
message.operations = [];
|
|
15041
15405
|
message.operations.push(
|
|
@@ -15045,11 +15409,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
15045
15409
|
)
|
|
15046
15410
|
);
|
|
15047
15411
|
break;
|
|
15048
|
-
|
|
15412
|
+
}
|
|
15413
|
+
case 4: {
|
|
15049
15414
|
if (!(message.signatures && message.signatures.length))
|
|
15050
15415
|
message.signatures = [];
|
|
15051
15416
|
message.signatures.push(reader.bytes());
|
|
15052
15417
|
break;
|
|
15418
|
+
}
|
|
15053
15419
|
default:
|
|
15054
15420
|
reader.skipType(tag & 7);
|
|
15055
15421
|
break;
|
|
@@ -15149,7 +15515,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
15149
15515
|
(message.id = $util.newBuffer($util.base64.length(object.id))),
|
|
15150
15516
|
0
|
|
15151
15517
|
);
|
|
15152
|
-
else if (object.id.length) message.id = object.id;
|
|
15518
|
+
else if (object.id.length >= 0) message.id = object.id;
|
|
15153
15519
|
if (object.header != null) {
|
|
15154
15520
|
if (typeof object.header !== "object")
|
|
15155
15521
|
throw TypeError(
|
|
@@ -15192,7 +15558,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
15192
15558
|
)),
|
|
15193
15559
|
0
|
|
15194
15560
|
);
|
|
15195
|
-
else if (object.signatures[i].length)
|
|
15561
|
+
else if (object.signatures[i].length >= 0)
|
|
15196
15562
|
message.signatures[i] = object.signatures[i];
|
|
15197
15563
|
}
|
|
15198
15564
|
return message;
|
|
@@ -15271,6 +15637,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
15271
15637
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
15272
15638
|
};
|
|
15273
15639
|
|
|
15640
|
+
/**
|
|
15641
|
+
* Gets the default type url for transaction
|
|
15642
|
+
* @function getTypeUrl
|
|
15643
|
+
* @memberof koinos.protocol.transaction
|
|
15644
|
+
* @static
|
|
15645
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
15646
|
+
* @returns {string} The default type url
|
|
15647
|
+
*/
|
|
15648
|
+
transaction.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
15649
|
+
if (typeUrlPrefix === undefined) {
|
|
15650
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
15651
|
+
}
|
|
15652
|
+
return typeUrlPrefix + "/koinos.protocol.transaction";
|
|
15653
|
+
};
|
|
15654
|
+
|
|
15274
15655
|
return transaction;
|
|
15275
15656
|
})();
|
|
15276
15657
|
|
|
@@ -15536,34 +15917,43 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
15536
15917
|
while (reader.pos < end) {
|
|
15537
15918
|
var tag = reader.uint32();
|
|
15538
15919
|
switch (tag >>> 3) {
|
|
15539
|
-
case 1:
|
|
15920
|
+
case 1: {
|
|
15540
15921
|
message.id = reader.bytes();
|
|
15541
15922
|
break;
|
|
15542
|
-
|
|
15923
|
+
}
|
|
15924
|
+
case 2: {
|
|
15543
15925
|
message.payer = reader.bytes();
|
|
15544
15926
|
break;
|
|
15545
|
-
|
|
15927
|
+
}
|
|
15928
|
+
case 3: {
|
|
15546
15929
|
message.max_payer_rc = reader.uint64();
|
|
15547
15930
|
break;
|
|
15548
|
-
|
|
15931
|
+
}
|
|
15932
|
+
case 4: {
|
|
15549
15933
|
message.rc_limit = reader.uint64();
|
|
15550
15934
|
break;
|
|
15551
|
-
|
|
15935
|
+
}
|
|
15936
|
+
case 5: {
|
|
15552
15937
|
message.rc_used = reader.uint64();
|
|
15553
15938
|
break;
|
|
15554
|
-
|
|
15939
|
+
}
|
|
15940
|
+
case 6: {
|
|
15555
15941
|
message.disk_storage_used = reader.uint64();
|
|
15556
15942
|
break;
|
|
15557
|
-
|
|
15943
|
+
}
|
|
15944
|
+
case 7: {
|
|
15558
15945
|
message.network_bandwidth_used = reader.uint64();
|
|
15559
15946
|
break;
|
|
15560
|
-
|
|
15947
|
+
}
|
|
15948
|
+
case 8: {
|
|
15561
15949
|
message.compute_bandwidth_used = reader.uint64();
|
|
15562
15950
|
break;
|
|
15563
|
-
|
|
15951
|
+
}
|
|
15952
|
+
case 9: {
|
|
15564
15953
|
message.reverted = reader.bool();
|
|
15565
15954
|
break;
|
|
15566
|
-
|
|
15955
|
+
}
|
|
15956
|
+
case 10: {
|
|
15567
15957
|
if (!(message.events && message.events.length))
|
|
15568
15958
|
message.events = [];
|
|
15569
15959
|
message.events.push(
|
|
@@ -15573,10 +15963,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
15573
15963
|
)
|
|
15574
15964
|
);
|
|
15575
15965
|
break;
|
|
15576
|
-
|
|
15966
|
+
}
|
|
15967
|
+
case 11: {
|
|
15577
15968
|
if (!(message.logs && message.logs.length)) message.logs = [];
|
|
15578
15969
|
message.logs.push(reader.string());
|
|
15579
15970
|
break;
|
|
15971
|
+
}
|
|
15580
15972
|
default:
|
|
15581
15973
|
reader.skipType(tag & 7);
|
|
15582
15974
|
break;
|
|
@@ -15739,7 +16131,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
15739
16131
|
(message.id = $util.newBuffer($util.base64.length(object.id))),
|
|
15740
16132
|
0
|
|
15741
16133
|
);
|
|
15742
|
-
else if (object.id.length) message.id = object.id;
|
|
16134
|
+
else if (object.id.length >= 0) message.id = object.id;
|
|
15743
16135
|
if (object.payer != null)
|
|
15744
16136
|
if (typeof object.payer === "string")
|
|
15745
16137
|
$util.base64.decode(
|
|
@@ -15749,7 +16141,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
15749
16141
|
)),
|
|
15750
16142
|
0
|
|
15751
16143
|
);
|
|
15752
|
-
else if (object.payer.length) message.payer = object.payer;
|
|
16144
|
+
else if (object.payer.length >= 0) message.payer = object.payer;
|
|
15753
16145
|
if (object.max_payer_rc != null)
|
|
15754
16146
|
if ($util.Long)
|
|
15755
16147
|
(message.max_payer_rc = $util.Long.fromValue(
|
|
@@ -16120,6 +16512,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16120
16512
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
16121
16513
|
};
|
|
16122
16514
|
|
|
16515
|
+
/**
|
|
16516
|
+
* Gets the default type url for transaction_receipt
|
|
16517
|
+
* @function getTypeUrl
|
|
16518
|
+
* @memberof koinos.protocol.transaction_receipt
|
|
16519
|
+
* @static
|
|
16520
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
16521
|
+
* @returns {string} The default type url
|
|
16522
|
+
*/
|
|
16523
|
+
transaction_receipt.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
16524
|
+
if (typeUrlPrefix === undefined) {
|
|
16525
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
16526
|
+
}
|
|
16527
|
+
return typeUrlPrefix + "/koinos.protocol.transaction_receipt";
|
|
16528
|
+
};
|
|
16529
|
+
|
|
16123
16530
|
return transaction_receipt;
|
|
16124
16531
|
})();
|
|
16125
16532
|
|
|
@@ -16134,6 +16541,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16134
16541
|
* @property {Uint8Array|null} [previous_state_merkle_root] block_header previous_state_merkle_root
|
|
16135
16542
|
* @property {Uint8Array|null} [transaction_merkle_root] block_header transaction_merkle_root
|
|
16136
16543
|
* @property {Uint8Array|null} [signer] block_header signer
|
|
16544
|
+
* @property {Array.<Uint8Array>|null} [approved_proposals] block_header approved_proposals
|
|
16137
16545
|
*/
|
|
16138
16546
|
|
|
16139
16547
|
/**
|
|
@@ -16145,6 +16553,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16145
16553
|
* @param {koinos.protocol.Iblock_header=} [properties] Properties to set
|
|
16146
16554
|
*/
|
|
16147
16555
|
function block_header(properties) {
|
|
16556
|
+
this.approved_proposals = [];
|
|
16148
16557
|
if (properties)
|
|
16149
16558
|
for (
|
|
16150
16559
|
var keys = Object.keys(properties), i = 0;
|
|
@@ -16207,6 +16616,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16207
16616
|
*/
|
|
16208
16617
|
block_header.prototype.signer = $util.newBuffer([]);
|
|
16209
16618
|
|
|
16619
|
+
/**
|
|
16620
|
+
* block_header approved_proposals.
|
|
16621
|
+
* @member {Array.<Uint8Array>} approved_proposals
|
|
16622
|
+
* @memberof koinos.protocol.block_header
|
|
16623
|
+
* @instance
|
|
16624
|
+
*/
|
|
16625
|
+
block_header.prototype.approved_proposals = $util.emptyArray;
|
|
16626
|
+
|
|
16210
16627
|
/**
|
|
16211
16628
|
* Creates a new block_header instance using the specified properties.
|
|
16212
16629
|
* @function create
|
|
@@ -16264,6 +16681,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16264
16681
|
Object.hasOwnProperty.call(message, "signer")
|
|
16265
16682
|
)
|
|
16266
16683
|
writer.uint32(/* id 6, wireType 2 =*/ 50).bytes(message.signer);
|
|
16684
|
+
if (
|
|
16685
|
+
message.approved_proposals != null &&
|
|
16686
|
+
message.approved_proposals.length
|
|
16687
|
+
)
|
|
16688
|
+
for (var i = 0; i < message.approved_proposals.length; ++i)
|
|
16689
|
+
writer
|
|
16690
|
+
.uint32(/* id 7, wireType 2 =*/ 58)
|
|
16691
|
+
.bytes(message.approved_proposals[i]);
|
|
16267
16692
|
return writer;
|
|
16268
16693
|
};
|
|
16269
16694
|
|
|
@@ -16301,24 +16726,41 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16301
16726
|
while (reader.pos < end) {
|
|
16302
16727
|
var tag = reader.uint32();
|
|
16303
16728
|
switch (tag >>> 3) {
|
|
16304
|
-
case 1:
|
|
16729
|
+
case 1: {
|
|
16305
16730
|
message.previous = reader.bytes();
|
|
16306
16731
|
break;
|
|
16307
|
-
|
|
16732
|
+
}
|
|
16733
|
+
case 2: {
|
|
16308
16734
|
message.height = reader.uint64();
|
|
16309
16735
|
break;
|
|
16310
|
-
|
|
16736
|
+
}
|
|
16737
|
+
case 3: {
|
|
16311
16738
|
message.timestamp = reader.uint64();
|
|
16312
16739
|
break;
|
|
16313
|
-
|
|
16740
|
+
}
|
|
16741
|
+
case 4: {
|
|
16314
16742
|
message.previous_state_merkle_root = reader.bytes();
|
|
16315
16743
|
break;
|
|
16316
|
-
|
|
16744
|
+
}
|
|
16745
|
+
case 5: {
|
|
16317
16746
|
message.transaction_merkle_root = reader.bytes();
|
|
16318
16747
|
break;
|
|
16319
|
-
|
|
16748
|
+
}
|
|
16749
|
+
case 6: {
|
|
16320
16750
|
message.signer = reader.bytes();
|
|
16321
16751
|
break;
|
|
16752
|
+
}
|
|
16753
|
+
case 7: {
|
|
16754
|
+
if (
|
|
16755
|
+
!(
|
|
16756
|
+
message.approved_proposals &&
|
|
16757
|
+
message.approved_proposals.length
|
|
16758
|
+
)
|
|
16759
|
+
)
|
|
16760
|
+
message.approved_proposals = [];
|
|
16761
|
+
message.approved_proposals.push(reader.bytes());
|
|
16762
|
+
break;
|
|
16763
|
+
}
|
|
16322
16764
|
default:
|
|
16323
16765
|
reader.skipType(tag & 7);
|
|
16324
16766
|
break;
|
|
@@ -16415,6 +16857,22 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16415
16857
|
)
|
|
16416
16858
|
)
|
|
16417
16859
|
return "signer: buffer expected";
|
|
16860
|
+
if (
|
|
16861
|
+
message.approved_proposals != null &&
|
|
16862
|
+
message.hasOwnProperty("approved_proposals")
|
|
16863
|
+
) {
|
|
16864
|
+
if (!Array.isArray(message.approved_proposals))
|
|
16865
|
+
return "approved_proposals: array expected";
|
|
16866
|
+
for (var i = 0; i < message.approved_proposals.length; ++i)
|
|
16867
|
+
if (
|
|
16868
|
+
!(
|
|
16869
|
+
(message.approved_proposals[i] &&
|
|
16870
|
+
typeof message.approved_proposals[i].length === "number") ||
|
|
16871
|
+
$util.isString(message.approved_proposals[i])
|
|
16872
|
+
)
|
|
16873
|
+
)
|
|
16874
|
+
return "approved_proposals: buffer[] expected";
|
|
16875
|
+
}
|
|
16418
16876
|
return null;
|
|
16419
16877
|
};
|
|
16420
16878
|
|
|
@@ -16439,7 +16897,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16439
16897
|
)),
|
|
16440
16898
|
0
|
|
16441
16899
|
);
|
|
16442
|
-
else if (object.previous.length
|
|
16900
|
+
else if (object.previous.length >= 0)
|
|
16901
|
+
message.previous = object.previous;
|
|
16443
16902
|
if (object.height != null)
|
|
16444
16903
|
if ($util.Long)
|
|
16445
16904
|
(message.height = $util.Long.fromValue(
|
|
@@ -16477,7 +16936,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16477
16936
|
)),
|
|
16478
16937
|
0
|
|
16479
16938
|
);
|
|
16480
|
-
else if (object.previous_state_merkle_root.length)
|
|
16939
|
+
else if (object.previous_state_merkle_root.length >= 0)
|
|
16481
16940
|
message.previous_state_merkle_root =
|
|
16482
16941
|
object.previous_state_merkle_root;
|
|
16483
16942
|
if (object.transaction_merkle_root != null)
|
|
@@ -16489,7 +16948,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16489
16948
|
)),
|
|
16490
16949
|
0
|
|
16491
16950
|
);
|
|
16492
|
-
else if (object.transaction_merkle_root.length)
|
|
16951
|
+
else if (object.transaction_merkle_root.length >= 0)
|
|
16493
16952
|
message.transaction_merkle_root = object.transaction_merkle_root;
|
|
16494
16953
|
if (object.signer != null)
|
|
16495
16954
|
if (typeof object.signer === "string")
|
|
@@ -16500,7 +16959,25 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16500
16959
|
)),
|
|
16501
16960
|
0
|
|
16502
16961
|
);
|
|
16503
|
-
else if (object.signer.length) message.signer = object.signer;
|
|
16962
|
+
else if (object.signer.length >= 0) message.signer = object.signer;
|
|
16963
|
+
if (object.approved_proposals) {
|
|
16964
|
+
if (!Array.isArray(object.approved_proposals))
|
|
16965
|
+
throw TypeError(
|
|
16966
|
+
".koinos.protocol.block_header.approved_proposals: array expected"
|
|
16967
|
+
);
|
|
16968
|
+
message.approved_proposals = [];
|
|
16969
|
+
for (var i = 0; i < object.approved_proposals.length; ++i)
|
|
16970
|
+
if (typeof object.approved_proposals[i] === "string")
|
|
16971
|
+
$util.base64.decode(
|
|
16972
|
+
object.approved_proposals[i],
|
|
16973
|
+
(message.approved_proposals[i] = $util.newBuffer(
|
|
16974
|
+
$util.base64.length(object.approved_proposals[i])
|
|
16975
|
+
)),
|
|
16976
|
+
0
|
|
16977
|
+
);
|
|
16978
|
+
else if (object.approved_proposals[i].length >= 0)
|
|
16979
|
+
message.approved_proposals[i] = object.approved_proposals[i];
|
|
16980
|
+
}
|
|
16504
16981
|
return message;
|
|
16505
16982
|
};
|
|
16506
16983
|
|
|
@@ -16516,6 +16993,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16516
16993
|
block_header.toObject = function toObject(message, options) {
|
|
16517
16994
|
if (!options) options = {};
|
|
16518
16995
|
var object = {};
|
|
16996
|
+
if (options.arrays || options.defaults)
|
|
16997
|
+
object.approved_proposals = [];
|
|
16519
16998
|
if (options.defaults) {
|
|
16520
16999
|
if (options.bytes === String) object.previous = "";
|
|
16521
17000
|
else {
|
|
@@ -16643,6 +17122,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16643
17122
|
: options.bytes === Array
|
|
16644
17123
|
? Array.prototype.slice.call(message.signer)
|
|
16645
17124
|
: message.signer;
|
|
17125
|
+
if (message.approved_proposals && message.approved_proposals.length) {
|
|
17126
|
+
object.approved_proposals = [];
|
|
17127
|
+
for (var j = 0; j < message.approved_proposals.length; ++j)
|
|
17128
|
+
object.approved_proposals[j] =
|
|
17129
|
+
options.bytes === String
|
|
17130
|
+
? $util.base64.encode(
|
|
17131
|
+
message.approved_proposals[j],
|
|
17132
|
+
0,
|
|
17133
|
+
message.approved_proposals[j].length
|
|
17134
|
+
)
|
|
17135
|
+
: options.bytes === Array
|
|
17136
|
+
? Array.prototype.slice.call(message.approved_proposals[j])
|
|
17137
|
+
: message.approved_proposals[j];
|
|
17138
|
+
}
|
|
16646
17139
|
return object;
|
|
16647
17140
|
};
|
|
16648
17141
|
|
|
@@ -16657,6 +17150,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16657
17150
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
16658
17151
|
};
|
|
16659
17152
|
|
|
17153
|
+
/**
|
|
17154
|
+
* Gets the default type url for block_header
|
|
17155
|
+
* @function getTypeUrl
|
|
17156
|
+
* @memberof koinos.protocol.block_header
|
|
17157
|
+
* @static
|
|
17158
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
17159
|
+
* @returns {string} The default type url
|
|
17160
|
+
*/
|
|
17161
|
+
block_header.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
17162
|
+
if (typeUrlPrefix === undefined) {
|
|
17163
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
17164
|
+
}
|
|
17165
|
+
return typeUrlPrefix + "/koinos.protocol.block_header";
|
|
17166
|
+
};
|
|
17167
|
+
|
|
16660
17168
|
return block_header;
|
|
16661
17169
|
})();
|
|
16662
17170
|
|
|
@@ -16805,16 +17313,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16805
17313
|
while (reader.pos < end) {
|
|
16806
17314
|
var tag = reader.uint32();
|
|
16807
17315
|
switch (tag >>> 3) {
|
|
16808
|
-
case 1:
|
|
17316
|
+
case 1: {
|
|
16809
17317
|
message.id = reader.bytes();
|
|
16810
17318
|
break;
|
|
16811
|
-
|
|
17319
|
+
}
|
|
17320
|
+
case 2: {
|
|
16812
17321
|
message.header = $root.koinos.protocol.block_header.decode(
|
|
16813
17322
|
reader,
|
|
16814
17323
|
reader.uint32()
|
|
16815
17324
|
);
|
|
16816
17325
|
break;
|
|
16817
|
-
|
|
17326
|
+
}
|
|
17327
|
+
case 3: {
|
|
16818
17328
|
if (!(message.transactions && message.transactions.length))
|
|
16819
17329
|
message.transactions = [];
|
|
16820
17330
|
message.transactions.push(
|
|
@@ -16824,9 +17334,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16824
17334
|
)
|
|
16825
17335
|
);
|
|
16826
17336
|
break;
|
|
16827
|
-
|
|
17337
|
+
}
|
|
17338
|
+
case 4: {
|
|
16828
17339
|
message.signature = reader.bytes();
|
|
16829
17340
|
break;
|
|
17341
|
+
}
|
|
16830
17342
|
default:
|
|
16831
17343
|
reader.skipType(tag & 7);
|
|
16832
17344
|
break;
|
|
@@ -16918,7 +17430,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16918
17430
|
(message.id = $util.newBuffer($util.base64.length(object.id))),
|
|
16919
17431
|
0
|
|
16920
17432
|
);
|
|
16921
|
-
else if (object.id.length) message.id = object.id;
|
|
17433
|
+
else if (object.id.length >= 0) message.id = object.id;
|
|
16922
17434
|
if (object.header != null) {
|
|
16923
17435
|
if (typeof object.header !== "object")
|
|
16924
17436
|
throw TypeError(".koinos.protocol.block.header: object expected");
|
|
@@ -16952,7 +17464,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
16952
17464
|
)),
|
|
16953
17465
|
0
|
|
16954
17466
|
);
|
|
16955
|
-
else if (object.signature.length)
|
|
17467
|
+
else if (object.signature.length >= 0)
|
|
16956
17468
|
message.signature = object.signature;
|
|
16957
17469
|
return message;
|
|
16958
17470
|
};
|
|
@@ -17031,6 +17543,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
17031
17543
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
17032
17544
|
};
|
|
17033
17545
|
|
|
17546
|
+
/**
|
|
17547
|
+
* Gets the default type url for block
|
|
17548
|
+
* @function getTypeUrl
|
|
17549
|
+
* @memberof koinos.protocol.block
|
|
17550
|
+
* @static
|
|
17551
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
17552
|
+
* @returns {string} The default type url
|
|
17553
|
+
*/
|
|
17554
|
+
block.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
17555
|
+
if (typeUrlPrefix === undefined) {
|
|
17556
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
17557
|
+
}
|
|
17558
|
+
return typeUrlPrefix + "/koinos.protocol.block";
|
|
17559
|
+
};
|
|
17560
|
+
|
|
17034
17561
|
return block;
|
|
17035
17562
|
})();
|
|
17036
17563
|
|
|
@@ -17269,25 +17796,31 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
17269
17796
|
while (reader.pos < end) {
|
|
17270
17797
|
var tag = reader.uint32();
|
|
17271
17798
|
switch (tag >>> 3) {
|
|
17272
|
-
case 1:
|
|
17799
|
+
case 1: {
|
|
17273
17800
|
message.id = reader.bytes();
|
|
17274
17801
|
break;
|
|
17275
|
-
|
|
17802
|
+
}
|
|
17803
|
+
case 2: {
|
|
17276
17804
|
message.height = reader.uint64();
|
|
17277
17805
|
break;
|
|
17278
|
-
|
|
17806
|
+
}
|
|
17807
|
+
case 3: {
|
|
17279
17808
|
message.disk_storage_used = reader.uint64();
|
|
17280
17809
|
break;
|
|
17281
|
-
|
|
17810
|
+
}
|
|
17811
|
+
case 4: {
|
|
17282
17812
|
message.network_bandwidth_used = reader.uint64();
|
|
17283
17813
|
break;
|
|
17284
|
-
|
|
17814
|
+
}
|
|
17815
|
+
case 5: {
|
|
17285
17816
|
message.compute_bandwidth_used = reader.uint64();
|
|
17286
17817
|
break;
|
|
17287
|
-
|
|
17818
|
+
}
|
|
17819
|
+
case 6: {
|
|
17288
17820
|
message.state_merkle_root = reader.bytes();
|
|
17289
17821
|
break;
|
|
17290
|
-
|
|
17822
|
+
}
|
|
17823
|
+
case 7: {
|
|
17291
17824
|
if (!(message.events && message.events.length))
|
|
17292
17825
|
message.events = [];
|
|
17293
17826
|
message.events.push(
|
|
@@ -17297,7 +17830,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
17297
17830
|
)
|
|
17298
17831
|
);
|
|
17299
17832
|
break;
|
|
17300
|
-
|
|
17833
|
+
}
|
|
17834
|
+
case 8: {
|
|
17301
17835
|
if (
|
|
17302
17836
|
!(
|
|
17303
17837
|
message.transaction_receipts &&
|
|
@@ -17312,10 +17846,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
17312
17846
|
)
|
|
17313
17847
|
);
|
|
17314
17848
|
break;
|
|
17315
|
-
|
|
17849
|
+
}
|
|
17850
|
+
case 9: {
|
|
17316
17851
|
if (!(message.logs && message.logs.length)) message.logs = [];
|
|
17317
17852
|
message.logs.push(reader.string());
|
|
17318
17853
|
break;
|
|
17854
|
+
}
|
|
17319
17855
|
default:
|
|
17320
17856
|
reader.skipType(tag & 7);
|
|
17321
17857
|
break;
|
|
@@ -17469,7 +18005,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
17469
18005
|
(message.id = $util.newBuffer($util.base64.length(object.id))),
|
|
17470
18006
|
0
|
|
17471
18007
|
);
|
|
17472
|
-
else if (object.id.length) message.id = object.id;
|
|
18008
|
+
else if (object.id.length >= 0) message.id = object.id;
|
|
17473
18009
|
if (object.height != null)
|
|
17474
18010
|
if ($util.Long)
|
|
17475
18011
|
(message.height = $util.Long.fromValue(
|
|
@@ -17544,7 +18080,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
17544
18080
|
)),
|
|
17545
18081
|
0
|
|
17546
18082
|
);
|
|
17547
|
-
else if (object.state_merkle_root.length)
|
|
18083
|
+
else if (object.state_merkle_root.length >= 0)
|
|
17548
18084
|
message.state_merkle_root = object.state_merkle_root;
|
|
17549
18085
|
if (object.events) {
|
|
17550
18086
|
if (!Array.isArray(object.events))
|
|
@@ -17804,6 +18340,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
17804
18340
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
17805
18341
|
};
|
|
17806
18342
|
|
|
18343
|
+
/**
|
|
18344
|
+
* Gets the default type url for block_receipt
|
|
18345
|
+
* @function getTypeUrl
|
|
18346
|
+
* @memberof koinos.protocol.block_receipt
|
|
18347
|
+
* @static
|
|
18348
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
18349
|
+
* @returns {string} The default type url
|
|
18350
|
+
*/
|
|
18351
|
+
block_receipt.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
18352
|
+
if (typeUrlPrefix === undefined) {
|
|
18353
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
18354
|
+
}
|
|
18355
|
+
return typeUrlPrefix + "/koinos.protocol.block_receipt";
|
|
18356
|
+
};
|
|
18357
|
+
|
|
17807
18358
|
return block_receipt;
|
|
17808
18359
|
})();
|
|
17809
18360
|
|
|
@@ -17824,8 +18375,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
17824
18375
|
* @memberof koinos.chain
|
|
17825
18376
|
* @interface Ivalue_type
|
|
17826
18377
|
* @property {google.protobuf.IAny|null} [message_value] value_type message_value
|
|
17827
|
-
* @property {number|null} [double_value] value_type double_value
|
|
17828
|
-
* @property {number|null} [float_value] value_type float_value
|
|
17829
18378
|
* @property {number|null} [int32_value] value_type int32_value
|
|
17830
18379
|
* @property {number|Long|null} [int64_value] value_type int64_value
|
|
17831
18380
|
* @property {number|null} [uint32_value] value_type uint32_value
|
|
@@ -17868,22 +18417,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
17868
18417
|
*/
|
|
17869
18418
|
value_type.prototype.message_value = null;
|
|
17870
18419
|
|
|
17871
|
-
/**
|
|
17872
|
-
* value_type double_value.
|
|
17873
|
-
* @member {number|null|undefined} double_value
|
|
17874
|
-
* @memberof koinos.chain.value_type
|
|
17875
|
-
* @instance
|
|
17876
|
-
*/
|
|
17877
|
-
value_type.prototype.double_value = null;
|
|
17878
|
-
|
|
17879
|
-
/**
|
|
17880
|
-
* value_type float_value.
|
|
17881
|
-
* @member {number|null|undefined} float_value
|
|
17882
|
-
* @memberof koinos.chain.value_type
|
|
17883
|
-
* @instance
|
|
17884
|
-
*/
|
|
17885
|
-
value_type.prototype.float_value = null;
|
|
17886
|
-
|
|
17887
18420
|
/**
|
|
17888
18421
|
* value_type int32_value.
|
|
17889
18422
|
* @member {number|null|undefined} int32_value
|
|
@@ -17993,7 +18526,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
17993
18526
|
|
|
17994
18527
|
/**
|
|
17995
18528
|
* value_type kind.
|
|
17996
|
-
* @member {"message_value"|"
|
|
18529
|
+
* @member {"message_value"|"int32_value"|"int64_value"|"uint32_value"|"uint64_value"|"sint32_value"|"sint64_value"|"fixed32_value"|"fixed64_value"|"sfixed32_value"|"sfixed64_value"|"bool_value"|"string_value"|"bytes_value"|undefined} kind
|
|
17997
18530
|
* @memberof koinos.chain.value_type
|
|
17998
18531
|
* @instance
|
|
17999
18532
|
*/
|
|
@@ -18001,8 +18534,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
18001
18534
|
get: $util.oneOfGetter(
|
|
18002
18535
|
($oneOfFields = [
|
|
18003
18536
|
"message_value",
|
|
18004
|
-
"double_value",
|
|
18005
|
-
"float_value",
|
|
18006
18537
|
"int32_value",
|
|
18007
18538
|
"int64_value",
|
|
18008
18539
|
"uint32_value",
|
|
@@ -18052,110 +18583,94 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
18052
18583
|
message.message_value,
|
|
18053
18584
|
writer.uint32(/* id 1, wireType 2 =*/ 10).fork()
|
|
18054
18585
|
).ldelim();
|
|
18055
|
-
if (
|
|
18056
|
-
message.double_value != null &&
|
|
18057
|
-
Object.hasOwnProperty.call(message, "double_value")
|
|
18058
|
-
)
|
|
18059
|
-
writer
|
|
18060
|
-
.uint32(/* id 2, wireType 1 =*/ 17)
|
|
18061
|
-
.double(message.double_value);
|
|
18062
|
-
if (
|
|
18063
|
-
message.float_value != null &&
|
|
18064
|
-
Object.hasOwnProperty.call(message, "float_value")
|
|
18065
|
-
)
|
|
18066
|
-
writer
|
|
18067
|
-
.uint32(/* id 3, wireType 5 =*/ 29)
|
|
18068
|
-
.float(message.float_value);
|
|
18069
18586
|
if (
|
|
18070
18587
|
message.int32_value != null &&
|
|
18071
18588
|
Object.hasOwnProperty.call(message, "int32_value")
|
|
18072
18589
|
)
|
|
18073
18590
|
writer
|
|
18074
|
-
.uint32(/* id
|
|
18591
|
+
.uint32(/* id 2, wireType 0 =*/ 16)
|
|
18075
18592
|
.int32(message.int32_value);
|
|
18076
18593
|
if (
|
|
18077
18594
|
message.int64_value != null &&
|
|
18078
18595
|
Object.hasOwnProperty.call(message, "int64_value")
|
|
18079
18596
|
)
|
|
18080
18597
|
writer
|
|
18081
|
-
.uint32(/* id
|
|
18598
|
+
.uint32(/* id 3, wireType 0 =*/ 24)
|
|
18082
18599
|
.int64(message.int64_value);
|
|
18083
18600
|
if (
|
|
18084
18601
|
message.uint32_value != null &&
|
|
18085
18602
|
Object.hasOwnProperty.call(message, "uint32_value")
|
|
18086
18603
|
)
|
|
18087
18604
|
writer
|
|
18088
|
-
.uint32(/* id
|
|
18605
|
+
.uint32(/* id 4, wireType 0 =*/ 32)
|
|
18089
18606
|
.uint32(message.uint32_value);
|
|
18090
18607
|
if (
|
|
18091
18608
|
message.uint64_value != null &&
|
|
18092
18609
|
Object.hasOwnProperty.call(message, "uint64_value")
|
|
18093
18610
|
)
|
|
18094
18611
|
writer
|
|
18095
|
-
.uint32(/* id
|
|
18612
|
+
.uint32(/* id 5, wireType 0 =*/ 40)
|
|
18096
18613
|
.uint64(message.uint64_value);
|
|
18097
18614
|
if (
|
|
18098
18615
|
message.sint32_value != null &&
|
|
18099
18616
|
Object.hasOwnProperty.call(message, "sint32_value")
|
|
18100
18617
|
)
|
|
18101
18618
|
writer
|
|
18102
|
-
.uint32(/* id
|
|
18619
|
+
.uint32(/* id 6, wireType 0 =*/ 48)
|
|
18103
18620
|
.sint32(message.sint32_value);
|
|
18104
18621
|
if (
|
|
18105
18622
|
message.sint64_value != null &&
|
|
18106
18623
|
Object.hasOwnProperty.call(message, "sint64_value")
|
|
18107
18624
|
)
|
|
18108
18625
|
writer
|
|
18109
|
-
.uint32(/* id
|
|
18626
|
+
.uint32(/* id 7, wireType 0 =*/ 56)
|
|
18110
18627
|
.sint64(message.sint64_value);
|
|
18111
18628
|
if (
|
|
18112
18629
|
message.fixed32_value != null &&
|
|
18113
18630
|
Object.hasOwnProperty.call(message, "fixed32_value")
|
|
18114
18631
|
)
|
|
18115
18632
|
writer
|
|
18116
|
-
.uint32(/* id
|
|
18633
|
+
.uint32(/* id 8, wireType 5 =*/ 69)
|
|
18117
18634
|
.fixed32(message.fixed32_value);
|
|
18118
18635
|
if (
|
|
18119
18636
|
message.fixed64_value != null &&
|
|
18120
18637
|
Object.hasOwnProperty.call(message, "fixed64_value")
|
|
18121
18638
|
)
|
|
18122
18639
|
writer
|
|
18123
|
-
.uint32(/* id
|
|
18640
|
+
.uint32(/* id 9, wireType 1 =*/ 73)
|
|
18124
18641
|
.fixed64(message.fixed64_value);
|
|
18125
18642
|
if (
|
|
18126
18643
|
message.sfixed32_value != null &&
|
|
18127
18644
|
Object.hasOwnProperty.call(message, "sfixed32_value")
|
|
18128
18645
|
)
|
|
18129
18646
|
writer
|
|
18130
|
-
.uint32(/* id
|
|
18647
|
+
.uint32(/* id 10, wireType 5 =*/ 85)
|
|
18131
18648
|
.sfixed32(message.sfixed32_value);
|
|
18132
18649
|
if (
|
|
18133
18650
|
message.sfixed64_value != null &&
|
|
18134
18651
|
Object.hasOwnProperty.call(message, "sfixed64_value")
|
|
18135
18652
|
)
|
|
18136
18653
|
writer
|
|
18137
|
-
.uint32(/* id
|
|
18654
|
+
.uint32(/* id 11, wireType 1 =*/ 89)
|
|
18138
18655
|
.sfixed64(message.sfixed64_value);
|
|
18139
18656
|
if (
|
|
18140
18657
|
message.bool_value != null &&
|
|
18141
18658
|
Object.hasOwnProperty.call(message, "bool_value")
|
|
18142
18659
|
)
|
|
18143
|
-
writer
|
|
18144
|
-
.uint32(/* id 14, wireType 0 =*/ 112)
|
|
18145
|
-
.bool(message.bool_value);
|
|
18660
|
+
writer.uint32(/* id 12, wireType 0 =*/ 96).bool(message.bool_value);
|
|
18146
18661
|
if (
|
|
18147
18662
|
message.string_value != null &&
|
|
18148
18663
|
Object.hasOwnProperty.call(message, "string_value")
|
|
18149
18664
|
)
|
|
18150
18665
|
writer
|
|
18151
|
-
.uint32(/* id
|
|
18666
|
+
.uint32(/* id 13, wireType 2 =*/ 106)
|
|
18152
18667
|
.string(message.string_value);
|
|
18153
18668
|
if (
|
|
18154
18669
|
message.bytes_value != null &&
|
|
18155
18670
|
Object.hasOwnProperty.call(message, "bytes_value")
|
|
18156
18671
|
)
|
|
18157
18672
|
writer
|
|
18158
|
-
.uint32(/* id
|
|
18673
|
+
.uint32(/* id 14, wireType 2 =*/ 114)
|
|
18159
18674
|
.bytes(message.bytes_value);
|
|
18160
18675
|
return writer;
|
|
18161
18676
|
};
|
|
@@ -18191,57 +18706,65 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
18191
18706
|
while (reader.pos < end) {
|
|
18192
18707
|
var tag = reader.uint32();
|
|
18193
18708
|
switch (tag >>> 3) {
|
|
18194
|
-
case 1:
|
|
18709
|
+
case 1: {
|
|
18195
18710
|
message.message_value = $root.google.protobuf.Any.decode(
|
|
18196
18711
|
reader,
|
|
18197
18712
|
reader.uint32()
|
|
18198
18713
|
);
|
|
18199
18714
|
break;
|
|
18200
|
-
|
|
18201
|
-
|
|
18202
|
-
break;
|
|
18203
|
-
case 3:
|
|
18204
|
-
message.float_value = reader.float();
|
|
18205
|
-
break;
|
|
18206
|
-
case 4:
|
|
18715
|
+
}
|
|
18716
|
+
case 2: {
|
|
18207
18717
|
message.int32_value = reader.int32();
|
|
18208
18718
|
break;
|
|
18209
|
-
|
|
18719
|
+
}
|
|
18720
|
+
case 3: {
|
|
18210
18721
|
message.int64_value = reader.int64();
|
|
18211
18722
|
break;
|
|
18212
|
-
|
|
18723
|
+
}
|
|
18724
|
+
case 4: {
|
|
18213
18725
|
message.uint32_value = reader.uint32();
|
|
18214
18726
|
break;
|
|
18215
|
-
|
|
18727
|
+
}
|
|
18728
|
+
case 5: {
|
|
18216
18729
|
message.uint64_value = reader.uint64();
|
|
18217
18730
|
break;
|
|
18218
|
-
|
|
18731
|
+
}
|
|
18732
|
+
case 6: {
|
|
18219
18733
|
message.sint32_value = reader.sint32();
|
|
18220
18734
|
break;
|
|
18221
|
-
|
|
18735
|
+
}
|
|
18736
|
+
case 7: {
|
|
18222
18737
|
message.sint64_value = reader.sint64();
|
|
18223
18738
|
break;
|
|
18224
|
-
|
|
18739
|
+
}
|
|
18740
|
+
case 8: {
|
|
18225
18741
|
message.fixed32_value = reader.fixed32();
|
|
18226
18742
|
break;
|
|
18227
|
-
|
|
18743
|
+
}
|
|
18744
|
+
case 9: {
|
|
18228
18745
|
message.fixed64_value = reader.fixed64();
|
|
18229
18746
|
break;
|
|
18230
|
-
|
|
18747
|
+
}
|
|
18748
|
+
case 10: {
|
|
18231
18749
|
message.sfixed32_value = reader.sfixed32();
|
|
18232
18750
|
break;
|
|
18233
|
-
|
|
18751
|
+
}
|
|
18752
|
+
case 11: {
|
|
18234
18753
|
message.sfixed64_value = reader.sfixed64();
|
|
18235
18754
|
break;
|
|
18236
|
-
|
|
18755
|
+
}
|
|
18756
|
+
case 12: {
|
|
18237
18757
|
message.bool_value = reader.bool();
|
|
18238
18758
|
break;
|
|
18239
|
-
|
|
18759
|
+
}
|
|
18760
|
+
case 13: {
|
|
18240
18761
|
message.string_value = reader.string();
|
|
18241
18762
|
break;
|
|
18242
|
-
|
|
18763
|
+
}
|
|
18764
|
+
case 14: {
|
|
18243
18765
|
message.bytes_value = reader.bytes();
|
|
18244
18766
|
break;
|
|
18767
|
+
}
|
|
18245
18768
|
default:
|
|
18246
18769
|
reader.skipType(tag & 7);
|
|
18247
18770
|
break;
|
|
@@ -18289,24 +18812,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
18289
18812
|
if (error) return "message_value." + error;
|
|
18290
18813
|
}
|
|
18291
18814
|
}
|
|
18292
|
-
if (
|
|
18293
|
-
message.double_value != null &&
|
|
18294
|
-
message.hasOwnProperty("double_value")
|
|
18295
|
-
) {
|
|
18296
|
-
if (properties.kind === 1) return "kind: multiple values";
|
|
18297
|
-
properties.kind = 1;
|
|
18298
|
-
if (typeof message.double_value !== "number")
|
|
18299
|
-
return "double_value: number expected";
|
|
18300
|
-
}
|
|
18301
|
-
if (
|
|
18302
|
-
message.float_value != null &&
|
|
18303
|
-
message.hasOwnProperty("float_value")
|
|
18304
|
-
) {
|
|
18305
|
-
if (properties.kind === 1) return "kind: multiple values";
|
|
18306
|
-
properties.kind = 1;
|
|
18307
|
-
if (typeof message.float_value !== "number")
|
|
18308
|
-
return "float_value: number expected";
|
|
18309
|
-
}
|
|
18310
18815
|
if (
|
|
18311
18816
|
message.int32_value != null &&
|
|
18312
18817
|
message.hasOwnProperty("int32_value")
|
|
@@ -18488,10 +18993,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
18488
18993
|
object.message_value
|
|
18489
18994
|
);
|
|
18490
18995
|
}
|
|
18491
|
-
if (object.double_value != null)
|
|
18492
|
-
message.double_value = Number(object.double_value);
|
|
18493
|
-
if (object.float_value != null)
|
|
18494
|
-
message.float_value = Number(object.float_value);
|
|
18495
18996
|
if (object.int32_value != null)
|
|
18496
18997
|
message.int32_value = object.int32_value | 0;
|
|
18497
18998
|
if (object.int64_value != null)
|
|
@@ -18585,7 +19086,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
18585
19086
|
)),
|
|
18586
19087
|
0
|
|
18587
19088
|
);
|
|
18588
|
-
else if (object.bytes_value.length)
|
|
19089
|
+
else if (object.bytes_value.length >= 0)
|
|
18589
19090
|
message.bytes_value = object.bytes_value;
|
|
18590
19091
|
return message;
|
|
18591
19092
|
};
|
|
@@ -18612,26 +19113,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
18612
19113
|
);
|
|
18613
19114
|
if (options.oneofs) object.kind = "message_value";
|
|
18614
19115
|
}
|
|
18615
|
-
if (
|
|
18616
|
-
message.double_value != null &&
|
|
18617
|
-
message.hasOwnProperty("double_value")
|
|
18618
|
-
) {
|
|
18619
|
-
object.double_value =
|
|
18620
|
-
options.json && !isFinite(message.double_value)
|
|
18621
|
-
? String(message.double_value)
|
|
18622
|
-
: message.double_value;
|
|
18623
|
-
if (options.oneofs) object.kind = "double_value";
|
|
18624
|
-
}
|
|
18625
|
-
if (
|
|
18626
|
-
message.float_value != null &&
|
|
18627
|
-
message.hasOwnProperty("float_value")
|
|
18628
|
-
) {
|
|
18629
|
-
object.float_value =
|
|
18630
|
-
options.json && !isFinite(message.float_value)
|
|
18631
|
-
? String(message.float_value)
|
|
18632
|
-
: message.float_value;
|
|
18633
|
-
if (options.oneofs) object.kind = "float_value";
|
|
18634
|
-
}
|
|
18635
19116
|
if (
|
|
18636
19117
|
message.int32_value != null &&
|
|
18637
19118
|
message.hasOwnProperty("int32_value")
|
|
@@ -18816,6 +19297,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
18816
19297
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
18817
19298
|
};
|
|
18818
19299
|
|
|
19300
|
+
/**
|
|
19301
|
+
* Gets the default type url for value_type
|
|
19302
|
+
* @function getTypeUrl
|
|
19303
|
+
* @memberof koinos.chain.value_type
|
|
19304
|
+
* @static
|
|
19305
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
19306
|
+
* @returns {string} The default type url
|
|
19307
|
+
*/
|
|
19308
|
+
value_type.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
19309
|
+
if (typeUrlPrefix === undefined) {
|
|
19310
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
19311
|
+
}
|
|
19312
|
+
return typeUrlPrefix + "/koinos.chain.value_type";
|
|
19313
|
+
};
|
|
19314
|
+
|
|
18819
19315
|
return value_type;
|
|
18820
19316
|
})();
|
|
18821
19317
|
|
|
@@ -18930,12 +19426,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
18930
19426
|
while (reader.pos < end) {
|
|
18931
19427
|
var tag = reader.uint32();
|
|
18932
19428
|
switch (tag >>> 3) {
|
|
18933
|
-
case 1:
|
|
19429
|
+
case 1: {
|
|
18934
19430
|
message.name = reader.string();
|
|
18935
19431
|
break;
|
|
18936
|
-
|
|
19432
|
+
}
|
|
19433
|
+
case 2: {
|
|
18937
19434
|
message.number = reader.int32();
|
|
18938
19435
|
break;
|
|
19436
|
+
}
|
|
18939
19437
|
default:
|
|
18940
19438
|
reader.skipType(tag & 7);
|
|
18941
19439
|
break;
|
|
@@ -19028,6 +19526,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
19028
19526
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
19029
19527
|
};
|
|
19030
19528
|
|
|
19529
|
+
/**
|
|
19530
|
+
* Gets the default type url for enum_type
|
|
19531
|
+
* @function getTypeUrl
|
|
19532
|
+
* @memberof koinos.chain.enum_type
|
|
19533
|
+
* @static
|
|
19534
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
19535
|
+
* @returns {string} The default type url
|
|
19536
|
+
*/
|
|
19537
|
+
enum_type.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
19538
|
+
if (typeUrlPrefix === undefined) {
|
|
19539
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
19540
|
+
}
|
|
19541
|
+
return typeUrlPrefix + "/koinos.chain.enum_type";
|
|
19542
|
+
};
|
|
19543
|
+
|
|
19031
19544
|
return enum_type;
|
|
19032
19545
|
})();
|
|
19033
19546
|
|
|
@@ -19132,13 +19645,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
19132
19645
|
while (reader.pos < end) {
|
|
19133
19646
|
var tag = reader.uint32();
|
|
19134
19647
|
switch (tag >>> 3) {
|
|
19135
|
-
case 1:
|
|
19648
|
+
case 1: {
|
|
19136
19649
|
if (!(message.values && message.values.length))
|
|
19137
19650
|
message.values = [];
|
|
19138
19651
|
message.values.push(
|
|
19139
19652
|
$root.koinos.chain.value_type.decode(reader, reader.uint32())
|
|
19140
19653
|
);
|
|
19141
19654
|
break;
|
|
19655
|
+
}
|
|
19142
19656
|
default:
|
|
19143
19657
|
reader.skipType(tag & 7);
|
|
19144
19658
|
break;
|
|
@@ -19248,6 +19762,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
19248
19762
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
19249
19763
|
};
|
|
19250
19764
|
|
|
19765
|
+
/**
|
|
19766
|
+
* Gets the default type url for list_type
|
|
19767
|
+
* @function getTypeUrl
|
|
19768
|
+
* @memberof koinos.chain.list_type
|
|
19769
|
+
* @static
|
|
19770
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
19771
|
+
* @returns {string} The default type url
|
|
19772
|
+
*/
|
|
19773
|
+
list_type.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
19774
|
+
if (typeUrlPrefix === undefined) {
|
|
19775
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
19776
|
+
}
|
|
19777
|
+
return typeUrlPrefix + "/koinos.chain.list_type";
|
|
19778
|
+
};
|
|
19779
|
+
|
|
19251
19780
|
return list_type;
|
|
19252
19781
|
})();
|
|
19253
19782
|
|
|
@@ -19384,12 +19913,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
19384
19913
|
while (reader.pos < end) {
|
|
19385
19914
|
var tag = reader.uint32();
|
|
19386
19915
|
switch (tag >>> 3) {
|
|
19387
|
-
case 1:
|
|
19916
|
+
case 1: {
|
|
19388
19917
|
message.type_url = reader.string();
|
|
19389
19918
|
break;
|
|
19390
|
-
|
|
19919
|
+
}
|
|
19920
|
+
case 2: {
|
|
19391
19921
|
message.value = reader.bytes();
|
|
19392
19922
|
break;
|
|
19923
|
+
}
|
|
19393
19924
|
default:
|
|
19394
19925
|
reader.skipType(tag & 7);
|
|
19395
19926
|
break;
|
|
@@ -19460,7 +19991,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
19460
19991
|
)),
|
|
19461
19992
|
0
|
|
19462
19993
|
);
|
|
19463
|
-
else if (object.value.length) message.value = object.value;
|
|
19994
|
+
else if (object.value.length >= 0) message.value = object.value;
|
|
19464
19995
|
return message;
|
|
19465
19996
|
};
|
|
19466
19997
|
|
|
@@ -19508,6 +20039,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
19508
20039
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
19509
20040
|
};
|
|
19510
20041
|
|
|
20042
|
+
/**
|
|
20043
|
+
* Gets the default type url for Any
|
|
20044
|
+
* @function getTypeUrl
|
|
20045
|
+
* @memberof google.protobuf.Any
|
|
20046
|
+
* @static
|
|
20047
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
20048
|
+
* @returns {string} The default type url
|
|
20049
|
+
*/
|
|
20050
|
+
Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
20051
|
+
if (typeUrlPrefix === undefined) {
|
|
20052
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
20053
|
+
}
|
|
20054
|
+
return typeUrlPrefix + "/google.protobuf.Any";
|
|
20055
|
+
};
|
|
20056
|
+
|
|
19511
20057
|
return Any;
|
|
19512
20058
|
})();
|
|
19513
20059
|
|
|
@@ -19534,7 +20080,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
19534
20080
|
/***/ ((module) => {
|
|
19535
20081
|
|
|
19536
20082
|
"use strict";
|
|
19537
|
-
module.exports = JSON.parse('{"nested":{"koinos":{"nested":{"contracts":{"nested":{"token":{"options":{"go_package":"github.com/koinos/koinos-proto-golang/koinos/contracts/token"},"nested":{"name_arguments":{"fields":{}},"name_result":{"fields":{"value":{"type":"string","id":1}}},"symbol_arguments":{"fields":{}},"symbol_result":{"fields":{"value":{"type":"string","id":1}}},"decimals_arguments":{"fields":{}},"decimals_result":{"fields":{"value":{"type":"uint32","id":1}}},"total_supply_arguments":{"fields":{}},"total_supply_result":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"balance_of_arguments":{"fields":{"owner":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}}}},"balance_of_result":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"transfer_arguments":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"to":{"type":"bytes","id":2,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}},"transfer_result":{"fields":{
|
|
20083
|
+
module.exports = JSON.parse('{"nested":{"koinos":{"nested":{"contracts":{"nested":{"token":{"options":{"go_package":"github.com/koinos/koinos-proto-golang/koinos/contracts/token"},"nested":{"name_arguments":{"fields":{}},"name_result":{"fields":{"value":{"type":"string","id":1}}},"symbol_arguments":{"fields":{}},"symbol_result":{"fields":{"value":{"type":"string","id":1}}},"decimals_arguments":{"fields":{}},"decimals_result":{"fields":{"value":{"type":"uint32","id":1}}},"total_supply_arguments":{"fields":{}},"total_supply_result":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"balance_of_arguments":{"fields":{"owner":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}}}},"balance_of_result":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"transfer_arguments":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"to":{"type":"bytes","id":2,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}},"transfer_result":{"fields":{}},"mint_arguments":{"fields":{"to":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"mint_result":{"fields":{}},"burn_arguments":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"burn_result":{"fields":{}},"balance_object":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"mana_balance_object":{"fields":{"balance":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}},"mana":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}},"last_mana_update":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}},"burn_event":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"mint_event":{"fields":{"to":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"transfer_event":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"to":{"type":"bytes","id":2,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}}}}}}}}}}');
|
|
19538
20084
|
|
|
19539
20085
|
/***/ })
|
|
19540
20086
|
|
|
@@ -19552,17 +20098,14 @@ module.exports = JSON.parse('{"nested":{"koinos":{"nested":{"contracts":{"nested
|
|
|
19552
20098
|
/******/ }
|
|
19553
20099
|
/******/ // Create a new module (and put it into the cache)
|
|
19554
20100
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
19555
|
-
/******/ id
|
|
19556
|
-
/******/ loaded
|
|
20101
|
+
/******/ // no module.id needed
|
|
20102
|
+
/******/ // no module.loaded needed
|
|
19557
20103
|
/******/ exports: {}
|
|
19558
20104
|
/******/ };
|
|
19559
20105
|
/******/
|
|
19560
20106
|
/******/ // Execute the module function
|
|
19561
20107
|
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
19562
20108
|
/******/
|
|
19563
|
-
/******/ // Flag the module as loaded
|
|
19564
|
-
/******/ module.loaded = true;
|
|
19565
|
-
/******/
|
|
19566
20109
|
/******/ // Return the exports of the module
|
|
19567
20110
|
/******/ return module.exports;
|
|
19568
20111
|
/******/ }
|
|
@@ -19580,15 +20123,6 @@ module.exports = JSON.parse('{"nested":{"koinos":{"nested":{"contracts":{"nested
|
|
|
19580
20123
|
/******/ })();
|
|
19581
20124
|
/******/ })();
|
|
19582
20125
|
/******/
|
|
19583
|
-
/******/ /* webpack/runtime/node module decorator */
|
|
19584
|
-
/******/ (() => {
|
|
19585
|
-
/******/ __webpack_require__.nmd = (module) => {
|
|
19586
|
-
/******/ module.paths = [];
|
|
19587
|
-
/******/ if (!module.children) module.children = [];
|
|
19588
|
-
/******/ return module;
|
|
19589
|
-
/******/ };
|
|
19590
|
-
/******/ })();
|
|
19591
|
-
/******/
|
|
19592
20126
|
/************************************************************************/
|
|
19593
20127
|
/******/
|
|
19594
20128
|
/******/ // startup
|