Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scale-ts

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scale-ts - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

8

dist/scale-ts.cjs.development.js

@@ -172,6 +172,6 @@ var __defProp = Object.defineProperty;

input.i += 16;
return (left << 64n) + right;
return left << 64n | right;
});
var u128 = createCodec(create128Enc(), create128Dec());
var i128 = createCodec(create128Enc(true), create128Dec(true));
var i128 = createCodec(create128Enc(1), create128Dec(1));

@@ -247,5 +247,5 @@ // src/codecs/bool.ts

let nElements = compact.dec(bytes);
const arr = new Uint8Array(bytes.buffer, bytes.i, nElements);
const dv = new DataView(bytes.buffer, bytes.i, nElements);
bytes.i += nElements;
return textDecoder.decode(arr);
return textDecoder.decode(dv);
});

@@ -252,0 +252,0 @@ var str = createCodec(strEnc, strDec);

@@ -1,2 +0,2 @@

var l=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var ee=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var te=(e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:!0})},ne=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Z(t))!z.call(e,o)&&o!==n&&l(e,o,{get:()=>t[o],enumerable:!(r=Y(t,o))||r.enumerable});return e};var re=e=>ne(l({},"__esModule",{value:!0}),e);var I=(e,t,n)=>(ee(e,typeof t!="symbol"?t+"":t,n),n);var Te={};te(Te,{Bytes:()=>E,Enum:()=>A,Option:()=>T,Result:()=>C,Struct:()=>K,Tuple:()=>y,Vector:()=>w,_void:()=>j,bool:()=>D,compact:()=>f,createCodec:()=>c,enhanceCodec:()=>U,enhanceDecoder:()=>g,enhanceEncoder:()=>x,i128:()=>pe,i16:()=>ae,i32:()=>ue,i64:()=>me,i8:()=>ie,str:()=>h,u128:()=>fe,u16:()=>B,u32:()=>v,u64:()=>se,u8:()=>a});module.exports=re(Te);var c=(e,t)=>{let n=[e,t];return n.enc=e,n.dec=t,n},x=(e,t)=>n=>e(t(n)),g=(e,t)=>n=>t(e(n)),U=([e,t],n,r)=>c(x(e,n),g(t,r));var k={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function oe(e){let t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,o=new Uint8Array(r);t&&(o[0]=0|k[e[2]]);for(let d=0;d<r;){let u=n+d*2,p=k[e[u]],Q=k[e[u+1]];o[t+d++]=p<<4|Q}return o}var b=class extends Uint8Array{constructor(n){super(n);I(this,"i",0);I(this,"v");this.v=new DataView(n)}},s=e=>t=>e(t instanceof b?t:new b(typeof t=="string"?oe(t).buffer:t instanceof Uint8Array?t.buffer:t));var i=(...e)=>{let t=e.reduce((r,o)=>r+o.byteLength,0),n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){let d=e[r];n.set(d,o),o+=d.byteLength}return n};function O(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r,n)]))}function ce(e,t){return s(n=>{let r=n.v[t](n.i,!0);return n.i+=e,r})}function de(e,t){return n=>{let r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function m(e,t,n){return c(de(e,n),ce(e,t))}var a=m(1,"getUint8","setUint8"),B=m(2,"getUint16","setUint16"),v=m(4,"getUint32","setUint32"),se=m(8,"getBigUint64","setBigUint64"),ie=m(1,"getInt8","setInt8"),ae=m(2,"getInt16","setInt16"),ue=m(4,"getInt32","setInt32"),me=m(8,"getBigInt64","setBigInt64"),R=e=>t=>{let n=new Uint8Array(16),r=new DataView(n.buffer);return r.setBigUint64(0,t,!0),r[e?"setBigInt64":"setBigUint64"](8,t>>64n,!0),n},V=e=>s(t=>{let{v:n,i:r}=t,o=n.getBigUint64(r,!0),d=n[e?"getBigInt64":"getBigUint64"](r+8,!0);return t.i+=16,(d<<64n)+o}),fe=c(R(),V()),pe=c(R(!0),V(!0));var ye=e=>e?1:0,D=U(a,ye,Boolean);var Oe={[1]:a[1],[2]:B[1],[4]:v[1]},De=s(e=>{let t=e.i,n=e[t],r=n&3;if(r!==3){let p=r===2?4:r+1;return Oe[p](e)>>>2}let o=(n>>>2)+4,d=t+1;e.i+=o+1;let u=0n;for(let p=o-1;p>=0;p--)u=u<<8n|BigInt(e[d+p]);return u}),le=e=>{if(e<0)throw new Error(`Wrong Compat input (${e})`);if(e<1<<6){let r=new Uint8Array(1);return r[0]=Number(e)<<2,r}if(e<1<<14){let r=new Uint8Array(2),o=(Number(e)<<2)+1;return new DataView(r.buffer).setUint16(0,o,!0),r}if(e<1<<30){let r=new Uint8Array(4),o=(Number(e)<<2)+2;return new DataView(r.buffer).setUint32(0,o,!0),r}let t=[],n=BigInt(e);for(;n>0;)t.push(Number(n)),n>>=8n;return t.unshift((t.length-4<<2)+3),new Uint8Array(t)},f=c(le,De);var xe=new TextEncoder,ge=e=>{let t=xe.encode(e);return i(f.enc(t.length),t)},be=new TextDecoder,Ee=s(e=>{let t=f.dec(e),n=new Uint8Array(e.buffer,e.i,t);return e.i+=t,be.decode(n)}),h=c(ge,Ee);var Ae=new Uint8Array(0),j=c(()=>Ae,Function.prototype);var S=e=>t=>t.length===e?t:t.slice(0,e),P=e=>s(t=>{let n=t.i,r=e!==1/0?e:t.byteLength-n,o=new Uint8Array(t.buffer,n,r);return t.i+=r,o}),E=e=>c(S(e),P(e));E.enc=S;E.dec=P;var N=e=>{let t=Object.keys(e);return({tag:n,value:r})=>{let o=t.indexOf(n);return i(a.enc(o),e[n](r))}},L=e=>{let t=Object.entries(e);return s(n=>{let r=a.dec(n),[o,d]=t[r],u=d(n);return{tag:o,value:u}})},A=e=>c(N(O(e,([t])=>t)),L(O(e,([,t])=>t)));A.enc=N;A.dec=L;var _=e=>s(t=>{let n=a.dec(t);if(n!==0)return e===D[1]?n===1:e(t)}),F=e=>t=>{let n=new Uint8Array(1);return t===void 0?(n[0]=0,n):(n[0]=1,e===D[0]?(n[0]=t?1:2,n):i(n,e(t)))},T=e=>c(F(e[0]),_(e[1]));T.enc=F;T.dec=_;var H=(e,t)=>s(n=>{let o=a[1](n)===0,u=(o?e:t)(n);return{success:o,value:u}}),M=(e,t)=>({success:n,value:r})=>i(a[0](n?0:1),(n?e:t)(r)),C=(e,t)=>c(M(e[0],t[0]),H(e[1],t[1]));C.dec=H;C.enc=M;var W=(...e)=>s(t=>e.map(n=>n(t))),X=(...e)=>t=>i(...t.map((n,r)=>e[r](n))),y=(...e)=>c(X(...e.map(([t])=>t)),W(...e.map(([,t])=>t)));y.enc=X;y.dec=W;var $=e=>{let t=Object.keys(e);return x(y.enc(...Object.values(e)),n=>t.map(r=>n[r]))},q=e=>{let t=Object.keys(e);return g(y.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,o)=>[t[o],r])))},K=e=>c($(O(e,t=>t[0])),q(O(e,t=>t[1])));K.enc=$;K.dec=q;var G=(e,t)=>t>0?n=>i(...n.map(e)):n=>i(f.enc(n.length),...n.map(e));function J(e,t){return s(n=>{let r=t>0?t:f.dec(n),o=new Array(r);for(let d=0;d<r;d++){let u=e(n);o[d]=u}return o})}function w(e,t){return c(G(e[0],t),J(e[1],t))}w.enc=G;w.dec=J;
var l=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var ee=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var te=(e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:!0})},ne=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Z(t))!z.call(e,o)&&o!==n&&l(e,o,{get:()=>t[o],enumerable:!(r=Y(t,o))||r.enumerable});return e};var re=e=>ne(l({},"__esModule",{value:!0}),e);var I=(e,t,n)=>(ee(e,typeof t!="symbol"?t+"":t,n),n);var Ae={};te(Ae,{Bytes:()=>E,Enum:()=>T,Option:()=>A,Result:()=>C,Struct:()=>K,Tuple:()=>y,Vector:()=>w,_void:()=>j,bool:()=>D,compact:()=>f,createCodec:()=>c,enhanceCodec:()=>U,enhanceDecoder:()=>g,enhanceEncoder:()=>x,i128:()=>pe,i16:()=>ae,i32:()=>ue,i64:()=>me,i8:()=>ie,str:()=>h,u128:()=>fe,u16:()=>B,u32:()=>v,u64:()=>se,u8:()=>a});module.exports=re(Ae);var c=(e,t)=>{let n=[e,t];return n.enc=e,n.dec=t,n},x=(e,t)=>n=>e(t(n)),g=(e,t)=>n=>t(e(n)),U=([e,t],n,r)=>c(x(e,n),g(t,r));var k={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function oe(e){let t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,o=new Uint8Array(r);t&&(o[0]=0|k[e[2]]);for(let d=0;d<r;){let u=n+d*2,p=k[e[u]],Q=k[e[u+1]];o[t+d++]=p<<4|Q}return o}var b=class extends Uint8Array{constructor(n){super(n);I(this,"i",0);I(this,"v");this.v=new DataView(n)}},s=e=>t=>e(t instanceof b?t:new b(typeof t=="string"?oe(t).buffer:t instanceof Uint8Array?t.buffer:t));var i=(...e)=>{let t=e.reduce((r,o)=>r+o.byteLength,0),n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){let d=e[r];n.set(d,o),o+=d.byteLength}return n};function O(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r,n)]))}function ce(e,t){return s(n=>{let r=n.v[t](n.i,!0);return n.i+=e,r})}function de(e,t){return n=>{let r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function m(e,t,n){return c(de(e,n),ce(e,t))}var a=m(1,"getUint8","setUint8"),B=m(2,"getUint16","setUint16"),v=m(4,"getUint32","setUint32"),se=m(8,"getBigUint64","setBigUint64"),ie=m(1,"getInt8","setInt8"),ae=m(2,"getInt16","setInt16"),ue=m(4,"getInt32","setInt32"),me=m(8,"getBigInt64","setBigInt64"),R=e=>t=>{let n=new Uint8Array(16),r=new DataView(n.buffer);return r.setBigUint64(0,t,!0),r[e?"setBigInt64":"setBigUint64"](8,t>>64n,!0),n},V=e=>s(t=>{let{v:n,i:r}=t,o=n.getBigUint64(r,!0),d=n[e?"getBigInt64":"getBigUint64"](r+8,!0);return t.i+=16,d<<64n|o}),fe=c(R(),V()),pe=c(R(1),V(1));var ye=e=>e?1:0,D=U(a,ye,Boolean);var Oe={[1]:a[1],[2]:B[1],[4]:v[1]},De=s(e=>{let t=e.i,n=e[t],r=n&3;if(r!==3){let p=r===2?4:r+1;return Oe[p](e)>>>2}let o=(n>>>2)+4,d=t+1;e.i+=o+1;let u=0n;for(let p=o-1;p>=0;p--)u=u<<8n|BigInt(e[d+p]);return u}),le=e=>{if(e<0)throw new Error(`Wrong Compat input (${e})`);if(e<1<<6){let r=new Uint8Array(1);return r[0]=Number(e)<<2,r}if(e<1<<14){let r=new Uint8Array(2),o=(Number(e)<<2)+1;return new DataView(r.buffer).setUint16(0,o,!0),r}if(e<1<<30){let r=new Uint8Array(4),o=(Number(e)<<2)+2;return new DataView(r.buffer).setUint32(0,o,!0),r}let t=[],n=BigInt(e);for(;n>0;)t.push(Number(n)),n>>=8n;return t.unshift((t.length-4<<2)+3),new Uint8Array(t)},f=c(le,De);var xe=new TextEncoder,ge=e=>{let t=xe.encode(e);return i(f.enc(t.length),t)},be=new TextDecoder,Ee=s(e=>{let t=f.dec(e),n=new DataView(e.buffer,e.i,t);return e.i+=t,be.decode(n)}),h=c(ge,Ee);var Te=new Uint8Array(0),j=c(()=>Te,Function.prototype);var S=e=>t=>t.length===e?t:t.slice(0,e),P=e=>s(t=>{let n=t.i,r=e!==1/0?e:t.byteLength-n,o=new Uint8Array(t.buffer,n,r);return t.i+=r,o}),E=e=>c(S(e),P(e));E.enc=S;E.dec=P;var N=e=>{let t=Object.keys(e);return({tag:n,value:r})=>{let o=t.indexOf(n);return i(a.enc(o),e[n](r))}},L=e=>{let t=Object.entries(e);return s(n=>{let r=a.dec(n),[o,d]=t[r],u=d(n);return{tag:o,value:u}})},T=e=>c(N(O(e,([t])=>t)),L(O(e,([,t])=>t)));T.enc=N;T.dec=L;var _=e=>s(t=>{let n=a.dec(t);if(n!==0)return e===D[1]?n===1:e(t)}),F=e=>t=>{let n=new Uint8Array(1);return t===void 0?(n[0]=0,n):(n[0]=1,e===D[0]?(n[0]=t?1:2,n):i(n,e(t)))},A=e=>c(F(e[0]),_(e[1]));A.enc=F;A.dec=_;var H=(e,t)=>s(n=>{let o=a[1](n)===0,u=(o?e:t)(n);return{success:o,value:u}}),M=(e,t)=>({success:n,value:r})=>i(a[0](n?0:1),(n?e:t)(r)),C=(e,t)=>c(M(e[0],t[0]),H(e[1],t[1]));C.dec=H;C.enc=M;var W=(...e)=>s(t=>e.map(n=>n(t))),X=(...e)=>t=>i(...t.map((n,r)=>e[r](n))),y=(...e)=>c(X(...e.map(([t])=>t)),W(...e.map(([,t])=>t)));y.enc=X;y.dec=W;var $=e=>{let t=Object.keys(e);return x(y.enc(...Object.values(e)),n=>t.map(r=>n[r]))},q=e=>{let t=Object.keys(e);return g(y.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,o)=>[t[o],r])))},K=e=>c($(O(e,t=>t[0])),q(O(e,t=>t[1])));K.enc=$;K.dec=q;var G=(e,t)=>t>0?n=>i(...n.map(e)):n=>i(f.enc(n.length),...n.map(e));function J(e,t){return s(n=>{let r=t>0?t:f.dec(n),o=new Array(r);for(let d=0;d<r;d++){let u=e(n);o[d]=u}return o})}function w(e,t){return c(G(e[0],t),J(e[1],t))}w.enc=G;w.dec=J;
//# sourceMappingURL=scale-ts.cjs.production.min.js.map

