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

crossbell

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crossbell - npm Package Compare versions

Comparing version 1.8.1 to 1.8.2

dist/chunk-EV2L4TOS.mjs

4

dist/ipfs/index.global.js
var Crossbell = (function (exports) {
'use strict';
var A=Object.create;var T=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var J=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var z=(t,e,r)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var D=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of C(e))!W.call(t,a)&&a!==r&&T(t,a,{get:()=>e[a],enumerable:!(i=N(e,a))||i.enumerable});return t};var G=(t,e,r)=>(r=t!=null?A(J(t)):{},D(e||!t||!t.__esModule?T(r,"default",{value:t,enumerable:!0}):r,t));var _=(t,e,r)=>(z(t,typeof e!="symbol"?e+"":e,r),r);var I=d((rt,M)=>{function u(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0));}M.exports=u;u.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0);};u.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null;};u.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return !1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return !1;var i=this;return this._timer=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts);},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts);},r),this._options.unref&&this._timer.unref(),!0};u.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb();},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts);};u.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t);};u.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t);};u.prototype.start=u.prototype.try;u.prototype.errors=function(){return this._errors};u.prototype.attempts=function(){return this._attempts};u.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,i=0;i<this._errors.length;i++){var a=this._errors[i],n=a.message,s=(t[n]||0)+1;t[n]=s,s>=r&&(e=a,r=s);}return e};});var R=d(m=>{var j=I();m.operation=function(t){var e=m.timeouts(t);return new j(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};m.timeouts=function(t){if(t instanceof Array)return [].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],a=0;a<e.retries;a++)i.push(this.createTimeout(a,e));return t&&t.forever&&!i.length&&i.push(this.createTimeout(a,e)),i.sort(function(n,s){return n-s}),i};m.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,i=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return i=Math.min(i,e.maxTimeout),i};m.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var i in t)typeof t[i]=="function"&&r.push(i);}for(var a=0;a<r.length;a++){var n=r[a],s=t[n];t[n]=function(f){var c=m.operation(e),o=Array.prototype.slice.call(arguments,1),h=o.pop();o.push(function(l){c.retry(l)||(l&&(arguments[0]=c.mainError()),h.apply(this,arguments));}),c.attempt(function(){f.apply(t,o);});}.bind(t,s),t[n].options=e;}};});var E=d((at,b)=>{b.exports=R();});var F=d((ot,P)=>{var H=E();function K(t,e){function r(i,a){var n=e||{},s;"randomize"in n||(n.randomize=!0),s=H.operation(n);function p(o){a(o||new Error("Aborted"));}function f(o,h){if(o.bail){p(o);return}s.retry(o)?n.onRetry&&n.onRetry(o,h):a(s.mainError());}function c(o){var h;try{h=t(p,o);}catch(l){f(l,o);return}Promise.resolve(h).then(i).catch(function(S){f(S,o);});}s.attempt(c);}return new Promise(r)}P.exports=K;});var v=["https://4everland.xyz/ipfs/{cid}{pathToResource}","https://w3s.link/ipfs/{cid}{pathToResource}","https://ipfs.io/ipfs/{cid}{pathToResource}","https://dweb.link/ipfs/{cid}{pathToResource}"],g=/^ipfs:\/\/([^/]+)(.*)$/;function $(t){let[,e="",r=""]=g.exec(t)??[];return e?{cid:e,pathToResource:r}:null}function k(t,e){let r=(()=>e.pathToResource===""||e.pathToResource.startsWith("/")?e.pathToResource:`/${e.pathToResource}`)();return t.replace(/{cid}/g,e.cid).replace(/\/?{pathToResource}/g,r)}function L(t,e=v){let r=$(t);return r?e.map(i=>({gateway:i,url:k(i,r)})):[]}function w(t){return g.test(t)}var q=(t=>(t.allFailed="ipfsFetch all failed",t))(q||{}),B=class extends Error{constructor(e,r,i){super(e);_(this,"name","IpfsFetchError");this.url=r,this.web2InfoList=i;}},Y=new Promise(()=>{});function x(t,{gateways:e=v,signal:r,...i}={}){let a=L(t,e),n=new Set,s=0;return Promise.race(a.map(p=>{let f=new AbortController;n.add(f),r?.addEventListener("abort",()=>f.abort());let c=()=>(s+=1,s>=a.length?Promise.reject(new B("ipfsFetch all failed",t,a)):Y);return fetch(p.url,{...i,signal:f.signal}).then(o=>o.ok?(n.delete(f),Object.assign(o,{_info:p})):c()).catch(o=>o instanceof Error&&o.name==="AbortError"?Promise.reject(o):c())})).finally(()=>{n.forEach(p=>p.abort()),n.clear();})}var y=G(F()),U="https://w3s.link/ipfs/";function st(){return U}function ut(t){U=t;}function O(t){return (0, y.default)(async()=>await fetch("https://ipfs-relay.crossbell.io/json",{method:"POST",body:JSON.stringify(t)}).then(r=>r.json()),{retries:3})}O({});function ft(t){return (0, y.default)(async()=>{let e=new FormData;return e.append("file",t),(await fetch("https://ipfs-relay.crossbell.io/upload",{method:"post",body:e})).json()},{retries:3})}async function Q(t){let e=await O(t);if(!e?.url?.startsWith("ipfs://"))throw new Error("upload to IPFS failed");return e.url}function V(t){return (0, y.default)(async()=>{if(w(t)){let r=await x(t).then(i=>i.text());try{return JSON.parse(r)}catch{throw new Error(`Failed to parse metadata from uri: ${t}`)}}let e;try{return e=await fetch(t).then(r=>r.text()),e=JSON.parse(e),e}catch{throw new Error(`Failed to fetch metadata from uri: ${t} . Response: ${e}`)}},{retries:3})}async function pt(t,e,r=!1){if(e==="")return {uri:"",metadata:void 0};let i,a;return typeof e=="string"?(i=e,a=r?await V(i):void 0):(a=e,a.type||(a.type=t),i=await Q(a)),{metadata:a,uri:i}}
var S=Object.create;var T=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var W=(t,e,r)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var z=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of N(e))!J.call(t,a)&&a!==r&&T(t,a,{get:()=>e[a],enumerable:!(i=A(e,a))||i.enumerable});return t};var D=(t,e,r)=>(r=t!=null?S(C(t)):{},z(e||!t||!t.__esModule?T(r,"default",{value:t,enumerable:!0}):r,t));var _=(t,e,r)=>(W(t,typeof e!="symbol"?e+"":e,r),r);var I=d((rt,M)=>{function u(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0));}M.exports=u;u.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0);};u.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null;};u.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return !1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return !1;var i=this;return this._timer=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts);},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts);},r),this._options.unref&&this._timer.unref(),!0};u.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb();},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts);};u.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t);};u.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t);};u.prototype.start=u.prototype.try;u.prototype.errors=function(){return this._errors};u.prototype.attempts=function(){return this._attempts};u.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,i=0;i<this._errors.length;i++){var a=this._errors[i],n=a.message,s=(t[n]||0)+1;t[n]=s,s>=r&&(e=a,r=s);}return e};});var R=d(m=>{var Y=I();m.operation=function(t){var e=m.timeouts(t);return new Y(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};m.timeouts=function(t){if(t instanceof Array)return [].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],a=0;a<e.retries;a++)i.push(this.createTimeout(a,e));return t&&t.forever&&!i.length&&i.push(this.createTimeout(a,e)),i.sort(function(n,s){return n-s}),i};m.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,i=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return i=Math.min(i,e.maxTimeout),i};m.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var i in t)typeof t[i]=="function"&&r.push(i);}for(var a=0;a<r.length;a++){var n=r[a],s=t[n];t[n]=function(f){var c=m.operation(e),o=Array.prototype.slice.call(arguments,1),h=o.pop();o.push(function(l){c.retry(l)||(l&&(arguments[0]=c.mainError()),h.apply(this,arguments));}),c.attempt(function(){f.apply(t,o);});}.bind(t,s),t[n].options=e;}};});var E=d((at,b)=>{b.exports=R();});var F=d((ot,P)=>{var j=E();function H(t,e){function r(i,a){var n=e||{},s;"randomize"in n||(n.randomize=!0),s=j.operation(n);function p(o){a(o||new Error("Aborted"));}function f(o,h){if(o.bail){p(o);return}s.retry(o)?n.onRetry&&n.onRetry(o,h):a(s.mainError());}function c(o){var h;try{h=t(p,o);}catch(l){f(l,o);return}Promise.resolve(h).then(i).catch(function(O){f(O,o);});}s.attempt(c);}return new Promise(r)}P.exports=H;});var v=["https://4everland.xyz/ipfs/{cid}{pathToResource}","https://w3s.link/ipfs/{cid}{pathToResource}","https://ipfs.io/ipfs/{cid}{pathToResource}","https://dweb.link/ipfs/{cid}{pathToResource}"],g=/^ipfs:\/\/([^/]+)(.*)$/;function G(t){let[,e="",r=""]=g.exec(t)??[];return e?{cid:e,pathToResource:r}:null}function $(t,e){let r=(()=>e.pathToResource===""||e.pathToResource.startsWith("/")?e.pathToResource:`/${e.pathToResource}`)();return t.replace(/{cid}/g,e.cid).replace(/\/?{pathToResource}/g,r)}function k(t,e=v){let r=G(t);return r?e.map(i=>({gateway:i,url:$(i,r)})):[]}function w(t){return g.test(t)}var L=(t=>(t.allFailed="ipfsFetch all failed",t))(L||{}),q=class extends Error{constructor(e,r,i){super(e);_(this,"name","IpfsFetchError");this.url=r,this.web2InfoList=i;}},B=new Promise(()=>{});function x(t,{gateways:e=v,signal:r,...i}={}){let a=k(t,e),n=new Set,s=0;return Promise.race(a.map(p=>{let f=new AbortController;n.add(f),r?.addEventListener("abort",()=>f.abort());let c=()=>(s+=1,s>=a.length?Promise.reject(new q("ipfsFetch all failed",t,a)):B);return fetch(p.url,{...i,signal:f.signal}).then(o=>o.ok?(n.delete(f),Object.assign(o,{_info:p})):c()).catch(o=>o instanceof Error&&o.name==="AbortError"?Promise.reject(o):c())})).finally(()=>{n.forEach(p=>p.abort()),n.clear();})}var y=D(F()),U="https://w3s.link/ipfs/";function st(){return U}function ut(t){U=t;}function K(t){return (0, y.default)(async()=>await fetch("https://ipfs-relay.crossbell.io/json",{method:"POST",body:JSON.stringify(t)}).then(r=>r.json()),{retries:3})}function ft(t){return (0, y.default)(async()=>{let e=new FormData;return e.append("file",t),(await fetch("https://ipfs-relay.crossbell.io/upload",{method:"post",body:e})).json()},{retries:3})}async function Q(t){let e=await K(t);if(!e?.url?.startsWith("ipfs://"))throw new Error("upload to IPFS failed");return e.url}function V(t){return (0, y.default)(async()=>{if(w(t)){let r=await x(t).then(i=>i.text());try{return JSON.parse(r)}catch{throw new Error(`Failed to parse metadata from uri: ${t}`)}}let e;try{return e=await fetch(t).then(r=>r.text()),e=JSON.parse(e),e}catch{throw new Error(`Failed to fetch metadata from uri: ${t} . Response: ${e}`)}},{retries:3})}async function pt(t,e,r=!1){if(e==="")return {uri:"",metadata:void 0};let i,a;return typeof e=="string"?(i=e,a=r?await V(i):void 0):(a=e,a.type||(a.type=t),i=await Q(a)),{metadata:a,uri:i}}

