New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@monerium/sdk

Package Overview
Dependencies
Maintainers
2
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@monerium/sdk - npm Package Compare versions

Comparing version 2.8.0 to 2.8.2

16

CHANGELOG.md
# Changelog
## [2.8.2](https://github.com/monerium/js-sdk/compare/sdk-v2.8.1...sdk-v2.8.2) (2023-12-11)
### Bug Fixes
* remove authentication info on disconnect ([26e38c4](https://github.com/monerium/js-sdk/commit/26e38c46ee562deff8f04f38221ce091e24f53b2))
* test ([9c01345](https://github.com/monerium/js-sdk/commit/9c0134559b628f3abf377400c7250cecca9e41d8))
## [2.8.1](https://github.com/monerium/js-sdk/compare/sdk-v2.8.0...sdk-v2.8.1) (2023-12-02)
### Bug Fixes
* added currency to placeOrderMessage [#66](https://github.com/monerium/js-sdk/issues/66) ([496df35](https://github.com/monerium/js-sdk/commit/496df35f268330ac7158785534d11f3ffece4777))
* docs:watch task + docs update ([b42d6d8](https://github.com/monerium/js-sdk/commit/b42d6d804eb45869fd5a1ac39bf81b832e56bd2a))
## [2.8.0](https://github.com/monerium/js-sdk/compare/sdk-v2.7.3...sdk-v2.8.0) (2023-11-22)

@@ -4,0 +20,0 @@

2

dist/index.js

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

"use strict";var Z=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var w=(e,t,r)=>(Z(e,t,"read from private field"),r?r.call(e):t.get(e)),$=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},I=(e,t,r,n)=>(Z(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var B=(e,t,r)=>(Z(e,t,"access private method"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ie=(e=>(e.eur="eur",e))(ie||{}),ae=(e=>(e.corporate="corporate",e.personal="personal",e))(ae||{}),ce=(e=>(e.read="read",e.write="write",e))(ce||{}),ue=(e=>(e.absent="absent",e.submitted="submitted",e.pending="pending",e.confirmed="confirmed",e))(ue||{}),he=(e=>(e.approved="approved",e.rejected="rejected",e.unknown="unknown",e))(he||{}),de=(e=>(e.requested="requested",e.approved="approved",e.pending="pending",e))(de||{}),fe=(e=>(e.iban="iban",e.scan="scan",e.chain="chain",e))(fe||{}),le=(e=>(e.redeem="redeem",e.issue="issue",e))(le||{}),pe=(e=>(e.placed="placed",e.pending="pending",e.processed="processed",e.rejected="rejected",e))(pe||{});const Y=e=>{if(e.toString()==="Invalid Date")throw e;const t=n=>n<10?"0"+n:n,r=n=>{if(n===0)return"Z";const u=n>0?"-":"+";return n=Math.abs(n),u+t(Math.floor(n/60))+":"+t(n%60)};return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+"T"+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+r(e.getTimezoneOffset())},ke=(e,t,r)=>r?`Send EUR ${e} to ${t} on ${ee(r)} at ${Y(new Date)}`:`Send EUR ${e} to ${t} at ${Y(new Date)}`,Q=e=>{var t;return e&&((t=Object.entries(e))==null?void 0:t.length)>0?Object.entries(e).map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(n)}`).join("&"):""},ee=e=>{switch(e){case 1:case 5:return"ethereum";case 100:case 10200:return"gnosis";case 137:case 80001:return"polygon";default:throw new Error(`Chain not supported: ${e}`)}},ve=e=>{switch(e){case 1:case 100:case 137:return"mainnet";case 5:return"goerli";case 10200:return"chiado";case 80001:return"mumbai";default:throw new Error(`Network not supported: ${e}`)}},K={environments:{production:{api:"https://api.monerium.app",web:"https://monerium.app",wss:"wss://api.monerium.app"},sandbox:{api:"https://api.monerium.dev",web:"https://sandbox.monerium.dev",wss:"wss://api.monerium.dev"}}},xe="I hereby declare that I am the address owner.",M="monerium.sdk.code_verifier",W="monerium.sdk.refresh_token",Ae={LINK_MESSAGE:xe,STORAGE_CODE_VERIFIER:M,STORAGE_REFRESH_TOKEN:W};var N=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ge(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ee(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}),r}var we={exports:{}};function Ie(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var X={exports:{}};const Re={},$e=Object.freeze(Object.defineProperty({__proto__:null,default:Re},Symbol.toStringTag,{value:"Module"})),Oe=Ee($e);var re;function ye(){return re||(re=1,function(e,t){(function(r,n){e.exports=n()})(N,function(){var r=r||function(n,u){var c;if(typeof window<"u"&&window.crypto&&(c=window.crypto),typeof self<"u"&&self.crypto&&(c=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(c=globalThis.crypto),!c&&typeof window<"u"&&window.msCrypto&&(c=window.msCrypto),!c&&typeof N<"u"&&N.crypto&&(c=N.crypto),!c&&typeof Ie=="function")try{c=Oe}catch{}var v=function(){if(c){if(typeof c.getRandomValues=="function")try{return c.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof c.randomBytes=="function")try{return c.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},C=Object.create||function(){function s(){}return function(o){var a;return s.prototype=o,a=new s,s.prototype=null,a}}(),p={},y=p.lib={},m=y.Base=function(){return{extend:function(s){var o=C(this);return s&&o.mixIn(s),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments)}),o.init.prototype=o,o.$super=this,o},create:function(){var s=this.extend();return s.init.apply(s,arguments),s},init:function(){},mixIn:function(s){for(var o in s)s.hasOwnProperty(o)&&(this[o]=s[o]);s.hasOwnProperty("toString")&&(this.toString=s.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=y.WordArray=m.extend({init:function(s,o){s=this.words=s||[],o!=u?this.sigBytes=o:this.sigBytes=s.length*4},toString:function(s){return(s||d).stringify(this)},concat:function(s){var o=this.words,a=s.words,h=this.sigBytes,_=s.sigBytes;if(this.clamp(),h%4)for(var S=0;S<_;S++){var k=a[S>>>2]>>>24-S%4*8&255;o[h+S>>>2]|=k<<24-(h+S)%4*8}else for(var x=0;x<_;x+=4)o[h+x>>>2]=a[x>>>2];return this.sigBytes+=_,this},clamp:function(){var s=this.words,o=this.sigBytes;s[o>>>2]&=4294967295<<32-o%4*8,s.length=n.ceil(o/4)},clone:function(){var s=m.clone.call(this);return s.words=this.words.slice(0),s},random:function(s){for(var o=[],a=0;a<s;a+=4)o.push(v());return new g.init(o,s)}}),b=p.enc={},d=b.Hex={stringify:function(s){for(var o=s.words,a=s.sigBytes,h=[],_=0;_<a;_++){var S=o[_>>>2]>>>24-_%4*8&255;h.push((S>>>4).toString(16)),h.push((S&15).toString(16))}return h.join("")},parse:function(s){for(var o=s.length,a=[],h=0;h<o;h+=2)a[h>>>3]|=parseInt(s.substr(h,2),16)<<24-h%8*4;return new g.init(a,o/2)}},l=b.Latin1={stringify:function(s){for(var o=s.words,a=s.sigBytes,h=[],_=0;_<a;_++){var S=o[_>>>2]>>>24-_%4*8&255;h.push(String.fromCharCode(S))}return h.join("")},parse:function(s){for(var o=s.length,a=[],h=0;h<o;h++)a[h>>>2]|=(s.charCodeAt(h)&255)<<24-h%4*8;return new g.init(a,o)}},i=b.Utf8={stringify:function(s){try{return decodeURIComponent(escape(l.stringify(s)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(s){return l.parse(unescape(encodeURIComponent(s)))}},f=y.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(s){typeof s=="string"&&(s=i.parse(s)),this._data.concat(s),this._nDataBytes+=s.sigBytes},_process:function(s){var o,a=this._data,h=a.words,_=a.sigBytes,S=this.blockSize,k=S*4,x=_/k;s?x=n.ceil(x):x=n.max((x|0)-this._minBufferSize,0);var j=x*S,U=n.min(j*4,_);if(j){for(var F=0;F<j;F+=S)this._doProcessBlock(h,F);o=h.splice(0,j),a.sigBytes-=U}return new g.init(o,U)},clone:function(){var s=m.clone.call(this);return s._data=this._data.clone(),s},_minBufferSize:0});y.Hasher=f.extend({cfg:m.extend(),init:function(s){this.cfg=this.cfg.extend(s),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(s){return this._append(s),this._process(),this},finalize:function(s){s&&this._append(s);var o=this._doFinalize();return o},blockSize:16,_createHelper:function(s){return function(o,a){return new s.init(a).finalize(o)}},_createHmacHelper:function(s){return function(o,a){return new A.HMAC.init(s,a).finalize(o)}}});var A=p.algo={};return p}(Math);return r})}(X)),X.exports}(function(e,t){(function(r,n){e.exports=n(ye())})(N,function(r){return function(){var n=r,u=n.lib,c=u.WordArray,v=n.enc;v.Base64url={stringify:function(p,y){y===void 0&&(y=!0);var m=p.words,g=p.sigBytes,b=y?this._safe_map:this._map;p.clamp();for(var d=[],l=0;l<g;l+=3)for(var i=m[l>>>2]>>>24-l%4*8&255,f=m[l+1>>>2]>>>24-(l+1)%4*8&255,A=m[l+2>>>2]>>>24-(l+2)%4*8&255,s=i<<16|f<<8|A,o=0;o<4&&l+o*.75<g;o++)d.push(b.charAt(s>>>6*(3-o)&63));var a=b.charAt(64);if(a)for(;d.length%4;)d.push(a);return d.join("")},parse:function(p,y){y===void 0&&(y=!0);var m=p.length,g=y?this._safe_map:this._map,b=this._reverseMap;if(!b){b=this._reverseMap=[];for(var d=0;d<g.length;d++)b[g.charCodeAt(d)]=d}var l=g.charAt(64);if(l){var i=p.indexOf(l);i!==-1&&(m=i)}return C(p,m,b)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function C(p,y,m){for(var g=[],b=0,d=0;d<y;d++)if(d%4){var l=m[p.charCodeAt(d-1)]<<d%4*2,i=m[p.charCodeAt(d)]>>>6-d%4*2,f=l|i;g[b>>>2]|=f<<24-b%4*8,b++}return c.create(g,b)}}(),r.enc.Base64url})})(we);var Pe=we.exports;const ze=ge(Pe);var me={exports:{}};(function(e,t){(function(r,n){e.exports=n(ye())})(N,function(r){return function(n){var u=r,c=u.lib,v=c.WordArray,C=c.Hasher,p=u.algo,y=[],m=[];(function(){function d(A){for(var s=n.sqrt(A),o=2;o<=s;o++)if(!(A%o))return!1;return!0}function l(A){return(A-(A|0))*4294967296|0}for(var i=2,f=0;f<64;)d(i)&&(f<8&&(y[f]=l(n.pow(i,1/2))),m[f]=l(n.pow(i,1/3)),f++),i++})();var g=[],b=p.SHA256=C.extend({_doReset:function(){this._hash=new v.init(y.slice(0))},_doProcessBlock:function(d,l){for(var i=this._hash.words,f=i[0],A=i[1],s=i[2],o=i[3],a=i[4],h=i[5],_=i[6],S=i[7],k=0;k<64;k++){if(k<16)g[k]=d[l+k]|0;else{var x=g[k-15],j=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,U=g[k-2],F=(U<<15|U>>>17)^(U<<13|U>>>19)^U>>>10;g[k]=j+g[k-7]+F+g[k-16]}var _e=a&h^~a&_,be=f&A^f&s^A&s,Se=(f<<30|f>>>2)^(f<<19|f>>>13)^(f<<10|f>>>22),Ce=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),te=S+Ce+_e+m[k]+g[k],Be=Se+be;S=_,_=h,h=a,a=o+te|0,o=s,s=A,A=f,f=te+Be|0}i[0]=i[0]+f|0,i[1]=i[1]+A|0,i[2]=i[2]+s|0,i[3]=i[3]+o|0,i[4]=i[4]+a|0,i[5]=i[5]+h|0,i[6]=i[6]+_|0,i[7]=i[7]+S|0},_doFinalize:function(){var d=this._data,l=d.words,i=this._nDataBytes*8,f=d.sigBytes*8;return l[f>>>5]|=128<<24-f%32,l[(f+64>>>9<<4)+14]=n.floor(i/4294967296),l[(f+64>>>9<<4)+15]=i,d.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var d=C.clone.call(this);return d._hash=this._hash.clone(),d}});u.SHA256=C._createHelper(b),u.HmacSHA256=C._createHmacHelper(b)}(Math),r.SHA256})})(me);var Ue=me.exports;const He=ge(Ue),Te=(e,t)=>{const{client_id:r,redirect_uri:n,scope:u,state:c,chainId:v,chain:C,network:p,address:y,signature:m}=e,g=y?{address:y,...m!==void 0?{signature:m}:{},...v!==void 0||C!==void 0?{chain:v?ee(v):C}:{},...v!==void 0||p!==void 0?{network:v?ve(v):p}:{}}:{};return Q({client_id:r,redirect_uri:n,...u!==void 0?{scope:u}:{},...c!==void 0?{state:c}:{},code_challenge:t,code_challenge_method:"S256",response_type:"code",...g})},Me=()=>{let e="";const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length;let n=0;for(;n<128;)e+=t.charAt(Math.floor(Math.random()*r)),n+=1;return e},Le=e=>ze.stringify(He(e)),ne=(e,t)=>{const r=Me(),n=Le(r);return sessionStorage.setItem(M,r||""),`${e}/auth?${Te(t,n)}`},se=()=>{const e=window.location.href;if(!e||!(e!=null&&e.includes("?")))return;const[t,r]=e.split("?");r&&window.history.replaceState(null,"",t)},oe=e=>e.code!=null,je=e=>e.refresh_token!=null,qe=e=>e.client_secret!=null,Ne=async(e,t,r,n)=>{const u=await fetch(`${e}`,{method:t,headers:n,body:r});let c;const v=await u.text();try{c=JSON.parse(v)}catch{throw v}if(!u.ok)throw c;return c},T=typeof window>"u";var O,D,L,z,P,H,q,E,R,V,G,J;class Fe{constructor(t){$(this,H);$(this,E);$(this,O,void 0);$(this,D,void 0);$(this,L,void 0);$(this,z,void 0);$(this,P,void 0);$(this,V,void 0);$(this,G,void 0);$(this,J,void 0);if(I(this,z,new Map),this.isAuthorized=!!this.bearerProfile,I(this,V,async(r,n,u)=>{const c=sessionStorage.getItem(M)||"";if(!c)throw new Error("Code verifier not found");return this.codeVerifier=c,sessionStorage.removeItem(M),await B(this,H,q).call(this,{code:u,redirect_uri:n,client_id:r,code_verifier:c})}),I(this,G,async({clientId:r,clientSecret:n})=>await B(this,H,q).call(this,{client_id:r,client_secret:n})),I(this,J,async(r,n)=>await B(this,H,q).call(this,{refresh_token:n,client_id:r})),this.subscribeToOrderNotifications=()=>{var u,c;const r=`${w(this,O).wss}/profiles/${(u=this.bearerProfile)==null?void 0:u.profile}/orders?access_token=${(c=this.bearerProfile)==null?void 0:c.access_token}`,n=new WebSocket(r);return n.addEventListener("open",()=>{console.info(`Socket connected: ${r}`)}),n.addEventListener("error",v=>{throw console.error(v),new Error(`Socket error: ${r}`)}),n.addEventListener("message",v=>{var p;const C=JSON.parse(v.data);(p=w(this,z).get(C.meta.state))==null||p(C)}),n.addEventListener("close",()=>{console.info(`Socket connection closed: ${r}`)}),n},this.auth=async r=>await B(this,H,q).call(this,r),this.connect=async r=>await B(this,H,q).call(this,r),this.getAuthFlowURI=r=>{const n=ne(w(this,O).api,r);return this.codeVerifier=sessionStorage.getItem(M),n},this.pkceRequest=r=>this.getAuthFlowURI(r),this.getEnvironment=()=>w(this,O),!t){I(this,O,K.environments.sandbox);return}if(typeof t=="string")I(this,O,K.environments[t]);else if(I(this,O,K.environments[t.environment||"sandbox"]),T){const{clientId:r,clientSecret:n}=t;I(this,P,{clientId:r,clientSecret:n})}else{const{clientId:r,redirectUrl:n}=t;I(this,P,{clientId:r,redirectUrl:n})}}async authorize(t){var c,v;const r=(t==null?void 0:t.clientId)||((c=w(this,P))==null?void 0:c.clientId),n=(t==null?void 0:t.redirectUrl)||((v=w(this,P))==null?void 0:v.redirectUrl);if(!r)throw new Error("Missing ClientId");if(!n)throw new Error("Missing RedirectUrl");const u=ne(w(this,O).api,{client_id:r,redirect_uri:n,address:t==null?void 0:t.address,signature:t==null?void 0:t.signature,chainId:t==null?void 0:t.chainId});window.location.replace(u)}async getAccess(t){var C,p,y;const r=(t==null?void 0:t.clientId)||((C=w(this,P))==null?void 0:C.clientId);if((t==null?void 0:t.clientSecret)||((p=w(this,P))==null?void 0:p.clientSecret)){if(!T)throw new Error("Only use client credentials on server side");return await w(this,G).call(this,w(this,P)),!!this.bearerProfile}const u=(t==null?void 0:t.redirectUrl)||((y=w(this,P))==null?void 0:y.redirectUrl);if(!r)throw new Error("Missing ClientId");if(T)throw new Error("This only works client side");const c=new URLSearchParams(window.location.search).get("code")||void 0,v=sessionStorage.getItem(W)||void 0;return v?await w(this,J).call(this,r,v):c&&await w(this,V).call(this,r,u,c),!!this.bearerProfile}getAuthContext(){return B(this,E,R).call(this,"get","auth/context")}getProfile(t){return B(this,E,R).call(this,"get",`profiles/${t}`)}getBalances(t){return t?B(this,E,R).call(this,"get",`profiles/${t}/balances`):B(this,E,R).call(this,"get","balances")}getOrders(t){const r=Q(t);return B(this,E,R).call(this,"get",`orders?${r}`)}getOrder(t){return B(this,E,R).call(this,"get",`orders/${t}`)}getTokens(){return B(this,E,R).call(this,"get","tokens")}linkAddress(t,r){return B(this,E,R).call(this,"post",`profiles/${t}/addresses`,JSON.stringify(r))}placeOrder(t,r){const n={...t,kind:"redeem",currency:"eur"};return r?B(this,E,R).call(this,"post",`profiles/${r}/orders`,JSON.stringify(n)):B(this,E,R).call(this,"post","orders",JSON.stringify(n))}uploadSupportingDocument(t){const r=Q(t);return B(this,E,R).call(this,"post","files/supporting-document",r,!0)}async connectOrderSocket(){var t;(t=this.bearerProfile)!=null&&t.access_token&&w(this,z).size>0&&I(this,L,this.subscribeToOrderNotifications())}async disconnect(){var t;T||sessionStorage.removeItem(M),w(this,z).clear(),(t=w(this,L))==null||t.close()}async revokeAccess(){T||sessionStorage.removeItem(W),this.disconnect()}subscribeOrders(t,r){w(this,z).set(t,r)}unsubscribeOrders(t){var r;w(this,z).delete(t),w(this,z).size===0&&((r=w(this,L))==null||r.close(),I(this,L,void 0))}}O=new WeakMap,D=new WeakMap,L=new WeakMap,z=new WeakMap,P=new WeakMap,H=new WeakSet,q=async function(t){let r;if(oe(t))r={...t,grant_type:"authorization_code"};else if(je(t))r={...t,grant_type:"refresh_token"};else if(qe(t))r={...t,grant_type:"client_credentials"};else throw new Error("Authorization grant type could not be detected.");return await B(this,E,R).call(this,"post","auth/token",r,!0).then(n=>{var u;this.bearerProfile=n,this.isAuthorized=!!n,I(this,D,`Bearer ${n==null?void 0:n.access_token}`),T||window.sessionStorage.setItem(W,((u=this.bearerProfile)==null?void 0:u.refresh_token)||"")}).catch(n=>{throw T||(sessionStorage.removeItem(M),sessionStorage.removeItem(W),se()),new Error(n==null?void 0:n.message)}),oe(t)&&se(),this.bearerProfile},E=new WeakSet,R=async function(t,r,n,u){return Ne(`${w(this,O).api}/${r}`,t,u?Q(n):n,{Authorization:w(this,D)||"","Content-Type":`application/${u?"x-www-form-urlencoded":"json"}`})},V=new WeakMap,G=new WeakMap,J=new WeakMap;exports.AccountState=de;exports.Currency=ie;exports.KYCOutcome=he;exports.KYCState=ue;exports.MoneriumClient=Fe;exports.OrderKind=le;exports.OrderState=pe;exports.PaymentStandard=fe;exports.Permission=ce;exports.ProfileType=ae;exports.constants=Ae;exports.getChain=ee;exports.getNetwork=ve;exports.placeOrderMessage=ke;exports.rfc3339=Y;
"use strict";var Z=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var w=(e,t,r)=>(Z(e,t,"read from private field"),r?r.call(e):t.get(e)),R=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},I=(e,t,r,n)=>(Z(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var B=(e,t,r)=>(Z(e,t,"access private method"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ie=(e=>(e.eur="eur",e))(ie||{}),ae=(e=>(e.corporate="corporate",e.personal="personal",e))(ae||{}),ce=(e=>(e.read="read",e.write="write",e))(ce||{}),ue=(e=>(e.absent="absent",e.submitted="submitted",e.pending="pending",e.confirmed="confirmed",e))(ue||{}),he=(e=>(e.approved="approved",e.rejected="rejected",e.unknown="unknown",e))(he||{}),de=(e=>(e.requested="requested",e.approved="approved",e.pending="pending",e))(de||{}),fe=(e=>(e.iban="iban",e.scan="scan",e.chain="chain",e))(fe||{}),le=(e=>(e.redeem="redeem",e.issue="issue",e))(le||{}),pe=(e=>(e.placed="placed",e.pending="pending",e.processed="processed",e.rejected="rejected",e))(pe||{});const Y=e=>{if(e.toString()==="Invalid Date")throw e;const t=n=>n<10?"0"+n:n,r=n=>{if(n===0)return"Z";const u=n>0?"-":"+";return n=Math.abs(n),u+t(Math.floor(n/60))+":"+t(n%60)};return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+"T"+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+r(e.getTimezoneOffset())},ke=(e,t,r,n)=>{const u=`${(n==null?void 0:n.toUpperCase())||"EUR"}`;return r?`Send ${u} ${e} to ${t} on ${ee(r)} at ${Y(new Date)}`:`Send ${u} ${e} to ${t} at ${Y(new Date)}`},Q=e=>{var t;return e&&((t=Object.entries(e))==null?void 0:t.length)>0?Object.entries(e).map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(n)}`).join("&"):""},ee=e=>{switch(e){case 1:case 5:return"ethereum";case 100:case 10200:return"gnosis";case 137:case 80001:return"polygon";default:throw new Error(`Chain not supported: ${e}`)}},ve=e=>{switch(e){case 1:case 100:case 137:return"mainnet";case 5:return"goerli";case 10200:return"chiado";case 80001:return"mumbai";default:throw new Error(`Network not supported: ${e}`)}},K={environments:{production:{api:"https://api.monerium.app",web:"https://monerium.app",wss:"wss://api.monerium.app"},sandbox:{api:"https://api.monerium.dev",web:"https://sandbox.monerium.dev",wss:"wss://api.monerium.dev"}}},xe="I hereby declare that I am the address owner.",M="monerium.sdk.code_verifier",D="monerium.sdk.refresh_token",Ae={LINK_MESSAGE:xe,STORAGE_CODE_VERIFIER:M,STORAGE_REFRESH_TOKEN:D};var N=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ge(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ee(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}),r}var we={exports:{}};function Ie(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var X={exports:{}};const $e={},Re=Object.freeze(Object.defineProperty({__proto__:null,default:$e},Symbol.toStringTag,{value:"Module"})),Oe=Ee(Re);var re;function ye(){return re||(re=1,function(e,t){(function(r,n){e.exports=n()})(N,function(){var r=r||function(n,u){var c;if(typeof window<"u"&&window.crypto&&(c=window.crypto),typeof self<"u"&&self.crypto&&(c=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(c=globalThis.crypto),!c&&typeof window<"u"&&window.msCrypto&&(c=window.msCrypto),!c&&typeof N<"u"&&N.crypto&&(c=N.crypto),!c&&typeof Ie=="function")try{c=Oe}catch{}var v=function(){if(c){if(typeof c.getRandomValues=="function")try{return c.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof c.randomBytes=="function")try{return c.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},C=Object.create||function(){function s(){}return function(o){var a;return s.prototype=o,a=new s,s.prototype=null,a}}(),p={},y=p.lib={},m=y.Base=function(){return{extend:function(s){var o=C(this);return s&&o.mixIn(s),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments)}),o.init.prototype=o,o.$super=this,o},create:function(){var s=this.extend();return s.init.apply(s,arguments),s},init:function(){},mixIn:function(s){for(var o in s)s.hasOwnProperty(o)&&(this[o]=s[o]);s.hasOwnProperty("toString")&&(this.toString=s.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=y.WordArray=m.extend({init:function(s,o){s=this.words=s||[],o!=u?this.sigBytes=o:this.sigBytes=s.length*4},toString:function(s){return(s||d).stringify(this)},concat:function(s){var o=this.words,a=s.words,h=this.sigBytes,_=s.sigBytes;if(this.clamp(),h%4)for(var S=0;S<_;S++){var k=a[S>>>2]>>>24-S%4*8&255;o[h+S>>>2]|=k<<24-(h+S)%4*8}else for(var x=0;x<_;x+=4)o[h+x>>>2]=a[x>>>2];return this.sigBytes+=_,this},clamp:function(){var s=this.words,o=this.sigBytes;s[o>>>2]&=4294967295<<32-o%4*8,s.length=n.ceil(o/4)},clone:function(){var s=m.clone.call(this);return s.words=this.words.slice(0),s},random:function(s){for(var o=[],a=0;a<s;a+=4)o.push(v());return new g.init(o,s)}}),b=p.enc={},d=b.Hex={stringify:function(s){for(var o=s.words,a=s.sigBytes,h=[],_=0;_<a;_++){var S=o[_>>>2]>>>24-_%4*8&255;h.push((S>>>4).toString(16)),h.push((S&15).toString(16))}return h.join("")},parse:function(s){for(var o=s.length,a=[],h=0;h<o;h+=2)a[h>>>3]|=parseInt(s.substr(h,2),16)<<24-h%8*4;return new g.init(a,o/2)}},l=b.Latin1={stringify:function(s){for(var o=s.words,a=s.sigBytes,h=[],_=0;_<a;_++){var S=o[_>>>2]>>>24-_%4*8&255;h.push(String.fromCharCode(S))}return h.join("")},parse:function(s){for(var o=s.length,a=[],h=0;h<o;h++)a[h>>>2]|=(s.charCodeAt(h)&255)<<24-h%4*8;return new g.init(a,o)}},i=b.Utf8={stringify:function(s){try{return decodeURIComponent(escape(l.stringify(s)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(s){return l.parse(unescape(encodeURIComponent(s)))}},f=y.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(s){typeof s=="string"&&(s=i.parse(s)),this._data.concat(s),this._nDataBytes+=s.sigBytes},_process:function(s){var o,a=this._data,h=a.words,_=a.sigBytes,S=this.blockSize,k=S*4,x=_/k;s?x=n.ceil(x):x=n.max((x|0)-this._minBufferSize,0);var j=x*S,U=n.min(j*4,_);if(j){for(var W=0;W<j;W+=S)this._doProcessBlock(h,W);o=h.splice(0,j),a.sigBytes-=U}return new g.init(o,U)},clone:function(){var s=m.clone.call(this);return s._data=this._data.clone(),s},_minBufferSize:0});y.Hasher=f.extend({cfg:m.extend(),init:function(s){this.cfg=this.cfg.extend(s),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(s){return this._append(s),this._process(),this},finalize:function(s){s&&this._append(s);var o=this._doFinalize();return o},blockSize:16,_createHelper:function(s){return function(o,a){return new s.init(a).finalize(o)}},_createHmacHelper:function(s){return function(o,a){return new A.HMAC.init(s,a).finalize(o)}}});var A=p.algo={};return p}(Math);return r})}(X)),X.exports}(function(e,t){(function(r,n){e.exports=n(ye())})(N,function(r){return function(){var n=r,u=n.lib,c=u.WordArray,v=n.enc;v.Base64url={stringify:function(p,y){y===void 0&&(y=!0);var m=p.words,g=p.sigBytes,b=y?this._safe_map:this._map;p.clamp();for(var d=[],l=0;l<g;l+=3)for(var i=m[l>>>2]>>>24-l%4*8&255,f=m[l+1>>>2]>>>24-(l+1)%4*8&255,A=m[l+2>>>2]>>>24-(l+2)%4*8&255,s=i<<16|f<<8|A,o=0;o<4&&l+o*.75<g;o++)d.push(b.charAt(s>>>6*(3-o)&63));var a=b.charAt(64);if(a)for(;d.length%4;)d.push(a);return d.join("")},parse:function(p,y){y===void 0&&(y=!0);var m=p.length,g=y?this._safe_map:this._map,b=this._reverseMap;if(!b){b=this._reverseMap=[];for(var d=0;d<g.length;d++)b[g.charCodeAt(d)]=d}var l=g.charAt(64);if(l){var i=p.indexOf(l);i!==-1&&(m=i)}return C(p,m,b)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function C(p,y,m){for(var g=[],b=0,d=0;d<y;d++)if(d%4){var l=m[p.charCodeAt(d-1)]<<d%4*2,i=m[p.charCodeAt(d)]>>>6-d%4*2,f=l|i;g[b>>>2]|=f<<24-b%4*8,b++}return c.create(g,b)}}(),r.enc.Base64url})})(we);var Pe=we.exports;const ze=ge(Pe);var me={exports:{}};(function(e,t){(function(r,n){e.exports=n(ye())})(N,function(r){return function(n){var u=r,c=u.lib,v=c.WordArray,C=c.Hasher,p=u.algo,y=[],m=[];(function(){function d(A){for(var s=n.sqrt(A),o=2;o<=s;o++)if(!(A%o))return!1;return!0}function l(A){return(A-(A|0))*4294967296|0}for(var i=2,f=0;f<64;)d(i)&&(f<8&&(y[f]=l(n.pow(i,1/2))),m[f]=l(n.pow(i,1/3)),f++),i++})();var g=[],b=p.SHA256=C.extend({_doReset:function(){this._hash=new v.init(y.slice(0))},_doProcessBlock:function(d,l){for(var i=this._hash.words,f=i[0],A=i[1],s=i[2],o=i[3],a=i[4],h=i[5],_=i[6],S=i[7],k=0;k<64;k++){if(k<16)g[k]=d[l+k]|0;else{var x=g[k-15],j=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,U=g[k-2],W=(U<<15|U>>>17)^(U<<13|U>>>19)^U>>>10;g[k]=j+g[k-7]+W+g[k-16]}var _e=a&h^~a&_,be=f&A^f&s^A&s,Se=(f<<30|f>>>2)^(f<<19|f>>>13)^(f<<10|f>>>22),Ce=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),te=S+Ce+_e+m[k]+g[k],Be=Se+be;S=_,_=h,h=a,a=o+te|0,o=s,s=A,A=f,f=te+Be|0}i[0]=i[0]+f|0,i[1]=i[1]+A|0,i[2]=i[2]+s|0,i[3]=i[3]+o|0,i[4]=i[4]+a|0,i[5]=i[5]+h|0,i[6]=i[6]+_|0,i[7]=i[7]+S|0},_doFinalize:function(){var d=this._data,l=d.words,i=this._nDataBytes*8,f=d.sigBytes*8;return l[f>>>5]|=128<<24-f%32,l[(f+64>>>9<<4)+14]=n.floor(i/4294967296),l[(f+64>>>9<<4)+15]=i,d.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var d=C.clone.call(this);return d._hash=this._hash.clone(),d}});u.SHA256=C._createHelper(b),u.HmacSHA256=C._createHmacHelper(b)}(Math),r.SHA256})})(me);var Ue=me.exports;const He=ge(Ue),Te=(e,t)=>{const{client_id:r,redirect_uri:n,scope:u,state:c,chainId:v,chain:C,network:p,address:y,signature:m}=e,g=y?{address:y,...m!==void 0?{signature:m}:{},...v!==void 0||C!==void 0?{chain:v?ee(v):C}:{},...v!==void 0||p!==void 0?{network:v?ve(v):p}:{}}:{};return Q({client_id:r,redirect_uri:n,...u!==void 0?{scope:u}:{},...c!==void 0?{state:c}:{},code_challenge:t,code_challenge_method:"S256",response_type:"code",...g})},Me=()=>{let e="";const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length;let n=0;for(;n<128;)e+=t.charAt(Math.floor(Math.random()*r)),n+=1;return e},Le=e=>ze.stringify(He(e)),ne=(e,t)=>{const r=Me(),n=Le(r);return sessionStorage.setItem(M,r||""),`${e}/auth?${Te(t,n)}`},se=()=>{const e=window.location.href;if(!e||!(e!=null&&e.includes("?")))return;const[t,r]=e.split("?");r&&window.history.replaceState(null,"",t)},oe=e=>e.code!=null,je=e=>e.refresh_token!=null,qe=e=>e.client_secret!=null,Ne=async(e,t,r,n)=>{const u=await fetch(`${e}`,{method:t,headers:n,body:r});let c;const v=await u.text();try{c=JSON.parse(v)}catch{throw v}if(!u.ok)throw c;return c},T=typeof window>"u";var O,F,L,z,P,H,q,E,$,V,G,J;class Fe{constructor(t){R(this,H);R(this,E);R(this,O,void 0);R(this,F,void 0);R(this,L,void 0);R(this,z,void 0);R(this,P,void 0);R(this,V,void 0);R(this,G,void 0);R(this,J,void 0);if(I(this,z,new Map),this.isAuthorized=!!this.bearerProfile,I(this,V,async(r,n,u)=>{const c=sessionStorage.getItem(M)||"";if(!c)throw new Error("Code verifier not found");return this.codeVerifier=c,sessionStorage.removeItem(M),await B(this,H,q).call(this,{code:u,redirect_uri:n,client_id:r,code_verifier:c})}),I(this,G,async({clientId:r,clientSecret:n})=>await B(this,H,q).call(this,{client_id:r,client_secret:n})),I(this,J,async(r,n)=>await B(this,H,q).call(this,{refresh_token:n,client_id:r})),this.subscribeToOrderNotifications=()=>{var u,c;const r=`${w(this,O).wss}/profiles/${(u=this.bearerProfile)==null?void 0:u.profile}/orders?access_token=${(c=this.bearerProfile)==null?void 0:c.access_token}`,n=new WebSocket(r);return n.addEventListener("open",()=>{console.info(`Socket connected: ${r}`)}),n.addEventListener("error",v=>{throw console.error(v),new Error(`Socket error: ${r}`)}),n.addEventListener("message",v=>{var p;const C=JSON.parse(v.data);(p=w(this,z).get(C.meta.state))==null||p(C)}),n.addEventListener("close",()=>{console.info(`Socket connection closed: ${r}`)}),n},this.auth=async r=>await B(this,H,q).call(this,r),this.connect=async r=>await B(this,H,q).call(this,r),this.getAuthFlowURI=r=>{const n=ne(w(this,O).api,r);return this.codeVerifier=sessionStorage.getItem(M),n},this.pkceRequest=r=>this.getAuthFlowURI(r),this.getEnvironment=()=>w(this,O),!t){I(this,O,K.environments.sandbox);return}if(typeof t=="string")I(this,O,K.environments[t]);else if(I(this,O,K.environments[t.environment||"sandbox"]),T){const{clientId:r,clientSecret:n}=t;I(this,P,{clientId:r,clientSecret:n})}else{const{clientId:r,redirectUrl:n}=t;I(this,P,{clientId:r,redirectUrl:n})}}async authorize(t){var c,v;const r=(t==null?void 0:t.clientId)||((c=w(this,P))==null?void 0:c.clientId),n=(t==null?void 0:t.redirectUrl)||((v=w(this,P))==null?void 0:v.redirectUrl);if(!r)throw new Error("Missing ClientId");if(!n)throw new Error("Missing RedirectUrl");const u=ne(w(this,O).api,{client_id:r,redirect_uri:n,address:t==null?void 0:t.address,signature:t==null?void 0:t.signature,chainId:t==null?void 0:t.chainId});window.location.replace(u)}async getAccess(t){var C,p,y;const r=(t==null?void 0:t.clientId)||((C=w(this,P))==null?void 0:C.clientId);if((t==null?void 0:t.clientSecret)||((p=w(this,P))==null?void 0:p.clientSecret)){if(!T)throw new Error("Only use client credentials on server side");return await w(this,G).call(this,w(this,P)),!!this.bearerProfile}const u=(t==null?void 0:t.redirectUrl)||((y=w(this,P))==null?void 0:y.redirectUrl);if(!r)throw new Error("Missing ClientId");if(T)throw new Error("This only works client side");const c=new URLSearchParams(window.location.search).get("code")||void 0,v=sessionStorage.getItem(D)||void 0;return v?await w(this,J).call(this,r,v):c&&await w(this,V).call(this,r,u,c),!!this.bearerProfile}getAuthContext(){return B(this,E,$).call(this,"get","auth/context")}getProfile(t){return B(this,E,$).call(this,"get",`profiles/${t}`)}getBalances(t){return t?B(this,E,$).call(this,"get",`profiles/${t}/balances`):B(this,E,$).call(this,"get","balances")}getOrders(t){const r=Q(t);return B(this,E,$).call(this,"get",`orders?${r}`)}getOrder(t){return B(this,E,$).call(this,"get",`orders/${t}`)}getTokens(){return B(this,E,$).call(this,"get","tokens")}linkAddress(t,r){return B(this,E,$).call(this,"post",`profiles/${t}/addresses`,JSON.stringify(r))}placeOrder(t,r){const n={...t,kind:"redeem",currency:"eur"};return r?B(this,E,$).call(this,"post",`profiles/${r}/orders`,JSON.stringify(n)):B(this,E,$).call(this,"post","orders",JSON.stringify(n))}uploadSupportingDocument(t){const r=Q(t);return B(this,E,$).call(this,"post","files/supporting-document",r,!0)}async connectOrderSocket(){var t;(t=this.bearerProfile)!=null&&t.access_token&&w(this,z).size>0&&I(this,L,this.subscribeToOrderNotifications())}async disconnect(){var t;T||sessionStorage.removeItem(M),w(this,z).clear(),(t=w(this,L))==null||t.close(),I(this,F,void 0),this.bearerProfile=void 0}async revokeAccess(){T||sessionStorage.removeItem(D),this.disconnect()}subscribeOrders(t,r){w(this,z).set(t,r)}unsubscribeOrders(t){var r;w(this,z).delete(t),w(this,z).size===0&&((r=w(this,L))==null||r.close(),I(this,L,void 0))}}O=new WeakMap,F=new WeakMap,L=new WeakMap,z=new WeakMap,P=new WeakMap,H=new WeakSet,q=async function(t){let r;if(oe(t))r={...t,grant_type:"authorization_code"};else if(je(t))r={...t,grant_type:"refresh_token"};else if(qe(t))r={...t,grant_type:"client_credentials"};else throw new Error("Authorization grant type could not be detected.");return await B(this,E,$).call(this,"post","auth/token",r,!0).then(n=>{var u;this.bearerProfile=n,this.isAuthorized=!!n,I(this,F,`Bearer ${n==null?void 0:n.access_token}`),T||window.sessionStorage.setItem(D,((u=this.bearerProfile)==null?void 0:u.refresh_token)||"")}).catch(n=>{throw T||(sessionStorage.removeItem(M),sessionStorage.removeItem(D),se()),new Error(n==null?void 0:n.message)}),oe(t)&&se(),this.bearerProfile},E=new WeakSet,$=async function(t,r,n,u){return Ne(`${w(this,O).api}/${r}`,t,u?Q(n):n,{Authorization:w(this,F)||"","Content-Type":`application/${u?"x-www-form-urlencoded":"json"}`})},V=new WeakMap,G=new WeakMap,J=new WeakMap;exports.AccountState=de;exports.Currency=ie;exports.KYCOutcome=he;exports.KYCState=ue;exports.MoneriumClient=Fe;exports.OrderKind=le;exports.OrderState=pe;exports.PaymentStandard=fe;exports.Permission=ce;exports.ProfileType=ae;exports.constants=Ae;exports.getChain=ee;exports.getNetwork=ve;exports.placeOrderMessage=ke;exports.rfc3339=Y;
{
"name": "@monerium/sdk",
"version": "2.8.0",
"version": "2.8.2",
"description": "Everything you need to interact with the Monerium API - an electronic money issuer.",

@@ -32,3 +32,2 @@ "license": "MIT",

"scripts": {
"build:watch": "yarn build:main --watch",
"docs": "yarn typedoc --options docs/typedoc.json && node docs/editStatic.js",

@@ -38,2 +37,3 @@ "docs:watch": "nodemon --watch . --ignore static -e ts,css,md --exec 'typedoc --options docs/typedoc.json && node docs/editStatic.js'"

"devDependencies": {
"nodemon": "3.0.1",
"typedoc": "0.23.23",

@@ -40,0 +40,0 @@ "typedoc-theme-hierarchy": "^3.2.1"

@@ -8,3 +8,3 @@ import { Balances, Chain, ChainId, Networks, Profile } from '../src/types';

*/
export declare const placeOrderMessage: (amount: string | number, receiver: string, chainId?: number) => string;
export declare const placeOrderMessage: (amount: string | number, receiver: string, chainId?: number, currency?: 'eur' | 'gbp' | 'usd' | 'isk') => string;
/**

@@ -11,0 +11,0 @@ * Replacement for URLSearchParams, Metamask snaps do not include node globals.

{
"name": "@monerium/sdk",
"version": "2.8.0",
"version": "2.8.2",
"description": "Everything you need to interact with the Monerium API - an electronic money issuer.",

@@ -32,3 +32,2 @@ "license": "MIT",

"scripts": {
"build:watch": "yarn build:main --watch",
"docs": "yarn typedoc --options docs/typedoc.json && node docs/editStatic.js",

@@ -38,2 +37,3 @@ "docs:watch": "nodemon --watch . --ignore static -e ts,css,md --exec 'typedoc --options docs/typedoc.json && node docs/editStatic.js'"

"devDependencies": {
"nodemon": "3.0.1",
"typedoc": "0.23.23",

@@ -40,0 +40,0 @@ "typedoc-theme-hierarchy": "^3.2.1"

@@ -318,3 +318,3 @@ # Monerium SDK Documentation

````ts
```ts
import { OrderState } from '@monerium/sdk';

@@ -324,22 +324,22 @@ const [orderState, setOrderState] = useState<OrderState>();

monerium.subscribeOrders(OrderState.pending, (notification) => {
setOrderState(notification.meta.state)
})
setOrderState(notification.meta.state);
});
monerium.subscribeOrders(OrderState.placed, (notification) => {
setOrderState(notification.meta.state)
})
monerium.subscribeOrders(OrderState.placed, (notification) => {
setOrderState(notification.meta.state);
});
monerium.subscribeOrders(OrderState.rejected, (notification) => {
setOrderState(notification.meta.state)
monerium.subscribeOrders(OrderState.rejected, (notification) => {
setOrderState(notification.meta.state);
setTimeout(() => {
setOrderState(undefined)
}, 5000)
})
setOrderState(undefined);
}, 5000);
});
monerium.subscribeOrders(OrderState.processed, (notification) => {
setOrderState(notification.meta.state)
monerium.subscribeOrders(OrderState.processed, (notification) => {
setOrderState(notification.meta.state);
setTimeout(() => {
setOrderState(undefined)
}, 5000)
})
setOrderState(undefined);
}, 5000);
});
```

@@ -359,21 +359,17 @@

# Install dependencies
yarn
nx run sdk:init
# Run Vite to build a production release distributable
yarn build
nx run sdk:build
# Run Vite in watch mode to detect changes to files during development
yarn watch
nx run sdk:build --watch
# Update the docs. This will run the build and update the docs in the static folder.
# Open static/index.html in your browser to view the docs. Refresh the page to see changes.
yarn docs:watch
````
nx run sdk:docs:watch
```
Smart IDEs (such as VSCode) require [special configuration](https://yarnpkg.com/getting-started/editor-sdks) for TypeScript to work when using Yarn Plug'n'Play installs.
## Linking
```sh
yarn dlx @yarnpkg/sdks vscode
```
For development, a package can be linked into another project. This is often useful to test out new features or when trying to debug an issue in a package that manifests itself in another project. run yarn link inside of the sdk project.

@@ -394,6 +390,8 @@

#### Documentation
### Documentation
Refer to [Typedocs](https://typedoc.org/) syntaxes to use for this [documentation](https://monerium.github.io/sdk/).
Refer to [Typedocs](https://typedoc.org/) syntaxes to use for this [documentation](https://monerium.github.io/js-sdk/).
There is a Github action that will automatically run on the successful release of the SDK. It will generate a static output of the documentation and push it to the `gh-pages` branch. The documentation is then available at https://monerium.github.io/js-sdk/.
#### Publishing

@@ -400,0 +398,0 @@

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