PageSourceSearch

https://mwcwallet.com/scripts/slate_output.min.js?9

js mwcwallet.com collected 2026-10-02 01:37:06 UTC 5,381 bytes, 1 lines download raw bytes

1"use strict";class SlateOutput{constructor(t,e,o){if(this.reset(),t instanceof BitReader==!0){var r=t,i=e;this.unserialize(r,i)}else if(!0===Object.isObject(t)){r=t,i=e;this.unserialize(r,i)}else{if("number"!=typeof t)throw"Unsupported output.";var s=t,u=e;if(this.features=s,this.commit=u,this.proof=o,!1===this.verifyProof())throw"Unsupported output."}}serialize(t,e){var o=t instanceof Slate==!0?t.getVersion():t;switch(o instanceof BigNumber==!0?o.toFixed():o){case Slate.VERSION_TWO.toFixed():case Slate.VERSION_THREE.toFixed():return{features:SlateOutput.featuresToText(this.getFeatures()),commit:Common.toHexString(this.getCommit()),proof:Common.toHexString(this.getProof())};case Slate.VERSION_SLATEPACK:try{if(e.setBytes(this.getCommit()),this.getProof().length>=Math.pow(2,SlateOutput.COMPACT_PROOF_LENGTH_LENGTH))throw"Proof is too long.";e.setBits(this.getProof().length,SlateOutput.COMPACT_PROOF_LENGTH_LENGTH),e.setBytes(this.getProof())}catch(t){throw"Unsupported output."}break;case Slate.VERSION_FOUR.toFixed():if(void 0===e){var r={c:Common.toHexString(this.getCommit()),p:Common.toHexString(this.getProof())};return!1===this.isPlain()&&(r.f=this.getFeatures()),r}try{e.setBytes([this.getFeatures()]),e.setBytes(this.getCommit()),e.setBytes(new BigNumber(this.getProof().length).toBytes(BigNumber.BIG_ENDIAN,Common.BYTES_IN_A_UINT64)),e.setBytes(this.getProof())}catch(t){throw"Unsupported output."}break;default:throw"Unsupported slate version."}}getTransaction(){return{features:SlateOutput.featuresToText(this.getFeatures()),commit:Common.toHexString(this.getCommit()),proof:Common.toHexString(this.getProof())}}getFeatures(){return this.features}getCommit(){return this.commit}getProof(){return this.proof}isPlain(){return this.getFeatures()===SlateOutput.PLAIN_FEATURES}isCoinbase(){return this.getFeatures()===SlateOutput.COINBASE_FEATURES}getHash(){return new Hash([new Uint8Array([this.getFeatures()]),this.getCommit()])}isEqualTo(t){return this.getFeatures()===t.getFeatures()&&(!1!==Common.arraysAreEqual(this.getCommit(),t.getCommit())&&!1!==Common.arraysAreEqual(this.getProof(),t.getProof()))}reset(){this.features=SlateOutput.PLAIN_FEATURES}unserialize(t,e){switch(e.getVersion()instanceof BigNumber==!0?e.getVersion().toFixed():e.getVersion()){case Slate.VERSION_TWO.toFixed():case Slate.VERSION_THREE.toFixed():if("features"in t==!1||SlateOutput.textToFeatures(t.features)===SlateOutput.UNSUPPORTED_FEATURES||SlateOutput.textToFeatures(t.features)===SlateOutput.COINBASE_FEATURES)throw"Unsupported output.";if(this.features=SlateOutput.textToFeatures(t.features),"commit"in t==!1||!1===Common.isHexString(t.commit)||Common.hexStringLength(t.commit)!==Crypto.COMMIT_LENGTH||!0!==Secp256k1Zkp.isValidCommit(Common.fromHexString(t.commit)))throw"Unsupported output.";if(this.commit=Common.fromHexString(t.commit),"proof"in t==!1||!1===Common.isHexString(t.proof)||Common.hexStringLength(t.proof)!==Crypto.PROOF_LENGTH)throw"Unsupported output.";this.proof=Common.fromHexString(t.proof);break;case Slate.VERSION_SLATEPACK:var o=t;try{if(this.commit=o.getBytes(Crypto.COMMIT_LENGTH),!0!==Secp256k1Zkp.isValidCommit(this.getCommit()))throw"Unsupported output.";if((r=o.getBits(SlateOutput.COMPACT_PROOF_LENGTH_LENGTH))!==Crypto.PROOF_LENGTH)throw"Unsupported output.";this.proof=o.getBytes(r)}catch(t){throw"Unsupported output."}break;case Slate.VERSION_FOUR.toFixed():if(t instanceof BitReader==!0){o=t;try{if(this.features=o.getBytes(1)[0],this.getFeatures()!==SlateOutput.PLAIN_FEATURES)throw"Unsupported output.";if(this.commit=o.getBytes(Crypto.COMMIT_LENGTH),!0!==Secp256k1Zkp.isValidCommit(this.getCommit()))throw"Unsupported output.";var r;if(!1===(r=new BigNumber(Common.HEX_PREFIX+Common.toHexString(o.getBytes(Common.BYTES_IN_A_UINT64)))).isEqualTo(Crypto.PROOF_LENGTH))throw"Unsupported output.";this.proof=o.getBytes(r.toNumber())}catch(t){throw"Unsupported output."}}else{if("f"in t==!0&&(!1===Common.isNumberString(t.f)&&t.f instanceof BigNumber==!1||!1===new BigNumber(t.f).isEqualTo(SlateOutput.PLAIN_FEATURES)))throw"Unsupported output.";if(this.features="f"in t==!0?new BigNumber(t.f).toNumber():SlateOutput.PLAIN_FEATURES,"c"in t==!1||!1===Common.isHexString(t.c)||Common.hexStringLength(t.c)!==Crypto.COMMIT_LENGTH||!0!==Secp256k1Zkp.isValidCommit(Common.fromHexString(t.c)))throw"Unsupported output.";if(this.commit=Common.fromHexString(t.c),"p"in t==!1||!1===Common.isHexString(t.p)||Common.hexStringLength(t.p)!==Crypto.PROOF_LENGTH)throw"Unsupported output.";this.proof=Common.fromHexString(t.p)}break;default:throw"Unsupported output."}if(!1===this.verifyProof())throw"Unsupported output."}verifyProof(){return!0===Secp256k1Zkp.verifyBulletproof(this.getProof(),this.getCommit(),new Uint8Array([]))}static featuresToText(t){switch(t){case SlateOutput.PLAIN_FEATURES:return"Plain";case SlateOutput.COINBASE_FEATURES:return"Coinbase";default:return SlateOutput.UNSUPPORTED_FEATURES}}static textToFeatures(t){switch(t){case"Plain":return SlateOutput.PLAIN_FEATURES;case"Coinbase":return SlateOutput.COINBASE_FEATURES;default:return SlateOutput.UNSUPPORTED_FEATURES}}static get PLAIN_FEATURES(){return 0}static get COINBASE_FEATURES(){return SlateOutput.PLAIN_FEATURES+1}static get UNSUPPORTED_FEATURES(){return SlateOutput.COINBASE_FEATURES+1}static get COMPACT_PROOF_LENGTH_LENGTH(){return 10}}globalThis.SlateOutput=SlateOutput;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.