polkadot-api 1.23.0 → 1.23.1

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/bin/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { getCli, ink, update, remove, generate, add } from '@polkadot-api/cli';
3
3
 
4
- var version = "1.23.0";
4
+ var version = "1.23.1";
5
5
 
6
6
  getCli({
7
7
  add,
@@ -1 +1 @@
1
- (function(_,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(_=typeof globalThis<"u"?globalThis:_||self,E(_.papiPolkadotSdkCompat={}))})(this,(function(_){"use strict";const E=u=>{let c=null;const{send:s,disconnect:n}=u(d=>{c?.(JSON.parse(d))});return d=>(c=d,{send(f){s(JSON.stringify(f))},disconnect(){c=null,n()}})},z=u=>{let c=null;const{send:s,disconnect:n}=u(d=>{c?.(JSON.stringify(d))});return d=>(c=d,{send(f){s(JSON.parse(f))},disconnect(){c=null,n()}})},g=(...u)=>c=>z(u.reduce((s,n)=>n(s),E(c))),k={body:"",call:"",continue:"",follow:"",header:"",stopOperation:"",storage:"",unfollow:"",unpin:""},y={broadcast:"",stop:""},O={chainName:"",genesisHash:"",properties:""};Object.entries({chainHead:k,chainSpec:O,transaction:y}).forEach(([u,c])=>{Object.keys(c).forEach(s=>{c[s]=`${u}_v1_${s}`})});var L=Object.freeze({__proto__:null,chainHead:k,chainSpec:O,transaction:y});const Q=u=>c=>{const{send:s,disconnect:n}=u(c);return{send:f=>{switch(f.method){case O.chainName:return s({...f,method:"system_chain"});case O.genesisHash:return s({...f,method:"chain_getBlockHash",params:[0]});case O.properties:return s({...f,method:"system_properties"})}s(f)},disconnect:n}},R=u=>c=>{const s=new Set,n=new Map,d=new Map,{send:f,disconnect:r}=u(a=>{if("id"in a){c(a);const{id:o,result:e}=a;if(s.has(o)){s.delete(o),n.set(e,new Set),d.set(e,new Map);return}}else{const{subscription:o}=a.params,e=n.get(o),i=d.get(o);if(e){const t=a.params.result,{event:l}=t;if(l==="initialized"&&t.finalizedBlockHashes.forEach(p=>{e.add(p)}),l==="newBlock"){const{parentBlockHash:p}=t;if(!e.has(p)){const H=i.get(p)??[];H.push(a),i.set(p,H);return}const b=t.blockHash;e.add(t.blockHash),c(a);const w=i.get(b);w&&(i.delete(b),w.forEach(H=>{e.add(H.params.result.blockHash),c(H)}));return}l==="stop"&&(e.delete(o),d.delete(o))}c(a)}});return{send:a=>{const o=a.params[0];switch(a.method){case k.follow:s.add(a.id);break;case k.unpin:const[e,i]=a.params;i.forEach(t=>{n.get(e)?.delete(t),d.get(e)?.delete(t)});break;case k.unfollow:n.delete(o),d.delete(o);break}f(a)},disconnect:r}},M=u=>({jsonrpc:"2.0",...u}),N=(u,c,s,n={})=>M({method:"chainHead_v1_followEvent",params:{subscription:u,result:{event:c,operationId:s,...n}}}),Z="__INNER_RQ_DesV",X=u=>{let c=0;const s=new Map,n=({id:h,error:a,result:o})=>{const e=s.get(h);return e&&(s.delete(h),a?e(!1,a):e(!0,o)),!e};let d=()=>{};return[h=>{const{send:a,disconnect:o}=u(e=>{n(e)&&h(e)});return d=a,{send:d,disconnect:()=>{s.clear(),o()}}},(h,a,o,e)=>{const i=Z+c++;s.set(i,(t,l)=>{(t?o:e)(l)}),d(M({id:i,method:h,params:a}))}]},Y="__INNER_OP_DesV";let ee=0;const V=u=>c=>{const[s,n]=X(u),d=te(n),f=new Map,r=new Map,{send:h,disconnect:a}=s(i=>{if("id"in i){const t=f.get(i.id);t&&(f.delete(i.id),i.result.result==="started"&&t(i.result.operationId))}else if(i.params){const{subscription:t,result:l}=i.params,{operationId:p}=l||{},b=r.get(t);b&&l.event==="stop"&&(b.forEach(H=>{H.cancel()}),r.delete(t));const w=b?.get(p);if(w)switch(l.event){case"operationInaccessible":case"operationError":w.cancel();break;case"operationStorageDone":if(w.isInnerDone)b.delete(p);else{w.isOutterDone=!0;return}}}c(i)}),o=(i,t,l)=>p=>{let b=()=>{};r.has(i)||r.set(i,new Map);const w=r.get(i),H={isOutterDone:!1,isInnerDone:!1,cancel:()=>{b()}};w.set(p,H);let I=0;const B=l.map(S=>d(S,t,v=>{c(N(i,"operationStorageItems",p,{items:v.map(([C,D])=>({key:C,value:D}))}))},v=>{b(),H.isOutterDone||h(M({method:"chainHead_v1_stopOperation",params:[p]})),c(N(i,"operationError",p,{error:typeof v=="string"?v:JSON.stringify(v)}))},()=>{++I===l.length&&(H.isOutterDone?(b(),c(N(i,"operationStorageDone",p))):H.isInnerDone=!0)}));b=()=>{w.delete(p),B.forEach(S=>S())}};return{send:i=>{switch(i.method){case k.storage:{const[t,l,p]=i.params,b=[],w=p.filter(I=>{const B=I.type==="descendantsValues";return B&&b.push(I.key),!B}),H=o(t,l,b);if(w.length)b.length&&f.set(i.id,H);else{const I=Y+ee++;c(M({id:i.id,result:{result:"started",operationId:I}})),H(I),r.get(t).get(I).isOutterDone=!0;return}i.params[2]=w;break}case k.stopOperation:{const[t,l]=i.params,p=r.get(t)?.get(l);if(p&&(p.cancel(),p.isOutterDone))return;break}case k.unfollow:{const[t]=i.params;r.get(t)?.forEach(l=>l.cancel()),r.delete(t);break}}h(i)},disconnect:a}},te=u=>(c,s,n,d,f)=>{let r=!0,h=!1,a=0;const o=t=>{r&&(r=!1,d(t))},e=1e3,i=t=>{u("state_getKeysPaged",[c,e,t||void 0,s],l=>{r&&(l.length>0&&(a++,u("state_queryStorageAt",[l,s],([{changes:p}])=>{r&&(a--,n(p),h&&!a&&f())},o)),l.length<e?(h=!0,a||f()):i(l.at(-1)))},o)};return i(),()=>{r=!1}},$=u=>c=>{const s=new Set,n=new Map,d=new Map,{send:f,disconnect:r}=u(a=>{if("id"in a){c(a);const{id:o,result:e}=a;if(s.has(o)){s.delete(o),n.set(e,new Set),d.set(e,new Map);return}}else{const{subscription:o}=a.params,e=n.get(o),i=d.get(o);if(e){const t=a.params.result,{event:l}=t;if(l==="initialized"&&t.finalizedBlockHashes.forEach(p=>{e.add(p)}),l==="finalized"&&(t.prunedBlockHashes=t.prunedBlockHashes.filter(p=>e.has(p))),l==="newBlock"){e.add(t.blockHash);const p=t.blockHash,b=i.get(p);if(b){i.delete(p),c(a),Promise.resolve().then(()=>{c(b)});return}}if(l==="bestBlockChanged"){const p=t.bestBlockHash;if(!e.has(p)){d.get(o).set(p,a);return}}l==="stop"&&(e.delete(o),d.delete(o))}c(a)}});return{send:a=>{const o=a.params[0];switch(a.method){case k.follow:s.add(a.id);break;case k.unpin:const[e,i]=a.params;i.forEach(t=>{n.get(e)?.delete(t),d.get(e)?.delete(t)});break;case k.unfollow:n.delete(o),d.delete(o);break}f(a)},disconnect:r}},ne=new Set(["BodyDone","CallDone","StorageDone","Inaccessible","Error"].map(u=>"operation"+u)),j=u=>ne.has(u.params?.result?.event),T=u=>c=>{const s=new Set,n=new Map,d=new Map,f=new Map,{send:r,disconnect:h}=u(o=>{if("id"in o){c(o);const{id:e,result:i}=o;if(s.has(e)){s.delete(e),d.set(i,new Set),f.set(i,new Map);return}const t=n.get(e);if(t!==void 0){n.delete(e);const l=o.result?.operationId;if(l!==void 0&&d.has(t)){const p=d.get(t);p.add(l);const b=f.get(t)?.get(l);b&&(b.forEach(c),f.get(t).delete(l),j(b.at(-1))&&p.delete(l))}}}else{const{subscription:e,result:i}=o.params,t=d.get(e);if(t){const{operationId:l}=o.params.result;if(l!==void 0)if(t.has(l))j(o)&&t.delete(l);else{const p=f.get(e),b=p.get(l)??[];b.push(o),p.set(l,b);return}else i?.event==="stop"&&(d.delete(e),f.delete(e))}c(o)}});return{send:o=>{const e=o.params[0];switch(o.method){case k.follow:s.add(o.id);break;case k.body:case k.call:case k.storage:n.set(o.id,e);break;case k.unfollow:d.delete(e),f.delete(e);break;case k.stopOperation:d.get(e)?.delete(o.params[1])}r(o)},disconnect:h}},A=u=>c=>{const s=new Set,n=new Map,{send:d,disconnect:f}=u(r=>{if("id"in r){const{id:h,result:a}=r;s.has(h)&&(s.delete(h),n.set(a,()=>{n.delete(a)}))}else{const{subscription:h}=r.params,a=n.get(h);if(a){const o=r.params.result,{event:e}=o;if(e==="initialized"){const i=setTimeout(()=>{n.delete(h),c({event:"bestBlockChanged",bestBlockHash:o.finalizedBlockHashes.at(-1)})},500);n.set(h,()=>{n.delete(h),clearTimeout(i)})}else a()}}c(r)});return{send(r){switch(r.method){case k.follow:s.add(r.id);break;case k.unfollow:n.get(r.params[0])?.()}d(r)},disconnect:f}},G=u=>c=>u(s=>{const n=s.params?.result;if(!("id"in s)&&n){const{prunedBlockHashes:d,finalizedBlockHash:f,event:r}=n;r==="finalized"&&Array.isArray(d)?n.prunedBlockHashes=[...new Set(n.prunedBlockHashes)]:r==="initialized"&&f&&(n.finalizedBlockHashes=[n.finalizedBlockHash],delete n.finalizedBlockHash)}c(s)}),m=u=>c=>{const{send:s,disconnect:n}=u(c);return{send:f=>{const{method:r,params:h,id:a,...o}=f;r==k.unpin&&h&&Array.isArray(h[1])?h[1].forEach((e,i)=>{s({...o,id:i===0?a:`${a}-patched-${i}`,method:r,params:[h[0],e]})}):s(f)},disconnect:n}},q=u=>({jsonrpc:"2.0",...u}),[P]=y.stop.split("_"),x="unstable",J="rpc_methods",K="__INTERNAL_ID",U=u=>c=>{let s=!0,n=[],d=t=>{n.push(t)};const f=({id:t,result:l,error:p})=>{if(t!==K||!s)return;if(!l){if(console.error(p),e<4){setTimeout(i,200);return}l={methods:[]}}const b=new Set(l.methods),w={};[k,O,y].forEach(B=>{Object.values(B).forEach(S=>{if(b.has(S))w[S]=S;else{const[v,,C]=S.split("_"),D=`${v}_${x}_${C}`;if(b.has(D))w[S]=D,b.delete(D),b.add(S);else if(w[S]=null,v===P){let W;const oe=S==="stop"?"unwatch":"submitAndWatch";[P+"Watch",P].find(ie=>["v1",x].find(ae=>b.has(W=`${ie}_${ae}_${oe}`)))&&(w[S]=W,b.add(S))}}})}),r=c;const H=({method:B,...S})=>{if(B===J){Promise.resolve().then(()=>{c(q({id:S.id,result:{methods:[...b]}}))});return}const v=w[B];v===null?B.split("_")[2]==="follow"?(o(),d({method:B,...S})):Promise.resolve().then(()=>{c({error:{code:-32603,message:`Method not found: ${B}`},id:S.id})}):h({method:v||B,...S})},I=[...n];n=[];for(let B=0;s&&B<I.length;B++)H(I[B]);s&&(d=H)};let r=f;const{send:h,disconnect:a}=u(t=>{r(t)}),o=()=>{s=!0,n=[],d=t=>{n.push(t)},r=f,i()};let e=0;const i=()=>{e++,h(q({id:K,method:J,params:[]}))};return i(),{send:t=>{d(t)},disconnect(){s=!1,d=r=()=>{},n=[],a()}}},F=u=>c=>{let s=0;const n=new Map,{send:d,disconnect:f}=u(r=>{const{id:h}=r;n.has(h)&&(r.id=n.get(h),n.delete(h)),c(r)});return{send:r=>{"id"in r&&(n.set(s,r.id),r.id=s++),d(r)},disconnect:f}},se=g(F,U,T,m,G,R,$,A,Q,V);_.fixDescendantValues=V,_.fixMissingInitialBest=A,_.fixPrematureBlocks=R,_.fixUnorderedBlocks=$,_.fixUnorderedEvents=T,_.fromParsed=z,_.methods=L,_.parsed=g,_.patchChainHeadEvents=G,_.toParsed=E,_.translate=U,_.unpinHash=m,_.withNumericIds=F,_.withPolkadotSdkCompat=se}));
1
+ (function(_,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(_=typeof globalThis<"u"?globalThis:_||self,E(_.papiPolkadotSdkCompat={}))})(this,(function(_){"use strict";const E=u=>{let c=null;const{send:s,disconnect:n}=u(d=>{c?.(JSON.parse(d))});return d=>(c=d,{send(f){s(JSON.stringify(f))},disconnect(){c=null,n()}})},g=u=>{let c=null;const{send:s,disconnect:n}=u(d=>{c?.(JSON.stringify(d))});return d=>(c=d,{send(f){s(JSON.parse(f))},disconnect(){c=null,n()}})},z=(...u)=>c=>g(u.reduce((s,n)=>n(s),E(c))),b={body:"",call:"",continue:"",follow:"",header:"",stopOperation:"",storage:"",unfollow:"",unpin:""},y={broadcast:"",stop:""},O={chainName:"",genesisHash:"",properties:""};Object.entries({chainHead:b,chainSpec:O,transaction:y}).forEach(([u,c])=>{Object.keys(c).forEach(s=>{c[s]=`${u}_v1_${s}`})});var L=Object.freeze({__proto__:null,chainHead:b,chainSpec:O,transaction:y});const Q=u=>c=>{const{send:s,disconnect:n}=u(c);return{send:f=>{switch(f.method){case O.chainName:return s({...f,method:"system_chain"});case O.genesisHash:return s({...f,method:"chain_getBlockHash",params:[0]});case O.properties:return s({...f,method:"system_properties"})}s(f)},disconnect:n}},R=u=>c=>{const s=new Set,n=new Map,d=new Map,{send:f,disconnect:r}=u(a=>{if("id"in a){c(a);const{id:o,result:e}=a;if(s.has(o)){s.delete(o),n.set(e,new Set),d.set(e,new Map);return}}else{const{subscription:o}=a.params,e=n.get(o),i=d.get(o);if(e){const t=a.params.result,{event:l}=t;if(l==="initialized"&&t.finalizedBlockHashes.forEach(p=>{e.add(p)}),l==="newBlock"){const{parentBlockHash:p}=t;if(!e.has(p)){const H=i.get(p)??[];H.push(a),i.set(p,H);return}const k=t.blockHash;e.add(t.blockHash),c(a);const w=i.get(k);w&&(i.delete(k),w.forEach(H=>{e.add(H.params.result.blockHash),c(H)}));return}l==="stop"&&(e.delete(o),d.delete(o))}c(a)}});return{send:a=>{const o=a.params[0];switch(a.method){case b.follow:s.add(a.id);break;case b.unpin:const[e,i]=a.params;i.forEach(t=>{n.get(e)?.delete(t),d.get(e)?.delete(t)});break;case b.unfollow:n.delete(o),d.delete(o);break}f(a)},disconnect:r}},M=u=>({jsonrpc:"2.0",...u}),N=(u,c,s,n={})=>M({method:"chainHead_v1_followEvent",params:{subscription:u,result:{event:c,operationId:s,...n}}}),Z="__INNER_RQ_DesV",X=u=>{let c=0;const s=new Map,n=({id:h,error:a,result:o})=>{const e=s.get(h);return e&&(s.delete(h),a?e(!1,a):e(!0,o)),!e};let d=()=>{};return[h=>{const{send:a,disconnect:o}=u(e=>{n(e)&&h(e)});return d=a,{send:d,disconnect:()=>{s.clear(),o()}}},(h,a,o,e)=>{const i=Z+c++;s.set(i,(t,l)=>{(t?o:e)(l)}),d(M({id:i,method:h,params:a}))}]},Y="__INNER_OP_DesV";let ee=0;const V=u=>c=>{const[s,n]=X(u),d=te(n),f=new Map,r=new Map,{send:h,disconnect:a}=s(i=>{if("id"in i){const t=f.get(i.id);t&&(f.delete(i.id),i.result.result==="started"&&t(i.result.operationId))}else if(i.params){const{subscription:t,result:l}=i.params,{operationId:p}=l||{},k=r.get(t);k&&l.event==="stop"&&(k.forEach(H=>{H.cancel()}),r.delete(t));const w=k?.get(p);if(w)switch(l.event){case"operationInaccessible":case"operationError":w.cancel();break;case"operationStorageDone":if(w.isInnerDone)k.delete(p);else{w.isOutterDone=!0;return}}}c(i)}),o=(i,t,l)=>p=>{let k=()=>{};r.has(i)||r.set(i,new Map);const w=r.get(i),H={isOutterDone:!1,isInnerDone:!1,cancel:()=>{k()}};w.set(p,H);let v=0;const B=l.map(S=>d(S,t,I=>{c(N(i,"operationStorageItems",p,{items:I.map(([C,D])=>({key:C,value:D}))}))},I=>{k(),H.isOutterDone||h(M({method:"chainHead_v1_stopOperation",params:[p]})),c(N(i,"operationError",p,{error:typeof I=="string"?I:JSON.stringify(I)}))},()=>{++v===l.length&&(H.isOutterDone?(k(),c(N(i,"operationStorageDone",p))):H.isInnerDone=!0)}));k=()=>{w.delete(p),B.forEach(S=>S())}};return{send:i=>{switch(i.method){case b.storage:{const[t,l,p]=i.params,k=[],w=p.filter(v=>{const B=v.type==="descendantsValues";return B&&k.push(v.key),!B}),H=o(t,l,k);if(w.length)k.length&&f.set(i.id,H);else{const v=Y+ee++;c(M({id:i.id,result:{result:"started",operationId:v}})),H(v),r.get(t).get(v).isOutterDone=!0;return}i.params[2]=w;break}case b.stopOperation:{const[t,l]=i.params,p=r.get(t)?.get(l);if(p&&(p.cancel(),p.isOutterDone))return;break}case b.unfollow:{const[t]=i.params;r.get(t)?.forEach(l=>l.cancel()),r.delete(t);break}}h(i)},disconnect:a}},te=u=>(c,s,n,d,f)=>{let r=!0,h=!1,a=0;const o=t=>{r&&(r=!1,d(t))},e=1e3,i=t=>{u("state_getKeysPaged",[c,e,t||void 0,s],l=>{r&&(l.length>0&&(a++,u("state_queryStorageAt",[l,s],([{changes:p}])=>{r&&(a--,n(p),h&&!a&&f())},o)),l.length<e?(h=!0,a||f()):i(l.at(-1)))},o)};return i(),()=>{r=!1}},$=u=>c=>{const s=new Set,n=new Map,d=new Map,{send:f,disconnect:r}=u(a=>{if("id"in a){c(a);const{id:o,result:e}=a;if(s.has(o)){s.delete(o),n.set(e,new Set),d.set(e,new Map);return}}else{const{subscription:o}=a.params,e=n.get(o),i=d.get(o);if(e){const t=a.params.result,{event:l}=t;if(l==="initialized"&&t.finalizedBlockHashes.forEach(p=>{e.add(p)}),l==="finalized"&&(t.prunedBlockHashes=t.prunedBlockHashes.filter(p=>e.has(p))),l==="newBlock"){e.add(t.blockHash);const p=t.blockHash,k=i.get(p);if(k){i.delete(p),c(a),Promise.resolve().then(()=>{c(k)});return}}if(l==="bestBlockChanged"){const p=t.bestBlockHash;if(!e.has(p)){d.get(o).set(p,a);return}}l==="stop"&&(e.delete(o),d.delete(o))}c(a)}});return{send:a=>{const o=a.params[0];switch(a.method){case b.follow:s.add(a.id);break;case b.unpin:const[e,i]=a.params;i.forEach(t=>{n.get(e)?.delete(t),d.get(e)?.delete(t)});break;case b.unfollow:n.delete(o),d.delete(o);break}f(a)},disconnect:r}},ne=new Set(["BodyDone","CallDone","StorageDone","Inaccessible","Error"].map(u=>"operation"+u)),j=u=>ne.has(u.params?.result?.event),T=u=>c=>{const s=new Set,n=new Map,d=new Map,f=new Map,{send:r,disconnect:h}=u(o=>{if("id"in o){c(o);const{id:e,result:i}=o;if(s.has(e)){s.delete(e),d.set(i,new Set),f.set(i,new Map);return}const t=n.get(e);if(t!==void 0){n.delete(e);const l=o.result?.operationId;if(l!==void 0&&d.has(t)){const p=d.get(t);p.add(l);const k=f.get(t)?.get(l);k&&(k.forEach(c),f.get(t).delete(l),j(k.at(-1))&&p.delete(l))}}}else{const{subscription:e,result:i}=o.params,t=d.get(e);if(t){const{operationId:l}=o.params.result;if(l!==void 0)if(t.has(l))j(o)&&t.delete(l);else{const p=f.get(e),k=p.get(l)??[];k.push(o),p.set(l,k);return}else i?.event==="stop"&&(d.delete(e),f.delete(e))}c(o)}});return{send:o=>{const e=o.params[0];switch(o.method){case b.follow:s.add(o.id);break;case b.body:case b.call:case b.storage:n.set(o.id,e);break;case b.unfollow:d.delete(e),f.delete(e);break;case b.stopOperation:d.get(e)?.delete(o.params[1])}r(o)},disconnect:h}},se=new Set(["newBlock","bestBlockChanged","stop"]),A=u=>c=>{const s=new Set,n=new Map,{send:d,disconnect:f}=u(r=>{if("id"in r){const{id:h,result:a}=r;s.has(h)&&(s.delete(h),n.set(a,()=>{n.delete(a)}))}else{const{subscription:h}=r.params,a=n.get(h);if(a){const o=r.params.result,{event:e}=o;if(e==="initialized"){const i=setTimeout(()=>{n.delete(h),c(N(h,"bestBlockChanged",void 0,{bestBlockHash:o.finalizedBlockHashes.at(-1)}))},500);n.set(h,()=>{n.delete(h),clearTimeout(i)})}else se.has(e)&&a()}}c(r)});return{send(r){switch(r.method){case b.follow:s.add(r.id);break;case b.unfollow:n.get(r.params[0])?.()}d(r)},disconnect:f}},G=u=>c=>u(s=>{const n=s.params?.result;if(!("id"in s)&&n){const{prunedBlockHashes:d,finalizedBlockHash:f,event:r}=n;r==="finalized"&&Array.isArray(d)?n.prunedBlockHashes=[...new Set(n.prunedBlockHashes)]:r==="initialized"&&f&&(n.finalizedBlockHashes=[n.finalizedBlockHash],delete n.finalizedBlockHash)}c(s)}),m=u=>c=>{const{send:s,disconnect:n}=u(c);return{send:f=>{const{method:r,params:h,id:a,...o}=f;r==b.unpin&&h&&Array.isArray(h[1])?h[1].forEach((e,i)=>{s({...o,id:i===0?a:`${a}-patched-${i}`,method:r,params:[h[0],e]})}):s(f)},disconnect:n}},q=u=>({jsonrpc:"2.0",...u}),[P]=y.stop.split("_"),x="unstable",J="rpc_methods",K="__INTERNAL_ID",U=u=>c=>{let s=!0,n=[],d=t=>{n.push(t)};const f=({id:t,result:l,error:p})=>{if(t!==K||!s)return;if(!l){if(console.error(p),e<4){setTimeout(i,200);return}l={methods:[]}}const k=new Set(l.methods),w={};[b,O,y].forEach(B=>{Object.values(B).forEach(S=>{if(k.has(S))w[S]=S;else{const[I,,C]=S.split("_"),D=`${I}_${x}_${C}`;if(k.has(D))w[S]=D,k.delete(D),k.add(S);else if(w[S]=null,I===P){let W;const ie=S==="stop"?"unwatch":"submitAndWatch";[P+"Watch",P].find(ae=>["v1",x].find(ce=>k.has(W=`${ae}_${ce}_${ie}`)))&&(w[S]=W,k.add(S))}}})}),r=c;const H=({method:B,...S})=>{if(B===J){Promise.resolve().then(()=>{c(q({id:S.id,result:{methods:[...k]}}))});return}const I=w[B];I===null?B.split("_")[2]==="follow"?(o(),d({method:B,...S})):Promise.resolve().then(()=>{c({error:{code:-32603,message:`Method not found: ${B}`},id:S.id})}):h({method:I||B,...S})},v=[...n];n=[];for(let B=0;s&&B<v.length;B++)H(v[B]);s&&(d=H)};let r=f;const{send:h,disconnect:a}=u(t=>{r(t)}),o=()=>{s=!0,n=[],d=t=>{n.push(t)},r=f,i()};let e=0;const i=()=>{e++,h(q({id:K,method:J,params:[]}))};return i(),{send:t=>{d(t)},disconnect(){s=!1,d=r=()=>{},n=[],a()}}},F=u=>c=>{let s=0;const n=new Map,{send:d,disconnect:f}=u(r=>{const{id:h}=r;n.has(h)&&(r.id=n.get(h),n.delete(h)),c(r)});return{send:r=>{"id"in r&&(n.set(s,r.id),r.id=s++),d(r)},disconnect:f}},oe=z(F,U,T,m,G,R,$,A,Q,V);_.fixDescendantValues=V,_.fixMissingInitialBest=A,_.fixPrematureBlocks=R,_.fixUnorderedBlocks=$,_.fixUnorderedEvents=T,_.fromParsed=g,_.methods=L,_.parsed=z,_.patchChainHeadEvents=G,_.toParsed=E,_.translate=U,_.unpinHash=m,_.withNumericIds=F,_.withPolkadotSdkCompat=oe}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polkadot-api",
3
- "version": "1.23.0",
3
+ "version": "1.23.1",
4
4
  "author": "Josep M Sobrepere (https://github.com/josepot)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -204,24 +204,24 @@
204
204
  },
205
205
  "dependencies": {
206
206
  "@rx-state/core": "^0.1.4",
207
- "@polkadot-api/known-chains": "0.9.16",
207
+ "@polkadot-api/cli": "0.17.1",
208
208
  "@polkadot-api/ink-contracts": "0.4.4",
209
- "@polkadot-api/cli": "0.17.0",
209
+ "@polkadot-api/known-chains": "0.9.16",
210
210
  "@polkadot-api/json-rpc-provider": "0.0.4",
211
211
  "@polkadot-api/logs-provider": "0.0.6",
212
212
  "@polkadot-api/metadata-builders": "0.13.7",
213
+ "@polkadot-api/observable-client": "0.17.1",
213
214
  "@polkadot-api/pjs-signer": "0.6.17",
214
215
  "@polkadot-api/metadata-compatibility": "0.4.2",
215
- "@polkadot-api/observable-client": "0.17.1",
216
- "@polkadot-api/polkadot-signer": "0.1.6",
217
- "@polkadot-api/polkadot-sdk-compat": "2.4.0",
216
+ "@polkadot-api/polkadot-sdk-compat": "2.4.1",
218
217
  "@polkadot-api/signer": "0.2.11",
218
+ "@polkadot-api/polkadot-signer": "0.1.6",
219
219
  "@polkadot-api/sm-provider": "0.1.15",
220
220
  "@polkadot-api/smoldot": "0.3.15",
221
221
  "@polkadot-api/substrate-bindings": "0.16.5",
222
- "@polkadot-api/substrate-client": "0.5.0",
222
+ "@polkadot-api/ws-provider": "0.7.4",
223
223
  "@polkadot-api/utils": "0.2.0",
224
- "@polkadot-api/ws-provider": "0.7.4"
224
+ "@polkadot-api/substrate-client": "0.5.0"
225
225
  },
226
226
  "devDependencies": {
227
227
  "rxjs": "^7.8.2",