-
Notifications
You must be signed in to change notification settings - Fork 19
/
types.ts
119 lines (96 loc) · 2.73 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import { Bridge, ERC721MinterBurnerPauser } from '@buildwithsygma/sygma-contracts';
import { ethers } from 'ethers';
import { Erc20Detailed } from '../Contracts/Erc20Detailed';
import { FeeType, TokenConfig } from '../../chains/EVM/types';
/**
* @deprecated since version 1.4.0
*/
export interface SygmaSDK {}
export type Directions = 'chain1' | 'chain2';
export type Setup = {
bridgeSetupList: EvmBridgeSetupList;
bridgeSetup?: BridgeData;
feeOracleSetup?: FeeOracleData;
};
export type EvmBridgeSetup = {
name: string;
type: 'Ethereum';
networkId: number;
bridgeAddress: string;
feeRouterAddress: string;
erc20HandlerAddress: string;
erc721HandlerAddress: string;
feeOracleHandlerAddress?: string;
rpcUrl: string;
domainId: string;
decimals: number;
tokens: TokenConfig[];
confirmations?: number;
feeHandlers: Array<{ address: string; type: 'basic' | 'oracle' }>;
};
export type EvmBridgeSetupList = EvmBridgeSetup[];
export type BridgeData = {
chain1: EvmBridgeSetup;
chain2: EvmBridgeSetup;
};
export type FeeOracleData = {
feeOracleBaseUrl: string;
};
export type OracleResource = {
baseEffectiveRate: string;
tokenEffectiveRate: string;
dstGasPrice: string;
signature: string;
fromDomainID: number;
toDomainID: number;
resourceID: string;
dataTimestamp: number;
signatureTimestamp: number;
expirationTimestamp: number;
msgGasLimit: string;
};
export type FeeDataResult = {
type: FeeType;
fee: ethers.BigNumber;
calculatedRate: string;
erc20TokenAddress: string;
feeData: string;
};
export type Bridges = { [chain: string]: Bridge | undefined } | undefined;
export type SygmaContracts = {
[chain: string]: { bridge: Bridge; erc20: Erc20Detailed };
};
export type BridgeEventCallback = (fn: (...params: any) => void) => Bridge;
export type ChainbridgeEventsObject =
| {
[chain: string]: BridgeEventCallback;
}
| undefined;
export type BridgeEvents =
| {
feeHandler: string;
}
| undefined;
export type ConnectionEvents = {
chain1: BridgeEvents;
chain2: BridgeEvents;
};
export type Events =
| {
chain1: BridgeEvents;
chain2: BridgeEvents;
}
| undefined;
export type SygmaProviders = {
[chain: string]: {
provider: ethers.providers.JsonRpcProvider | Provider;
signer: ethers.providers.JsonRpcSigner | Signer;
};
};
export type SygmaErc20Contracts =
| { [chain: string]: Erc20Detailed | ERC721MinterBurnerPauser | undefined }
| undefined;
export type Provider = ethers.providers.Provider | undefined;
export type Signer = ethers.providers.JsonRpcSigner | undefined;
export type ConnectorSigner = Record<'chain1' | 'chain2', Signer> | undefined;
export type ConnectorProvider = Record<'chain1' | 'chain2', Provider> | undefined;