@cowprotocol/hook-dapp-lib 1.3.1 → 2.0.2
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.
- package/CHANGELOG.md +198 -0
- package/LICENSE +674 -0
- package/README.md +0 -4
- package/demo.png +0 -0
- package/jest.config.ts +10 -0
- package/package.json +8 -19
- package/project.json +51 -0
- package/src/consts.ts +13 -0
- package/src/hookDappIframeTransport.ts +23 -0
- package/src/hookDappsRegistry.ts +209 -0
- package/src/index.ts +6 -0
- package/src/initCoWHookDapp.ts +42 -0
- package/src/types.ts +141 -0
- package/src/utils.ts +68 -0
- package/tsconfig.json +22 -0
- package/tsconfig.lib.json +10 -0
- package/tsconfig.spec.json +9 -0
- package/consts.d.ts +0 -9
- package/hookDappIframeTransport.d.ts +0 -19
- package/index.d.ts +0 -7
- package/index.iife.js +0 -1
- package/index.js +0 -1
- package/index.mjs +0 -514
- package/initCoWHookDapp.d.ts +0 -11
- package/types.d.ts +0 -63
- package/utils.d.ts +0 -11
package/types.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { HookDappType, HookDappWalletCompatibility } from './consts';
|
|
3
|
-
export interface CowHook {
|
|
4
|
-
target: string;
|
|
5
|
-
callData: string;
|
|
6
|
-
gasLimit: string;
|
|
7
|
-
dappId: string;
|
|
8
|
-
}
|
|
9
|
-
export interface HookDappConditions {
|
|
10
|
-
position?: 'post' | 'pre';
|
|
11
|
-
walletCompatibility?: HookDappWalletCompatibility[];
|
|
12
|
-
supportedNetworks?: number[];
|
|
13
|
-
}
|
|
14
|
-
export interface CowHookCreation {
|
|
15
|
-
hook: Omit<CowHook, 'dappId'>;
|
|
16
|
-
recipientOverride?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface TokenData {
|
|
19
|
-
address: string;
|
|
20
|
-
}
|
|
21
|
-
export interface CowHookDetails extends CowHookCreation {
|
|
22
|
-
hook: CowHook;
|
|
23
|
-
uuid: string;
|
|
24
|
-
}
|
|
25
|
-
export interface CowHookToEdit extends CowHookCreation {
|
|
26
|
-
uuid: string;
|
|
27
|
-
}
|
|
28
|
-
export interface CoWHookDappActions {
|
|
29
|
-
addHook(payload: CowHookCreation): void;
|
|
30
|
-
editHook(payload: CowHookToEdit): void;
|
|
31
|
-
setSellToken(token: TokenData): void;
|
|
32
|
-
setBuyToken(token: TokenData): void;
|
|
33
|
-
}
|
|
34
|
-
export interface HookDappOrderParams {
|
|
35
|
-
kind: 'buy' | 'sell';
|
|
36
|
-
validTo: number;
|
|
37
|
-
sellTokenAddress: string;
|
|
38
|
-
buyTokenAddress: string;
|
|
39
|
-
receiver: string;
|
|
40
|
-
sellAmount: string;
|
|
41
|
-
buyAmount: string;
|
|
42
|
-
}
|
|
43
|
-
export interface HookDappContext {
|
|
44
|
-
chainId: number;
|
|
45
|
-
account?: string;
|
|
46
|
-
orderParams: HookDappOrderParams | null;
|
|
47
|
-
hookToEdit?: CowHookDetails;
|
|
48
|
-
isSmartContract: boolean | undefined;
|
|
49
|
-
isPreHook: boolean;
|
|
50
|
-
isDarkMode: boolean;
|
|
51
|
-
balancesDiff: Record<string, Record<string, string>>;
|
|
52
|
-
}
|
|
53
|
-
export interface HookDappBase {
|
|
54
|
-
id: string;
|
|
55
|
-
name: string;
|
|
56
|
-
descriptionShort?: string;
|
|
57
|
-
description?: ReactNode | string;
|
|
58
|
-
type: HookDappType;
|
|
59
|
-
version: string;
|
|
60
|
-
website: string;
|
|
61
|
-
image: string;
|
|
62
|
-
conditions?: HookDappConditions;
|
|
63
|
-
}
|
package/utils.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CowHook, HookDappBase } from './types';
|
|
2
|
-
type StrictCowHook = Omit<CowHook, 'dappId'> & {
|
|
3
|
-
dappId?: string;
|
|
4
|
-
};
|
|
5
|
-
export interface HookToDappMatch {
|
|
6
|
-
dapp: HookDappBase | null;
|
|
7
|
-
hook: CowHook;
|
|
8
|
-
}
|
|
9
|
-
export declare function matchHooksToDapps(hooks: StrictCowHook[], dapps: HookDappBase[]): HookToDappMatch[];
|
|
10
|
-
export declare function matchHooksToDappsRegistry(hooks: StrictCowHook[], additionalHookDapps?: HookDappBase[]): HookToDappMatch[];
|
|
11
|
-
export {};
|