@cowprotocol/cow-sdk 0.0.10 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,7 @@
1
- import { ErrorObject } from 'ajv';
2
1
  import { AppDataDoc } from '../types';
3
2
  interface ValidationResult {
4
3
  result: boolean;
5
- errors?: ErrorObject[];
4
+ errors?: string;
6
5
  }
7
6
  export declare function getSerializedCID(hash: string): Promise<void | string>;
8
7
  export declare function loadIpfsFromCid(cid: string, ipfsUri?: string): Promise<AppDataDoc>;
@@ -2,6 +2,8 @@ export declare class CowError extends Error {
2
2
  error_code?: string;
3
3
  constructor(message: string, error_code?: string);
4
4
  }
5
- export declare function objectToQueryString(o: any): string;
5
+ export declare function objectToQueryString(o: {
6
+ [key: string]: string | number | undefined;
7
+ }): string;
6
8
  export declare const logPrefix = "cow-sdk:";
7
9
  export declare function fromHexString(hexString: string): Uint8Array | undefined;
@@ -2,6 +2,8 @@ import { Signer } from 'ethers';
2
2
  import { SupportedChainId as ChainId } from '../constants/chains';
3
3
  export interface Ipfs {
4
4
  uri?: string;
5
+ writeUri?: string;
6
+ readUri?: string;
5
7
  pinataApiKey?: string;
6
8
  pinataApiSecret?: string;
7
9
  }
@@ -15,7 +17,8 @@ export declare const DefaultCowContext: {
15
17
  appDataHash: string;
16
18
  isDevEnvironment: boolean;
17
19
  ipfs: {
18
- uri: string;
20
+ readUri: string;
21
+ writeUri: string;
19
22
  apiKey: undefined;
20
23
  apiSecret: undefined;
21
24
  };
@@ -1,8 +1,10 @@
1
1
  import { Ipfs } from './context';
2
+ import { AppDataDoc } from '../api/metadata/types';
2
3
  declare type PinataPinResponse = {
3
4
  IpfsHash: string;
4
5
  PinSize: number;
5
6
  Timestamp: string;
6
7
  };
7
- export declare function pinJSONToIPFS(file: unknown, { uri, pinataApiKey, pinataApiSecret }: Ipfs): Promise<PinataPinResponse>;
8
+ export declare function pinJSONToIPFS(file: unknown, { writeUri, pinataApiKey, pinataApiSecret }: Ipfs): Promise<PinataPinResponse>;
9
+ export declare function calculateIpfsCidV0(doc: AppDataDoc): Promise<string>;
8
10
  export {};
@@ -28,7 +28,7 @@ export declare type SigningSchemeValue = 'eip712' | 'ethsign' | 'eip1271' | 'pre
28
28
  export declare function getSigningSchemeApiValue(ecdaSigningScheme: SigningScheme): string;
29
29
  export declare function getSigningSchemeLibValue(ecdaSigningScheme: SigningScheme): number;
30
30
  export declare type SigningResult = {
31
- signature: string;
31
+ signature?: string;
32
32
  signingScheme: SigningScheme;
33
33
  };
34
34
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/cow-sdk",
3
- "version": "0.0.10",
3
+ "version": "0.0.13",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "source": "src/index.ts",
6
6
  "main": "./dist/index.js",
@@ -31,6 +31,7 @@
31
31
  "ethers": "^5.5.3",
32
32
  "graphql": "^16.3.0",
33
33
  "graphql-request": "^4.1.0",
34
+ "ipfs-only-hash": "^4.0.0",
34
35
  "loglevel": "^1.8.0",
35
36
  "multiformats": "^9.6.4"
36
37
  },
@@ -1,2 +0,0 @@
1
- var e="https://cowswap.exchange/appdata.schema.json",t="http://json-schema.org/draft-07/schema",r="Metadata JSON document for adding information to orders.",i=["version","metadata"],s="AppData Root Schema",o={version:{$id:"#/properties/version",description:"Semantic versioning of document",examples:["1.0.0","1.2.3"],title:"Semantic Versioning",type:"string"},appCode:{$id:"#/properties/appCode",description:"The code identifying the CLI, UI, service generating the order.",examples:["CowSwap"],title:"App Code",type:"string"},metadata:{$id:"#/properties/metadata",default:{},description:"Each metadata will specify one aspect of the order.",required:[],title:"Metadata descriptors",type:"object",properties:{referrer:{$ref:"#/definitions/kindMetadata/referrer"}}}},d={version:{$id:"#/definitions/version",description:"Semantic versioning of document",examples:["1.0.0","1.2.3"],title:"Semantic Versioning",type:"string"},ethereumAddress:{$id:"#/definitions/ethereumAddress",pattern:"^0x[a-fA-F0-9]{40}$",title:"Ethereum compatible address",examples:["0xb6BAd41ae76A11D10f7b0E664C5007b908bC77C9"],type:"string"},kindMetadata:{referrer:{$id:"#/definitions/referrer",required:["version","address"],title:"Referrer",type:"object",properties:{version:{$ref:"#/definitions/version"},address:{$ref:"#/definitions/ethereumAddress",title:"Referrer address"}}}}},a={$id:e,$schema:t,description:r,required:i,title:s,type:"object",properties:o,definitions:d};exports.$id=e,exports.$schema=t,exports.default=a,exports.definitions=d,exports.description=r,exports.properties=o,exports.required=i,exports.title=s,exports.type="object";
2
- //# sourceMappingURL=appData.schema-d44994e0.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appData.schema-d44994e0.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var e="https://cowswap.exchange/appdata.schema.json",t="http://json-schema.org/draft-07/schema",i="Metadata JSON document for adding information to orders.",r=["version","metadata"],s="AppData Root Schema",a="object",d={version:{$id:"#/properties/version",description:"Semantic versioning of document",examples:["1.0.0","1.2.3"],title:"Semantic Versioning",type:"string"},appCode:{$id:"#/properties/appCode",description:"The code identifying the CLI, UI, service generating the order.",examples:["CowSwap"],title:"App Code",type:"string"},metadata:{$id:"#/properties/metadata",default:{},description:"Each metadata will specify one aspect of the order.",required:[],title:"Metadata descriptors",type:"object",properties:{referrer:{$ref:"#/definitions/kindMetadata/referrer"}}}},o={version:{$id:"#/definitions/version",description:"Semantic versioning of document",examples:["1.0.0","1.2.3"],title:"Semantic Versioning",type:"string"},ethereumAddress:{$id:"#/definitions/ethereumAddress",pattern:"^0x[a-fA-F0-9]{40}$",title:"Ethereum compatible address",examples:["0xb6BAd41ae76A11D10f7b0E664C5007b908bC77C9"],type:"string"},kindMetadata:{referrer:{$id:"#/definitions/referrer",required:["version","address"],title:"Referrer",type:"object",properties:{version:{$ref:"#/definitions/version"},address:{$ref:"#/definitions/ethereumAddress",title:"Referrer address"}}}}},n={$id:e,$schema:t,description:i,required:r,title:s,type:"object",properties:d,definitions:o};export{e as $id,t as $schema,n as default,o as definitions,i as description,d as properties,r as required,s as title,a as type};
2
- //# sourceMappingURL=appData.schema-fb2df827.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appData.schema-fb2df827.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}