@@ -125,6 +125,6 @@ var __defProp = Object.defineProperty;

input.i += 16;
return (left << 64n) + right;
return left << 64n | right;
});
var u128 = createCodec(create128Enc(), create128Dec());
var i128 = createCodec(create128Enc(true), create128Dec(true));
var i128 = createCodec(create128Enc(1), create128Dec(1));

@@ -200,5 +200,5 @@ // src/codecs/bool.ts

let nElements = compact.dec(bytes);
const arr = new Uint8Array(bytes.buffer, bytes.i, nElements);
const dv = new DataView(bytes.buffer, bytes.i, nElements);
bytes.i += nElements;
return textDecoder.decode(arr);
return textDecoder.decode(dv);
});

@@ -205,0 +205,0 @@ var str = createCodec(strEnc, strDec);

{
"version": "0.2.2",
"version": "0.2.3",
"repository": {

@@ -4,0 +4,0 @@ "type": "git",

@@ -69,3 +69,3 @@ # scale-ts

friendIds: [1, 2, 3],
event: { tag: "allOrNothing" as const, value: true },
event: { tag: "allOrNothing", value: true },
})

@@ -249,3 +249,3 @@ // => 0x6400000024536f6d65206e616d650c0100000002000000030000000301

friendIds: [1, 2, 3],
event: { tag: "allOrNothing" as const, value: true },
event: { tag: "allOrNothing", value: true },
})

@@ -252,0 +252,0 @@ // => 0x6400000024536f6d65206e616d650c0100000002000000030000000301

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc