Socket
Socket
Sign inDemoInstall

@gnosis.pm/safe-react-gateway-sdk

Package Overview
Dependencies
Maintainers
4
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gnosis.pm/safe-react-gateway-sdk - npm Package Compare versions

Comparing version 2.10.3 to 3.0.0

dist/config.d.ts

34

dist/index.d.ts

@@ -15,60 +15,64 @@ import { operations } from './types/api';

/**
* Set the base CGW URL, e.g. `https://safe-client.gnosis.io`
*/
export declare const setBaseUrl: (url: string) => void;
/**
* Get basic information about a Safe. E.g. owners, modules, version etc
*/
export declare function getSafeInfo(baseUrl: string, chainId: string, address: string): Promise<SafeInfo>;
export declare function getSafeInfo(chainId: string, address: string): Promise<SafeInfo>;
/**
* Get the total balance and all assets stored in a Safe
*/
export declare function getBalances(baseUrl: string, chainId: string, address: string, currency?: string, query?: operations['safes_balances_list']['parameters']['query']): Promise<SafeBalanceResponse>;
export declare function getBalances(chainId: string, address: string, currency?: string, query?: operations['safes_balances_list']['parameters']['query']): Promise<SafeBalanceResponse>;
/**
* Get a list of supported fiat currencies (e.g. USD, EUR etc)
*/
export declare function getFiatCurrencies(baseUrl: string): Promise<FiatCurrencies>;
export declare function getFiatCurrencies(): Promise<FiatCurrencies>;
/**
* Get the addresses of all Safes belonging to an owner
*/
export declare function getOwnedSafes(baseUrl: string, chainId: string, address: string): Promise<OwnedSafes>;
export declare function getOwnedSafes(chainId: string, address: string): Promise<OwnedSafes>;
/**
* Get NFTs stored in a Safe
*/
export declare function getCollectibles(baseUrl: string, chainId: string, address: string, query?: operations['safes_collectibles_list']['parameters']['query']): Promise<SafeCollectibleResponse[]>;
export declare function getCollectibles(chainId: string, address: string, query?: operations['safes_collectibles_list']['parameters']['query']): Promise<SafeCollectibleResponse[]>;
/**
* Get a list of past Safe transactions
*/
export declare function getTransactionHistory(baseUrl: string, chainId: string, address: string, pageUrl?: string): Promise<TransactionListPage>;
export declare function getTransactionHistory(chainId: string, address: string, pageUrl?: string): Promise<TransactionListPage>;
/**
* Get the list of pending transactions
*/
export declare function getTransactionQueue(baseUrl: string, chainId: string, address: string, pageUrl?: string): Promise<TransactionListPage>;
export declare function getTransactionQueue(chainId: string, address: string, pageUrl?: string): Promise<TransactionListPage>;
/**
* Get the details of an individual transaction by its id
*/
export declare function getTransactionDetails(baseUrl: string, chainId: string, transactionId: string): Promise<TransactionDetails>;
export declare function getTransactionDetails(chainId: string, transactionId: string): Promise<TransactionDetails>;
/**
* Request a gas estimate & recommmended tx nonce for a created transaction
*/
export declare function postSafeGasEstimation(baseUrl: string, chainId: string, address: string, body: operations['post_safe_gas_estimation']['parameters']['body']): Promise<SafeTransactionEstimation>;
export declare function postSafeGasEstimation(chainId: string, address: string, body: operations['post_safe_gas_estimation']['parameters']['body']): Promise<SafeTransactionEstimation>;
/**
* Propose a new transaction for other owners to sign/execute
*/
export declare function proposeTransaction(baseUrl: string, chainId: string, address: string, body: operations['propose_transaction']['parameters']['body']): Promise<TransactionDetails>;
export declare function proposeTransaction(chainId: string, address: string, body: operations['propose_transaction']['parameters']['body']): Promise<TransactionDetails>;
/**
* Returns all defined chain configs
*/
export declare function getChainsConfig(baseUrl: string, query?: operations['chains_list']['parameters']['query']): Promise<ChainListResponse>;
export declare function getChainsConfig(query?: operations['chains_list']['parameters']['query']): Promise<ChainListResponse>;
/**
* Returns a chain config
*/
export declare function getChainConfig(baseUrl: string, chainId: string): Promise<ChainInfo>;
export declare function getChainConfig(chainId: string): Promise<ChainInfo>;
/**
* Returns Safe Apps List
*/
export declare function getSafeApps(baseUrl: string, chainId: string, query?: operations['safe_apps_read']['parameters']['query']): Promise<SafeAppsResponse>;
export declare function getSafeApps(chainId: string, query?: operations['safe_apps_read']['parameters']['query']): Promise<SafeAppsResponse>;
/**
* Returns list of Master Copies
*/
export declare function getMasterCopies(baseUrl: string, chainId: string): Promise<MasterCopyReponse>;
export declare function getMasterCopies(chainId: string): Promise<MasterCopyReponse>;
/**
* Returns decoded data
*/
export declare function getDecodedData(baseUrl: string, chainId: string, encodedData: operations['data_decoder']['parameters']['body']['data']): Promise<DecodedDataResponse>;
export declare function getDecodedData(chainId: string, encodedData: operations['data_decoder']['parameters']['body']['data']): Promise<DecodedDataResponse>;

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports['"@gnosis.pm/safe-react-gateway-sdk"']=e():t['"@gnosis.pm/safe-react-gateway-sdk"']=e()}(this,(function(){return(()=>{var t={98:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function E(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=l(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(T)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,e){t=u(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},h.prototype.delete=function(t){delete this.map[u(t)]},h.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},h.prototype.set=function(t,e){this.map[u(t)]=f(e)},h.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},h.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},n&&(h.prototype[Symbol.iterator]=h.prototype.entries);var I=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function A(t,e){var r,n,o=(e=e||{}).body;if(t instanceof A){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new h(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),I.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function T(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function v(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})},E.call(A.prototype),E.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var O=[301,302,303,307,308];v.redirect=function(t,e){if(-1===O.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function _(t,r){return new Promise((function(n,i){var s=new A(t,r);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new v(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}_.polyfill=!0,t.fetch||(t.fetch=_,t.Headers=h,t.Request=A,t.Response=v),e.Headers=h,e.Request=A,e.Response=v,e.fetch=_,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{FEATURES:()=>f,GAS_PRICE_TYPE:()=>u,LabelValue:()=>a,Operation:()=>e,RPC_AUTHENTICATION:()=>c,SafeAppAccessPolicyTypes:()=>t,TokenType:()=>d,TransactionStatus:()=>o,TransactionTokenType:()=>s,TransferDirection:()=>i,getBalances:()=>E,getChainConfig:()=>g,getChainsConfig:()=>w,getCollectibles:()=>T,getDecodedData:()=>x,getFiatCurrencies:()=>I,getMasterCopies:()=>S,getOwnedSafes:()=>A,getSafeApps:()=>C,getSafeInfo:()=>b,getTransactionDetails:()=>_,getTransactionHistory:()=>v,getTransactionQueue:()=>O,postSafeGasEstimation:()=>m,proposeTransaction:()=>N});var t,e,o,i,s,a,c,u,f,d,h=r(98),p=r.n(h);function l(t,e){return r=this,n=void 0,i=function(){var r,n,o,i,s;return function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(a){switch(a.label){case 0:return null!=e&&(r={method:"POST",body:"string"==typeof e?e:JSON.stringify(e),headers:{"Content-Type":"application/json"}}),[4,p()(t,r)];case 1:return[4,(n=a.sent()).json()];case 2:if(o=a.sent(),!n.ok){i="";try{i=(s=o).code+": "+s.message}catch(t){i=n.statusText}throw new Error(i)}return[2,o]}}))},new((o=void 0)||(o=Promise))((function(t,e){function s(t){try{c(i.next(t))}catch(t){e(t)}}function a(t){try{c(i.throw(t))}catch(t){e(t)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof o?r:new o((function(t){t(r)}))).then(s,a)}c((i=i.apply(r,n||[])).next())}));var r,n,o,i}function y(t,e,r,n){if(n)return l(n);var o=r;return l(""+t+function(t,e){return e?Object.keys(e).reduce((function(t,r){return function(t,e,r){return t.replace(new RegExp("\\{"+e+"\\}","g"),r)}(t,r,String(e[r]))}),t):t}(e,null==o?void 0:o.path)+function(t){if(!t)return"";var e=new URLSearchParams;Object.keys(t).forEach((function(r){null!=t[r]&&e.append(r,String(t[r]))}));var r=e.toString();return r?"?"+r:""}(null==o?void 0:o.query),null==o?void 0:o.body)}function b(t,e,r){return y(t,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:e,address:r}})}function E(t,e,r,n,o){return void 0===n&&(n="usd"),void 0===o&&(o={}),y(t,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:e,address:r,currency:n},query:o})}function I(t){return y(t,"/v1/balances/supported-fiat-codes")}function A(t,e,r){return y(t,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:e,address:r}})}function T(t,e,r,n){return void 0===n&&(n={}),y(t,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:r},query:n})}function v(t,e,r,n){return y(t,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:e,safe_address:r},query:{}},n)}function O(t,e,r,n){return y(t,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:e,safe_address:r},query:{}},n)}function _(t,e,r){return y(t,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:e,transactionId:r}})}function m(t,e,r,n){return y(t,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:e,safe_address:r},body:n})}function N(t,e,r,n){return y(t,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:e,safe_address:r},body:n})}function w(t,e){return y(t,"/v1/chains",{query:e})}function g(t,e){return y(t,"/v1/chains/{chainId}",{path:{chainId:e}})}function C(t,e,r){return void 0===r&&(r={}),y(t,"/v1/chains/{chainId}/safe-apps",{path:{chainId:e},query:r})}function S(t,e){return y(t,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:e}})}function x(t,e,r){return y(t,"/v1/chains/{chainId}/data-decoder",{path:{chainId:e},body:{data:r}})}!function(t){t.NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST"}(t||(t={})),function(t){t[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE"}(e||(e={})),function(t){t.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",t.AWAITING_EXECUTION="AWAITING_EXECUTION",t.CANCELLED="CANCELLED",t.FAILED="FAILED",t.SUCCESS="SUCCESS",t.PENDING="PENDING",t.WILL_BE_REPLACED="WILL_BE_REPLACED"}(o||(o={})),function(t){t.INCOMING="INCOMING",t.OUTGOING="OUTGOING",t.UNKNOWN="UNKNOWN"}(i||(i={})),function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_COIN="NATIVE_COIN"}(s||(s={})),function(t){t.Queued="Queued",t.Next="Next"}(a||(a={})),function(t){t.API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN"}(c||(c={})),function(t){t.ORACLE="ORACLE",t.FIXED="FIXED",t.UNKNOWN="UNKNOWN"}(u||(u={})),function(t){t.ERC721="ERC721",t.SAFE_APPS="SAFE_APPS",t.CONTRACT_INTERACTION="CONTRACT_INTERACTION",t.DOMAIN_LOOKUP="DOMAIN_LOOKUP",t.SPENDING_LIMIT="SPENDING_LIMIT",t.EIP1559="EIP1559",t.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL"}(f||(f={})),function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(d||(d={}))})(),n})()}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports['"@gnosis.pm/safe-react-gateway-sdk"']=e():t['"@gnosis.pm/safe-react-gateway-sdk"']=e()}(this,(function(){return(()=>{var t={98:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function E(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=l(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(T)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,e){t=u(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},h.prototype.delete=function(t){delete this.map[u(t)]},h.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},h.prototype.set=function(t,e){this.map[u(t)]=f(e)},h.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},h.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},n&&(h.prototype[Symbol.iterator]=h.prototype.entries);var I=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function A(t,e){var r,n,o=(e=e||{}).body;if(t instanceof A){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new h(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),I.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function T(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function v(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})},E.call(A.prototype),E.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var O=[301,302,303,307,308];v.redirect=function(t,e){if(-1===O.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function _(t,r){return new Promise((function(n,i){var s=new A(t,r);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new v(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}_.polyfill=!0,t.fetch||(t.fetch=_,t.Headers=h,t.Request=A,t.Response=v),e.Headers=h,e.Request=A,e.Response=v,e.fetch=_,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{FEATURES:()=>f,GAS_PRICE_TYPE:()=>u,LabelValue:()=>a,Operation:()=>e,RPC_AUTHENTICATION:()=>c,SafeAppAccessPolicyTypes:()=>t,TokenType:()=>d,TransactionStatus:()=>o,TransactionTokenType:()=>s,TransferDirection:()=>i,getBalances:()=>A,getChainConfig:()=>S,getChainsConfig:()=>C,getCollectibles:()=>O,getDecodedData:()=>R,getFiatCurrencies:()=>T,getMasterCopies:()=>P,getOwnedSafes:()=>v,getSafeApps:()=>x,getSafeInfo:()=>I,getTransactionDetails:()=>N,getTransactionHistory:()=>_,getTransactionQueue:()=>m,postSafeGasEstimation:()=>w,proposeTransaction:()=>g,setBaseUrl:()=>E});var t,e,o,i,s,a,c,u,f,d,h=r(98),p=r.n(h);function l(t,e){return r=this,n=void 0,i=function(){var r,n,o,i,s;return function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(a){switch(a.label){case 0:return null!=e&&(r={method:"POST",body:"string"==typeof e?e:JSON.stringify(e),headers:{"Content-Type":"application/json"}}),[4,p()(t,r)];case 1:return[4,(n=a.sent()).json()];case 2:if(o=a.sent(),!n.ok){i="";try{i=(s=o).code+": "+s.message}catch(t){i=n.statusText}throw new Error(i)}return[2,o]}}))},new((o=void 0)||(o=Promise))((function(t,e){function s(t){try{c(i.next(t))}catch(t){e(t)}}function a(t){try{c(i.throw(t))}catch(t){e(t)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof o?r:new o((function(t){t(r)}))).then(s,a)}c((i=i.apply(r,n||[])).next())}));var r,n,o,i}function y(t,e,r,n){if(n)return l(n);var o=r;return l(""+t+function(t,e){return e?Object.keys(e).reduce((function(t,r){return function(t,e,r){return t.replace(new RegExp("\\{"+e+"\\}","g"),r)}(t,r,String(e[r]))}),t):t}(e,null==o?void 0:o.path)+function(t){if(!t)return"";var e=new URLSearchParams;Object.keys(t).forEach((function(r){null!=t[r]&&e.append(r,String(t[r]))}));var r=e.toString();return r?"?"+r:""}(null==o?void 0:o.query),null==o?void 0:o.body)}!function(t){t.NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST"}(t||(t={})),function(t){t[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE"}(e||(e={})),function(t){t.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",t.AWAITING_EXECUTION="AWAITING_EXECUTION",t.CANCELLED="CANCELLED",t.FAILED="FAILED",t.SUCCESS="SUCCESS",t.PENDING="PENDING",t.WILL_BE_REPLACED="WILL_BE_REPLACED"}(o||(o={})),function(t){t.INCOMING="INCOMING",t.OUTGOING="OUTGOING",t.UNKNOWN="UNKNOWN"}(i||(i={})),function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_COIN="NATIVE_COIN"}(s||(s={})),function(t){t.Queued="Queued",t.Next="Next"}(a||(a={})),function(t){t.API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN"}(c||(c={})),function(t){t.ORACLE="ORACLE",t.FIXED="FIXED",t.UNKNOWN="UNKNOWN"}(u||(u={})),function(t){t.ERC721="ERC721",t.SAFE_APPS="SAFE_APPS",t.CONTRACT_INTERACTION="CONTRACT_INTERACTION",t.DOMAIN_LOOKUP="DOMAIN_LOOKUP",t.SPENDING_LIMIT="SPENDING_LIMIT",t.EIP1559="EIP1559",t.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL"}(f||(f={})),function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(d||(d={}));var b="https://safe-client.gnosis.io",E=function(t){b=t};function I(t,e){return y(b,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:t,address:e}})}function A(t,e,r,n){return void 0===r&&(r="usd"),void 0===n&&(n={}),y(b,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:t,address:e,currency:r},query:n})}function T(){return y(b,"/v1/balances/supported-fiat-codes")}function v(t,e){return y(b,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:t,address:e}})}function O(t,e,r){return void 0===r&&(r={}),y(b,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:t,address:e},query:r})}function _(t,e,r){return y(b,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:t,safe_address:e},query:{}},r)}function m(t,e,r){return y(b,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:t,safe_address:e},query:{}},r)}function N(t,e){return y(b,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:t,transactionId:e}})}function w(t,e,r){return y(b,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:t,safe_address:e},body:r})}function g(t,e,r){return y(b,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:t,safe_address:e},body:r})}function C(t){return y(b,"/v1/chains",{query:t})}function S(t){return y(b,"/v1/chains/{chainId}",{path:{chainId:t}})}function x(t,e){return void 0===e&&(e={}),y(b,"/v1/chains/{chainId}/safe-apps",{path:{chainId:t},query:e})}function P(t){return y(b,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:t}})}function R(t,e){return y(b,"/v1/chains/{chainId}/data-decoder",{path:{chainId:t},body:{data:e}})}})(),n})()}));
//# sourceMappingURL=index.min.js.map
{
"name": "@gnosis.pm/safe-react-gateway-sdk",
"version": "2.10.3",
"version": "3.0.0",
"main": "dist/index.min.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

@@ -5,9 +5,43 @@ # Safe Gateway TypeScript SDK

A TypeScript SDK for the [Safe Gateway](https://github.com/gnosis/safe-client-gateway)
A TypeScript SDK for the [Safe Client Gateway](https://github.com/gnosis/safe-client-gateway)
## Links
📖 [API reference](https://gnosis.github.io/safe-react-gateway-sdk/modules.html#getBalances)
- [Gateway API docs](https://gnosis.github.io/safe-client-gateway/docs/routes/index.html)
- [SDK typedoc](https://gnosis.github.io/safe-react-gateway-sdk/modules.html#getBalances)
## Usage policy
NB: Safe Client Gateway isn't meant for public use.
Please _do not_ use this SDK if you're building, e.g., a Safe App.
## Using the SDK
Install:
```shell
yarn add @gnosis.pm/safe-react-gateway-sdk
```
Import:
```ts
import { getChainsConfig, type ChainListResponse } from '@gnosis.pm/safe-react-gateway-sdk'
```
Use:
```ts
const chains = await getChainsConfig()
```
The SDK needs no initialization unless you want to override the base URL, which defaults to https://safe-client.gnosis.io.
You can set an alternative base URL like so:
```ts
import { setBaseUrl } from '@gnosis.pm/safe-react-gateway-sdk'
// Switch the SDK to dev mode
setBaseUrl('https://safe-client.staging.gnosisdev.com')
```
The full SDK reference can be found [here](https://gnosis.github.io/safe-react-gateway-sdk/modules.html#getBalances).
## Adding an endpoint

@@ -30,3 +64,3 @@

```
```shell
yarn eslint:fix

@@ -39,3 +73,3 @@ ```

```
```shell
yarn test

@@ -45,1 +79,6 @@ ```

N.B.: the e2e tests make actual API calls on staging.
## Gateway API docs
The TypeScript types in this SDK are based on [Rust types](https://gnosis.github.io/safe-client-gateway/docs/routes/index.html) from the Gateway API.

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