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

@cowprotocol/app-data

Package Overview
Dependencies
Maintainers
5
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cowprotocol/app-data - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

dist/generatedTypes/v0.11.0.d.ts

12

dist/generatedTypes/index.d.ts
import * as v0_1_0 from './v0.1.0';
import * as v0_10_0 from './v0.10.0';
import * as v0_11_0 from './v0.11.0';
import * as v0_2_0 from './v0.2.0';

@@ -11,4 +12,4 @@ import * as v0_3_0 from './v0.3.0';

import * as v0_9_0 from './v0.9.0';
export * as latest from './v0.10.0';
export declare const LATEST_APP_DATA_VERSION = "0.10.0";
export * as latest from './v0.11.0';
export declare const LATEST_APP_DATA_VERSION = "0.11.0";
export declare const LATEST_QUOTE_METADATA_VERSION = "0.3.0";

@@ -20,4 +21,5 @@ export declare const LATEST_REFERRER_METADATA_VERSION = "0.2.0";

export declare const LATEST_SIGNER_METADATA_VERSION = "0.1.0";
export type LatestAppDataDocVersion = v0_10_0.AppDataRootSchema;
export type AnyAppDataDocVersion = v0_10_0.AppDataRootSchema | v0_9_0.AppDataRootSchema | v0_8_0.AppDataRootSchema | v0_7_0.AppDataRootSchema | v0_6_0.AppDataRootSchema | v0_5_0.AppDataRootSchema | v0_4_0.AppDataRootSchema | v0_3_0.AppDataRootSchema | v0_2_0.AppDataRootSchema | v0_1_0.AppDataRootSchema;
export { v0_10_0, v0_9_0, v0_8_0, v0_7_0, v0_6_0, v0_5_0, v0_4_0, v0_3_0, v0_2_0, v0_1_0 };
export declare const LATEST_WIDGET_METADATA_VERSION = "0.1.0";
export type LatestAppDataDocVersion = v0_11_0.AppDataRootSchema;
export type AnyAppDataDocVersion = v0_11_0.AppDataRootSchema | v0_10_0.AppDataRootSchema | v0_9_0.AppDataRootSchema | v0_8_0.AppDataRootSchema | v0_7_0.AppDataRootSchema | v0_6_0.AppDataRootSchema | v0_5_0.AppDataRootSchema | v0_4_0.AppDataRootSchema | v0_3_0.AppDataRootSchema | v0_2_0.AppDataRootSchema | v0_1_0.AppDataRootSchema;
export { v0_11_0, v0_10_0, v0_9_0, v0_8_0, v0_7_0, v0_6_0, v0_5_0, v0_4_0, v0_3_0, v0_2_0, v0_1_0 };

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

