1const F=new TextEncoder;class b{constructor(e=b.DEFAULT_CAPACITY,n=!1){this.writeByte=this.writeInt8,this.buffer=new ArrayBuffer(e),this.view=new DataView(this.buffer),this.offset=0,this.limit=e,this.littleEndian=n}_ensure(e){const n=this.offset+e;if(n>this.buffer.byteLength){const s=Math.max(this.buffer.byteLength*2,n),u=new ArrayBuffer(s);new Uint8Array(u).set(new Uint8Array(this.buffer)),this.buffer=u,this.view=new DataView(u)}}writeInt8(e){return this._ensure(1),this.view.setInt8(this.offset,e),this.offset+=1,this}writeUint8(e){return this._ensure(1),this.view.setUint8(this.offset,e),this.offset+=1,this}writeInt16(e){return this._ensure(2),this.view.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this}writeUint16(e){return this._ensure(2),this.view.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this}writeUint32(e){return this._ensure(4),this.view.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this}writeInt64(e){return typeof e!="bigint"&&(e=BigInt(e)),this._ensure(8),this.view.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this}writeUint64(e){return typeof e!="bigint"&&(e=BigInt(e)),this._ensure(8),this.view.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this}writeVarint32(e){for(e>>>=0;e>=128;)this._ensure(1),this.view.setUint8(this.offset++,e&127|128),e>>>=7;return this._ensure(1),this.view.setUint8(this.offset++,e),this}writeVString(e){const n=F.encode(e);return this.writeVarint32(n.length),this.append(n)}append(e){const n=e instanceof ArrayBuffer?new Uint8Array(e):e,s=n.byteLength;return s===0?this:(this._ensure(s),new Uint8Array(this.buffer,this.offset).set(n),this.offset+=s,this)}flip(){return this.limit=this.offset,this.offset=0,this}toBuffer(){return this.buffer.slice(this.offset,this.limit)}}b.DEFAULT_CAPACITY=16;b.LITTLE_ENDIAN=!0;const T=r=>{const e=[];for(let n=0;n<r.length;n+=2)e.push(parseInt(r.substr(n,2),16));return new Uint8Array(e)},P=r=>Array.from(r).map(e=>e.toString(16).padStart(2,"0")).join("");class U{static from(e){return e instanceof U?e:e instanceof Uint8Array?new U(e):typeof e=="string"?new U(T(e)):new U(new Uint8Array(e))}constructor(e){this.buffer=e}toString(e){return P(this.buffer)}toJSON(){return this.toString()}}const $="STM",L="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Y=(()=>{const r=new Int8Array(128).fill(-1);for(let e=0;e<L.length;e++)r[L.charCodeAt(e)]=e;return r})(),H=r=>{if(r.length===0)return new Uint8Array(0);let e=0;for(;e<r.length&&r[e]==="1";)e++;const n=(r.length-e)*733/1e3+1|0,s=new Uint8Array(n);for(let A=e;A<r.length;A++){const z=r.charCodeAt(A),B=z<128?Y[z]:-1;if(B<0)throw new Error("Invalid base58 character: "+r[A]);let S=B;for(let I=n-1;I>=0;I--)S+=58*s[I],s[I]=S&255,S>>>=8;if(S!==0)throw new Error("Base58 decode overflow")}let u=0;for(;u<n&&s[u]===0;)u++;const f=new Uint8Array(e+(n-u));return f.set(s.subarray(u),e),f};class x{constructor(e,n=$){this.key=e,this.prefix=n}static fromString(e){const{key:n,prefix:s}=R(e);return new x(n,s)}static from(e){return e instanceof x?e:x.fromString(e)}}const R=r=>{const e=r.slice(0,3);r=r.slice(3);const n=H(r);return{key:n.subarray(0,n.length-4),prefix:e}},J={comment_payout_beneficiaries:0,update_proposal_end_date:1,recurrent_transfer_pair_id:1},X=r=>{switch(r){case"@@000000021":return 3200000035;case"@@000000013":return 3200000003;case"@@000000037":return 3200000070;default:throw new Error("Invalid NAI")}},p=()=>{throw new Error("Void can not be serialized")},t=(r,e)=>{r.writeVString(e)},C=(r,e)=>{r.writeInt16(e)},D=(r,e)=>{r.writeInt64(e)},M=(r,e)=>{r.writeUint8(e)},w=(r,e)=>{r.writeUint16(e)},l=(r,e)=>{r.writeUint32(e)},j=(r,e)=>{r.writeUint64(e)},d=(r,e)=>{r.writeByte(e?1:0)},k=r=>(e,n)=>{e.writeVarint32(J[n.type]),r(e,n.value)},a=(r,e)=>{r.writeInt64(e.amount),r.writeUint32(X(e.nai))},m=(r,e)=>{r.writeUint32(Math.floor(new Date(e+"Z").getTime()/1e3))},y=(r,e)=>{e===null||typeof e=="string"&&e.slice(-39)==="1111111111111111111111111111111114T1Anm"?r.append(new Uint8Array(33).fill(0)):r.append(x.from(e).key)},v=(r=null)=>(e,n)=>{n=U.from(n);const s=n.buffer.length;if(r){if(s!==r)throw new Error(`Unable to serialize binary. Expected ${r} bytes, got ${s}`)}else e.writeVarint32(s);e.append(n.buffer)},V=v(),E=(r,e)=>(n,s)=>{n.writeVarint32(s.length);for(const[u,f]of s)r(n,u),e(n,f)},c=r=>
1(e,n)=>{e.writeVarint32(n.length);for(const s of n)r(e,s)},h=r=>(e,n)=>{for(const[s,u]of r)try{u(e,n[s])}catch(f){throw f.message=`${s}: ${f.message}`,f}},g=r=>(e,n)=>{n!==void 0?(e.writeByte(1),r(e,n)):e.writeByte(0)},_=h([["weight_threshold",l],["account_auths",E(t,w)],["key_auths",E(y,w)]]),Z=h([["account",t],["weight",w]]),q=h([["base",a],["quote",a]]),N=h([["previous",v(20)],["timestamp",m],["witness",t],["transaction_merkle_root",v(20)],["extensions",c(p)],["witness_signature",v(65)]]),G=h([["account_creation_fee",a],["maximum_block_size",l],["hbd_interest_rate",w]]),i=(r,e)=>{const n=h(e);return(s,u)=>{s.writeVarint32(r),n(s,u)}},o={};o.account_create_operation=i(9,[["fee",a],["creator",t],["new_account_name",t],["owner",_],["active",_],["posting",_],["memo_key",y],["json_metadata",t]]);o.account_create_with_delegation_operation=i(41,[["fee",a],["delegation",a],["creator",t],["new_account_name",t],["owner",_],["active",_],["posting",_],["memo_key",y],["json_metadata",t],["extensions",c(p)]]);o.account_update_operation=i(10,[["account",t],["owner",g(_)],["active",g(_)],["posting",g(_)],["memo_key",y],["json_metadata",t]]);o.account_witness_proxy_operation=i(13,[["account",t],["proxy",t]]);o.account_witness_vote_operation=i(12,[["account",t],["witness",t],["approve",d]]);o.cancel_transfer_from_savings_operation=i(34,[["from",t],["request_id",l]]);o.change_recovery_account_operation=i(26,[["account_to_recover",t],["new_recovery_account",t],["extensions",c(p)]]);o.claim_account_operation=i(22,[["creator",t],["fee",a],["extensions",c(p)]]);o.claim_reward_balance_operation=i(39,[["account",t],["reward_hive",a],["reward_hbd",a],["reward_vests",a]]);o.comment_operation=i(1,[["parent_author",t],["parent_permlink",t],["author",t],["permlink",t],["title",t],["body",t],["json_metadata",t]]);o.comment_options_operation=i(19,[["author",t],["permlink",t],["max_accepted_payout",a],["percent_hbd",w],["allow_votes",d],["allow_curation_rewards",d],["extensions",c(k(h([["beneficiaries",c(Z)]])))]]);o.convert_operation=i(8,[["owner",t],["requestid",l],["amount",a]]);o.create_claimed_account_operation=i(23,[["creator",t],["new_account_name",t],["owner",_],["active",_],["posting",_],["memo_key",y],["json_metadata",t],["extensions",c(p)]]);o.custom_operation=i(15,[["required_auths",c(t)],["id",w],["data",V]]);o.custom_binary_operation=i(35,[["required_owner_auths",c(t)],["required_active_auths",c(t)],["required_posting_auths",c(t)],["required_auths",c(_)],["id",t],["data",V]]);o.custom_json_operation=i(18,[["required_auths",c(t)],["required_posting_auths",c(t)],["id",t],["json",t]]);o.decline_voting_rights_operation=i(36,[["account",t],["decline",d]]);o.delegate_vesting_shares_operation=i(40,[["delegator",t],["delegatee",t],["vesting_shares",a]]);o.delete_comment_operation=i(17,[["author",t],["permlink",t]]);o.escrow_approve_operation=i(31,[["from",t],["to",t],["agent",t],["who",t],["escrow_id",l],["approve",d]]);o.escrow_dispute_operation=i(28,[["from",t],["to",t],["agent",t],["who",t],["escrow_id",l]]);o.escrow_release_operation=i(29,[["from",t],["to",t],["agent",t],["who",t],["receiver",t],["escrow_id",l],["hbd_amount",a],["hive_amount",a]]);o.escrow_transfer_operation=i(27,[["from",t],["to",t],["hbd_amount",a],["hive_amount",a],["escrow_id",l],["agent",t],["fee",a],["json_meta",t],["ratification_deadline",m],["escrow_expiration",m]]);o.feed_publish_operation=i(7,[["publisher",t],["exchange_rate",q]]);o.limit_order_cancel_operation=i(6,[["owner",t],["orderid",l]]);o.limit_order_create_operation=i(5,[["owner",t],["orderid",l],["amount_to_sell",a],["min_to_receive",a],["fill_or_kill",d],["expiration",m]]);o.limit_order_create2_operation=i(21,[["owner",t],["orderid",l],["amount_to_sell",a],["fill_or_kill",d],["exchange_rate",q],["expiration",m]]);o.recover_account_operation=i(25,[["account_to_recover",t],["new_owner_authority",_],["recent_owner_authority",_],["extensions",c(p)]]);o.report_over_production_operation=i(16,[["reporter",t],["first_block",N],["second_block",N]]);o.request_account_recovery_operation=i(24,[["recovery_account",t],["account_to_recover",t],["new_owner_authority",_],["extensions",c(p)]]);o.reset_account_operation=i(37,[["reset_account",t],["account_to_reset",t],["new_owner_authority",_]]);o.set_reset_account_operation=i(38,[["account",t],["current_reset_account",t],["reset_account",t]]);o.set_withdraw_vesting_route_operation=i(20,[["from_account",t],["to_account",t],["percent",w],["auto_vest",d]]);o.transfer_operation=i(2,[["from",t],["to",t],["amount",a],["memo",t]]);o.transfer_from_savings_operation=i(33,[["from",t],["request_id",l],["to",t],["amount",a],["memo",t]]);o.transfer_to_savings_operation=i(32,[["from",t],["to",t],["amount",a],["memo",t]]);o.transfer_to_vesting_operation=i(3,[["from",t],["to",t],["amount",a]]);o.vote_operation=i(0,[["voter",t],["author",t],["permlink",t],["weight",C]]);o.withdraw_vesting_operation=i(4,[["account",t],["vesting_shares",a]]);o.witness_update_operation=i(11,[["owner",t],["url",t],["block_signing_key",y],["props",G],["fee",a]]);o.witness_set_properties_operation=i(42,[["owner",t],["props",E(t,V)],["extensions",c(p)]]);o.account_update2_operation=i(43,[["account",t],["owner",g(_)],["active",g(_)],["posting",g(_)],["memo_key",g(y)],["json_metadata",t],["posting_json_metadata",t],["extensions",c(p)]]);o.create_proposal_operation=i(44,[["creator",t],["receiver",t],["start_date",m],["end_date",m],["daily_pay",a],["subject",t],["permlink",t],["extensions",c(p)]]);o.update_proposal_votes_operation=i(45,[["voter",t],["proposal_ids",c(D)],["approve",d],["extensions",c(p)]]);o.remove_proposal_operation=i(46,[["proposal_owner",t],["proposal_ids",c(D)],["extensions",c(p)]]);const Q=h([["end_date",m]]);o.update_proposal_operation=i(47,[["proposal_id",j],["creator",t],["daily_pay",a],["subject",t],["permlink",t],["extensions",c(k(Q))]]);o.collateralized_convert_operation=i(48,[["owner",t],["requestid",l],["amount",a]]);o.recurrent_transfer_operation=i(49,[["from",t],["to",t],["amount",a],["memo",t],["recurrence",w],["executions",w],["extensions",c(k(h([["pair_id",M]])))]]);const O=(r,e)=>{const n=o[e.type];if(!n)throw new Error(`No serializer for operation: ${e.type}`);try{n(r,e.value)}catch(s){throw s.message=`${e.type}: ${s.message}`,s}},W=h([["ref_block_num",w],["ref_block_prefix",l],["expiration",m],["operations",c(O)],["extensions",c(t)]]),K=h([["from",y],["to",y],["nonce",j],["check",l],["encrypted",v()]]),ee={Array:c,Asset:a,Authority:_,Binary:v,Boolean:d,Date:m,FlatMap:E,Int16:C,Int64:D,Memo:K,Object:h,Operation:O,Optional:g,Price:q,PublicKey:y,Extension:k,String:t,Transaction:W,UInt16:w,UInt32:l,UInt64:j,UInt8:M,Void:p},te=async r=>{const e=await window.crypto.subtle.digest("SHA-256",r);return new Uint8Array(e)},re=T("beeab0de00000000000000000000000000000000000000000000000000000000"),ne=async(r,e=re,n=te)=>{typeof e=="string"&&(e=T(e));const s=new b(b.DEFAULT_CAPACITY,b.LITTLE_ENDIAN),u={...r};try{ee.Transaction(s,u)}catch(S){throw new Error("Unable to serialize transaction: "+S)}s.flip();const f=new Uint8Array(s.toBuffer()),A=new Uint8Array([...e,...f]),z=P(await n(f)).slice(0,40);return{digest:await n(A),txId:z,bin:A}};export{re as MAINNET_CHAIN_ID,te as sha256Browser,ne as transactionDigest};
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.