@@ -10,3 +10,3 @@ exports.getIpfsGateway = st;

exports.ipfsUploadFile = ft;
exports.ipfsUploadJson = O;
exports.ipfsUploadJson = K;
exports.ipfsUriToMetadata = V;

@@ -13,0 +13,0 @@ exports.setIpfsGateway = ut;

@@ -30,3 +30,2 @@ 'use strict';

}
ipfsUploadJson({});
function ipfsUploadFile(file) {

@@ -33,0 +32,0 @@ return retry__default.default(

var Crossbell = (function (exports) {
'use strict';
function e(o,p={}){let{fees:m=o.fees,formatters:f=o.formatters,serializers:s=o.serializers}=p;return {...o,fees:m,formatters:f,serializers:s}}var r=e({id:3737,network:"crossbell",name:"Crossbell",nativeCurrency:{decimals:18,name:"CSB",symbol:"CSB"},rpcUrls:{default:{http:["https://rpc.crossbell.io"]},public:{http:["https://rpc.crossbell.io"]}},blockExplorers:{default:{name:"CrossScan",url:"https://scan.crossbell.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:38246031}}});var d={ENTRY:"0xa6f969045641Cf486a747A2688F3a5A6d43cd0D8",PERIPHERY:"0x96e96b7af62d628ce7eb2016d2c1d2786614ea73",NEWBIE_VILLA:"0xD0c83f0BB2c61D55B3d33950b70C59ba2f131caA",CBT:"0x3D1b588a6Bcd728Bb61570ced6656eA4C05e404f",TIPS:"0x0058be0845952D887D1668B5545de995E12e8783",TIPS_WITH_FEE:"0xf3158018f932981d0005701dDC22Ce51477E436d",MIRA:"0xAfB95CC0BD320648B3E8Df6223d9CDD05EbeDC64",LINKLIST:"0xFc8C75bD5c26F50798758f387B698f207a016b6A"},t="https://rpc.crossbell.io";function b(){return t}function T(o){t=o;}async function C(o){return await o.getChainId()===r.id}
var a=(o,r)=>()=>(o&&(r=o(o=0)),r);function t(o,r={}){let{fees:f=o.fees,formatters:s=o.formatters,serializers:x=o.serializers}=r;return {...o,fees:f,formatters:s,serializers:x}}var p=a(()=>{});p();var e=t({id:3737,network:"crossbell",name:"Crossbell",nativeCurrency:{decimals:18,name:"CSB",symbol:"CSB"},rpcUrls:{default:{http:["https://rpc.crossbell.io"]},public:{http:["https://rpc.crossbell.io"]}},blockExplorers:{default:{name:"CrossScan",url:"https://scan.crossbell.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:38246031}}});var C={ENTRY:"0xa6f969045641Cf486a747A2688F3a5A6d43cd0D8",PERIPHERY:"0x96e96b7af62d628ce7eb2016d2c1d2786614ea73",NEWBIE_VILLA:"0xD0c83f0BB2c61D55B3d33950b70C59ba2f131caA",CBT:"0x3D1b588a6Bcd728Bb61570ced6656eA4C05e404f",TIPS:"0x0058be0845952D887D1668B5545de995E12e8783",TIPS_WITH_FEE:"0xf3158018f932981d0005701dDC22Ce51477E436d",MIRA:"0xAfB95CC0BD320648B3E8Df6223d9CDD05EbeDC64",LINKLIST:"0xFc8C75bD5c26F50798758f387B698f207a016b6A"},m="https://rpc.crossbell.io";function u(){return m}function k(o){m=o;}async function h(o){return await o.getChainId()===e.id}
exports.CONTRACT_ADDRESS = d;
exports.crossbell = r;
exports.getJsonRpcAddress = b;
exports.isCrossbellMainnet = C;
exports.setJsonRpcAddress = T;
exports.CONTRACT_ADDRESS = C;
exports.crossbell = e;
exports.getJsonRpcAddress = u;
exports.isCrossbellMainnet = h;
exports.setJsonRpcAddress = k;

@@ -12,0 +12,0 @@ return exports;

{
"name": "crossbell",
"version": "1.8.1",
"version": "1.8.2",
"packageManager": "pnpm@8.7.6",

@@ -97,3 +97,3 @@ "description": "JavaScript SDK to interact with Crossbell",

"@crossbell/ipfs-fetch": "^0.0.19",
"async-cache-dedupe": "^1.12.0",
"async-cache-dedupe": "^2.0.0",
"async-retry": "^1.3.3",

@@ -103,3 +103,3 @@ "eip1193-types": "^0.2.1",

"p-limit": "^3.1.0",
"viem": "^1.12.1"
"viem": "^1.16.3"
},

@@ -109,11 +109,11 @@ "devDependencies": {

"@types/async-retry": "^1.4.6",
"@types/node": "^20.6.3",
"abitype": "^0.9.8",
"@types/node": "^20.8.4",
"abitype": "^0.9.10",
"bumpp": "^9.2.0",
"change-case": "^4.1.2",
"change-case": "^5.0.2",
"simple-git-hooks": "^2.9.0",
"tsup": "^7.2.0",
"typedoc": "^0.25.1",
"typedoc": "^0.25.2",
"typescript": "^5.2.2",
"vitest": "^0.34.5"
"vitest": "^0.34.6"
},

@@ -120,0 +120,0 @@ "engines": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

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 too big to display

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