class e extends Error{}const r=function({version:e,multicodec:r,hashingAlgorithm:t,hashingLength:n,multihashHex:o}){try{return Promise.resolve(import("ethers/lib/utils")).then(function({arrayify:i}){const s=i(o),c=Uint8Array.from([e,r,t,n]);var u=new Uint8Array(c.length+s.length);return u.set(c),u.set(s,c.length),u})}catch(e){return Promise.reject(e)}},t=function(r,t){try{if(!r)throw new e("Error getting CID from appDataHex: "+t);return Promise.resolve()}catch(e){return Promise.reject(e)}},n=function(e){return Promise.resolve(function(e){try{return Promise.resolve(r({version:1,multicodec:112,hashingAlgorithm:18,hashingLength:32,multihashHex:e})).then(function(e){return Promise.resolve(import("multiformats/cid")).then(function({CID:r}){return r.decode(e).toV0().toString()})})}catch(e){return Promise.reject(e)}}(e)).then(function(r){return t(r,e),r})},o=function(e){return Promise.resolve(function(e){try{return Promise.resolve(r({version:1,multicodec:85,hashingAlgorithm:27,hashingLength:32,multihashHex:e})).then(function(e){return Promise.resolve(import("multiformats/bases/base16")).then(function({base16:r}){return r.encode(e)})})}catch(e){return Promise.reject(e)}}(e)).then(function(r){return t(r,e),r})},i=function(e){return Promise.resolve(s(e)).then(function(e){const{digest:r}=e.multihash;return`0x${Buffer.from(r).toString("hex")}`})},s=function(e){try{return Promise.resolve(import("multiformats/cid")).then(function({CID:r}){return Promise.resolve(function(e){try{let r;const t=function(){if(e[0]===c)return Promise.resolve(import("multiformats/bases/base16")).then(function({base16:e}){return r=1,e})}();return Promise.resolve(t&&t.then?t.then(function(e){return r?e:void 0}):r?t:void 0)}catch(e){return Promise.reject(e)}}(e)).then(function(t){return r.parse(e,t)})})}catch(e){return Promise.reject(e)}},c="f",u=function(e){try{return Promise.resolve(import("json-stringify-deterministic")).then(function({default:r}){return r(e)})}catch(e){return Promise.reject(e)}},a=function(e){try{if(!/^\d+\.\d+\.\d+$/.test(e))throw new Error(`AppData version ${e} is not a valid version`);return Promise.resolve(function(r,t){try{var n=Promise.resolve(import(`../schemas/v${e}.json`))}catch(e){return t()}return n&&n.then?n.then(void 0,t):n}(0,function(){throw new Error(`AppData version ${e} doesn't exist`)}))}catch(e){return Promise.reject(e)}},h=function(e){try{const{version:r}=e;return Promise.resolve(function(t,n){try{var o=Promise.resolve(m()).then(function(t){return Promise.resolve(f(t,r)).then(function(r){return{success:!!r(e),errors:r.errors?t.errorsText(r.errors):void 0}})})}catch(e){return n(e)}return o&&o.then?o.then(void 0,n):o}(0,function(e){if(e instanceof Error)return{success:!1,errors:e.message};throw e}))}catch(e){return Promise.reject(e)}},f=function(e,r){try{let t=v[r];return t||(t=l(e,r),v[r]=t),Promise.resolve(t)}catch(e){return Promise.reject(e)}},l=function(e,r){try{let t=e.getSchema(r);const n=function(){if(!t)return Promise.resolve(a(r)).then(function(n){e.addSchema(n,r),t=e.getSchema(r)})}();return Promise.resolve(n&&n.then?n.then(function(){return t}):t)}catch(e){return Promise.reject(e)}},m=function(){try{return p||(p=import("ajv").then(({default:e})=>new e)),Promise.resolve(p)}catch(e){return Promise.reject(e)}};let p,v={};const P=function(e){try{const r="string"==typeof e?e:u(e);return Promise.resolve(import("ipfs-only-hash")).then(function({of:e}){return e(r,{cidVersion:0})})}catch(e){return Promise.reject(e)}},d=function(e){try{return Promise.resolve(import("ethers/lib/utils")).then(function({keccak256:r,toUtf8Bytes:t}){return Promise.resolve(r(t(e))).then(o)})}catch(e){return Promise.reject(e)}},y=function(r,t){try{function n(n){const[o,s]="string"==typeof r?n:[r,n];return Promise.resolve(h(o)).then(function(r){if(!r?.success)throw new e(`Invalid appData provided: ${r?.errors}`);return function(r,n){try{var o=Promise.resolve(t(s)).then(function(r){return Promise.resolve(i(r)).then(function(t){if(!t)throw new e(`Could not extract appDataHex from calculated cid ${r}`);return{cid:r,appDataHex:t}})})}catch(e){return n(e)}return o&&o.then?o.then(void 0,n):o}(0,function(r){const t=r;throw console.error("Failed to calculate appDataHex",t),new e(`Failed to calculate appDataHex: ${t.message}`)})})}return Promise.resolve("string"==typeof r?n("string"==typeof r?[JSON.parse(r),r]:u(r)):Promise.resolve("string"==typeof r?[JSON.parse(r),r]:u(r)).then(n))}catch(o){return Promise.reject(o)}},_=function(e){try{const r=JSON.stringify(e);return y(r,P)}catch(e){return Promise.reject(e)}},g=function(e){return y(e,d)},D=function(e){try{return Promise.resolve(i(e))}catch(e){return Promise.reject(e)}},j=function(e,r="https://cloudflare-ipfs.com/ipfs"){try{return Promise.resolve(import("cross-fetch")).then(function({default:t}){return Promise.resolve(t(`${r}/${e}`)).then(function(e){return Promise.resolve(e.json())})})}catch(e){return Promise.reject(e)}},w=function(r,t,n){try{return Promise.resolve(function(o,i){try{var s=Promise.resolve(r(t)).then(function(r){if(!r)throw new e("Error getting serialized CID");return j(r,n)})}catch(e){return i(e)}return s&&s.then?s.then(void 0,i):s}(0,function(r){throw new e(`Error decoding AppData: appDataHex=${t}, message=${r.message}`)}))}catch(e){return Promise.reject(e)}},x=function(e,r){return w(n,e,r)},A=function(e,r){return w(o,e,r)};var H={__proto__:null},S={__proto__:null},C={__proto__:null},$={__proto__:null},T={__proto__:null},b={__proto__:null},I={__proto__:null},E={__proto__:null},F={__proto__:null},L={__proto__:null};const O="0.10.0",k="0.3.0",J="0.2.0",N="0.3.0",U="0.2.0",B="0.1.0",M="0.1.0",V=function(e){try{return Promise.resolve({...z,...e,version:"0.10.0"})}catch(e){return Promise.reject(e)}},z={appCode:"CoW Swap",metadata:{},version:"0.10.0"},K=function(r){try{return Promise.resolve(function(e,t){try{var n=Promise.resolve(a(r))}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}(0,function(r){throw new e(r.message)}))}catch(e){return Promise.reject(e)}},W=function(r,t){return Promise.resolve(function(r,{writeUri:t="https://api.pinata.cloud",pinataApiKey:n="",pinataApiSecret:o=""}){try{return Promise.resolve(import("cross-fetch")).then(function({default:i}){if(!n||!o)throw new e("You need to pass IPFS api credentials.");return Promise.resolve(u({pinataContent:r,pinataMetadata:{name:"appData"}})).then(function(e){return Promise.resolve(i(`${t}/pinning/pinJSONToIPFS`,{method:"POST",body:e,headers:{"Content-Type":"application/json",pinata_api_key:n,pinata_secret_api_key:o}})).then(function(e){return Promise.resolve(e.json()).then(function(r){if(200!==e.status)throw new Error(r.error.details||r.error);return r})})})})}catch(e){return Promise.reject(e)}}(r,t)).then(function({IpfsHash:e}){return Promise.resolve(i(e)).then(function(r){return{appData:r,cid:e}})})};class Y{constructor(){this.getAppDataSchema=K,this.generateAppDataDoc=V,this.validateAppDataDoc=h,this.appDataToCid=g,this.appDataHexToCid=o,this.cidToAppDataHex=D,this.fetchDocFromCid=j,this.fetchDocFromAppDataHex=A,this.uploadMetadataDocToIpfsLegacy=W,this.appDataToCidLegacy=_,this.appDataHexToCidLegacy=n,this.fetchDocFromAppDataHexLegacy=x}}export{O as LATEST_APP_DATA_VERSION,B as LATEST_HOOKS_METADATA_VERSION,N as LATEST_ORDER_CLASS_METADATA_VERSION,k as LATEST_QUOTE_METADATA_VERSION,J as LATEST_REFERRER_METADATA_VERSION,M as LATEST_SIGNER_METADATA_VERSION,U as LATEST_UTM_METADATA_VERSION,Y as MetadataApi,S as latest,u as stringifyDeterministic,S as v0_10_0,H as v0_1_0,C as v0_2_0,$ as v0_3_0,T as v0_4_0,b as v0_5_0,I as v0_6_0,E as v0_7_0,F as v0_8_0,L as v0_9_0};
class e extends Error{}const r=function({version:e,multicodec:r,hashingAlgorithm:t,hashingLength:n,multihashHex:o}){try{return Promise.resolve(import("ethers/lib/utils")).then(function({arrayify:i}){const s=i(o),c=Uint8Array.from([e,r,t,n]);var u=new Uint8Array(c.length+s.length);return u.set(c),u.set(s,c.length),u})}catch(e){return Promise.reject(e)}},t=function(r,t){try{if(!r)throw new e("Error getting CID from appDataHex: "+t);return Promise.resolve()}catch(e){return Promise.reject(e)}},n=function(e){return Promise.resolve(function(e){try{return Promise.resolve(r({version:1,multicodec:112,hashingAlgorithm:18,hashingLength:32,multihashHex:e})).then(function(e){return Promise.resolve(import("multiformats/cid")).then(function({CID:r}){return r.decode(e).toV0().toString()})})}catch(e){return Promise.reject(e)}}(e)).then(function(r){return t(r,e),r})},o=function(e){return Promise.resolve(function(e){try{return Promise.resolve(r({version:1,multicodec:85,hashingAlgorithm:27,hashingLength:32,multihashHex:e})).then(function(e){return Promise.resolve(import("multiformats/bases/base16")).then(function({base16:r}){return r.encode(e)})})}catch(e){return Promise.reject(e)}}(e)).then(function(r){return t(r,e),r})},i=function(e){return Promise.resolve(s(e)).then(function(e){const{digest:r}=e.multihash;return`0x${Buffer.from(r).toString("hex")}`})},s=function(e){try{return Promise.resolve(import("multiformats/cid")).then(function({CID:r}){return Promise.resolve(function(e){try{let r;const t=function(){if(e[0]===c)return Promise.resolve(import("multiformats/bases/base16")).then(function({base16:e}){return r=1,e})}();return Promise.resolve(t&&t.then?t.then(function(e){return r?e:void 0}):r?t:void 0)}catch(e){return Promise.reject(e)}}(e)).then(function(t){return r.parse(e,t)})})}catch(e){return Promise.reject(e)}},c="f",u=function(e){try{return Promise.resolve(import("json-stringify-deterministic")).then(function({default:r}){return r(e)})}catch(e){return Promise.reject(e)}},a=function(e){try{if(!/^\d+\.\d+\.\d+$/.test(e))throw new Error(`AppData version ${e} is not a valid version`);return Promise.resolve(function(r,t){try{var n=Promise.resolve(import(`../schemas/v${e}.json`))}catch(e){return t()}return n&&n.then?n.then(void 0,t):n}(0,function(){throw new Error(`AppData version ${e} doesn't exist`)}))}catch(e){return Promise.reject(e)}},h=function(e){try{const{version:r}=e;return Promise.resolve(function(t,n){try{var o=Promise.resolve(m()).then(function(t){return Promise.resolve(l(t,r)).then(function(r){return{success:!!r(e),errors:r.errors?t.errorsText(r.errors):void 0}})})}catch(e){return n(e)}return o&&o.then?o.then(void 0,n):o}(0,function(e){if(e instanceof Error)return{success:!1,errors:e.message};throw e}))}catch(e){return Promise.reject(e)}},l=function(e,r){try{let t=v[r];return t||(t=f(e,r),v[r]=t),Promise.resolve(t)}catch(e){return Promise.reject(e)}},f=function(e,r){try{let t=e.getSchema(r);const n=function(){if(!t)return Promise.resolve(a(r)).then(function(n){e.addSchema(n,r),t=e.getSchema(r)})}();return Promise.resolve(n&&n.then?n.then(function(){return t}):t)}catch(e){return Promise.reject(e)}},m=function(){try{return p||(p=import("ajv").then(({default:e})=>new e)),Promise.resolve(p)}catch(e){return Promise.reject(e)}};let p,v={};const P=function(e){try{const r="string"==typeof e?e:u(e);return Promise.resolve(import("ipfs-only-hash")).then(function({of:e}){return e(r,{cidVersion:0})})}catch(e){return Promise.reject(e)}},d=function(e){try{return Promise.resolve(import("ethers/lib/utils")).then(function({keccak256:r,toUtf8Bytes:t}){return Promise.resolve(r(t(e))).then(o)})}catch(e){return Promise.reject(e)}},y=function(r,t){try{function n(n){const[o,s]="string"==typeof r?n:[r,n];return Promise.resolve(h(o)).then(function(r){if(!r?.success)throw new e(`Invalid appData provided: ${r?.errors}`);return function(r,n){try{var o=Promise.resolve(t(s)).then(function(r){return Promise.resolve(i(r)).then(function(t){if(!t)throw new e(`Could not extract appDataHex from calculated cid ${r}`);return{cid:r,appDataHex:t}})})}catch(e){return n(e)}return o&&o.then?o.then(void 0,n):o}(0,function(r){const t=r;throw console.error("Failed to calculate appDataHex",t),new e(`Failed to calculate appDataHex: ${t.message}`)})})}return Promise.resolve("string"==typeof r?n("string"==typeof r?[JSON.parse(r),r]:u(r)):Promise.resolve("string"==typeof r?[JSON.parse(r),r]:u(r)).then(n))}catch(o){return Promise.reject(o)}},_=function(e){try{const r=JSON.stringify(e);return y(r,P)}catch(e){return Promise.reject(e)}},g=function(e){return y(e,d)},D=function(e){try{return Promise.resolve(i(e))}catch(e){return Promise.reject(e)}},j=function(e,r="https://cloudflare-ipfs.com/ipfs"){try{return Promise.resolve(import("cross-fetch")).then(function({default:t}){return Promise.resolve(t(`${r}/${e}`)).then(function(e){return Promise.resolve(e.json())})})}catch(e){return Promise.reject(e)}},w=function(r,t,n){try{return Promise.resolve(function(o,i){try{var s=Promise.resolve(r(t)).then(function(r){if(!r)throw new e("Error getting serialized CID");return j(r,n)})}catch(e){return i(e)}return s&&s.then?s.then(void 0,i):s}(0,function(r){throw new e(`Error decoding AppData: appDataHex=${t}, message=${r.message}`)}))}catch(e){return Promise.reject(e)}},x=function(e,r){return w(n,e,r)},A=function(e,r){return w(o,e,r)};var H={__proto__:null},S={__proto__:null},C={__proto__:null},$={__proto__:null},T={__proto__:null},b={__proto__:null},I={__proto__:null},E={__proto__:null},F={__proto__:null},L={__proto__:null},O={__proto__:null};const k="0.11.0",J="0.3.0",N="0.2.0",U="0.3.0",B="0.2.0",M="0.1.0",V="0.1.0",z="0.1.0",K=function(e){try{return Promise.resolve({...W,...e,version:"0.11.0"})}catch(e){return Promise.reject(e)}},W={appCode:"CoW Swap",metadata:{},version:"0.11.0"},Y=function(r){try{return Promise.resolve(function(e,t){try{var n=Promise.resolve(a(r))}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}(0,function(r){throw new e(r.message)}))}catch(e){return Promise.reject(e)}},q=function(r,t){return Promise.resolve(function(r,{writeUri:t="https://api.pinata.cloud",pinataApiKey:n="",pinataApiSecret:o=""}){try{return Promise.resolve(import("cross-fetch")).then(function({default:i}){if(!n||!o)throw new e("You need to pass IPFS api credentials.");return Promise.resolve(u({pinataContent:r,pinataMetadata:{name:"appData"}})).then(function(e){return Promise.resolve(i(`${t}/pinning/pinJSONToIPFS`,{method:"POST",body:e,headers:{"Content-Type":"application/json",pinata_api_key:n,pinata_secret_api_key:o}})).then(function(e){return Promise.resolve(e.json()).then(function(r){if(200!==e.status)throw new Error(r.error.details||r.error);return r})})})})}catch(e){return Promise.reject(e)}}(r,t)).then(function({IpfsHash:e}){return Promise.resolve(i(e)).then(function(r){return{appData:r,cid:e}})})};class G{constructor(){this.getAppDataSchema=Y,this.generateAppDataDoc=K,this.validateAppDataDoc=h,this.appDataToCid=g,this.appDataHexToCid=o,this.cidToAppDataHex=D,this.fetchDocFromCid=j,this.fetchDocFromAppDataHex=A,this.uploadMetadataDocToIpfsLegacy=q,this.appDataToCidLegacy=_,this.appDataHexToCidLegacy=n,this.fetchDocFromAppDataHexLegacy=x}}export{k as LATEST_APP_DATA_VERSION,M as LATEST_HOOKS_METADATA_VERSION,U as LATEST_ORDER_CLASS_METADATA_VERSION,J as LATEST_QUOTE_METADATA_VERSION,N as LATEST_REFERRER_METADATA_VERSION,V as LATEST_SIGNER_METADATA_VERSION,B as LATEST_UTM_METADATA_VERSION,z as LATEST_WIDGET_METADATA_VERSION,G as MetadataApi,C as latest,u as stringifyDeterministic,S as v0_10_0,C as v0_11_0,H as v0_1_0,$ as v0_2_0,T as v0_3_0,b as v0_4_0,I as v0_5_0,E as v0_6_0,F as v0_7_0,L as v0_8_0,O as v0_9_0};
//# sourceMappingURL=index.module.js.map
{
"name": "@cowprotocol/app-data",
"version": "1.1.0",
"version": "1.2.0",
"description": "CowProtocol AppData schema definitions",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc