@ember-finance/sdk 2.0.1 → 2.0.3
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/dist/src/abis/EmberETHVault.json +343 -2
- package/dist/src/abis/EmberProtocolConfig.json +61 -2
- package/dist/src/abis/EmberVault.json +343 -2
- package/dist/src/abis/EmberVaultMintBurnOFTAdapter.json +1382 -0
- package/dist/src/abis/index.d.ts +3 -1
- package/dist/src/abis/index.js +3 -1
- package/dist/src/api/v2/models/chain.d.ts +6 -0
- package/dist/src/api/v2/models/evm-contracts.d.ts +9 -0
- package/dist/src/api/v2/models/evm-oftadapter.d.ts +93 -0
- package/dist/src/api/v2/models/evm-oftadapter.js +14 -0
- package/dist/src/api/v2/models/evm-oftpeer.d.ts +48 -0
- package/dist/src/api/v2/models/evm-oftpeer.js +14 -0
- package/dist/src/api/v2/models/evm-protocol-config.d.ts +6 -0
- package/dist/src/api/v2/models/evm-vault.d.ts +24 -0
- package/dist/src/api/v2/models/index.d.ts +2 -0
- package/dist/src/api/v2/models/index.js +2 -0
- package/dist/src/common/constants.d.ts +8 -0
- package/dist/src/common/constants.js +11 -0
- package/dist/src/ember-vaults.d.ts +7 -8
- package/dist/src/ember-vaults.js +2 -12
- package/dist/src/evm-vaults/index.d.ts +12 -0
- package/dist/src/evm-vaults/index.js +18 -0
- package/dist/src/evm-vaults/interfaces/index.d.ts +92 -47
- package/dist/src/evm-vaults/on-chain-calls/admin.d.ts +2 -2
- package/dist/src/evm-vaults/on-chain-calls/onchain-calls.d.ts +3 -3
- package/dist/src/evm-vaults/on-chain-calls/operator.d.ts +2 -2
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.d.ts +22 -3
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.js +49 -0
- package/dist/src/evm-vaults/on-chain-calls/user.d.ts +18 -2
- package/dist/src/evm-vaults/on-chain-calls/user.js +54 -1
- package/dist/src/evm-vaults/on-chain-calls/vault-admin.d.ts +2 -2
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.d.ts +37 -3
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.js +108 -2
- package/dist/src/evm-vaults/utils/deployment-parser.d.ts +14 -8
- package/dist/src/evm-vaults/utils/deployment-parser.js +21 -10
- package/package.json +1 -1
package/dist/src/abis/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import EmberVaultABI from "./EmberVault.json";
|
|
2
2
|
import EmberProtocolConfigABI from "./EmberProtocolConfig.json";
|
|
3
3
|
import ERC20TokenABI from "./ERC20Token.json";
|
|
4
|
+
import EmberVaultOFTAdapterABI from "./EmberVaultMintBurnOFTAdapter.json";
|
|
4
5
|
import { Interface } from "ethers";
|
|
5
6
|
declare const EmberVault: Interface;
|
|
6
7
|
declare const EmberProtocolConfig: Interface;
|
|
7
8
|
declare const ERC20Token: Interface;
|
|
8
9
|
declare const EmberETHVault: Interface;
|
|
9
|
-
|
|
10
|
+
declare const EmberVaultOFTAdapter: Interface;
|
|
11
|
+
export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter };
|
package/dist/src/abis/index.js
CHANGED
|
@@ -2,9 +2,11 @@ import EmberVaultABI from "./EmberVault.json" with { type: "json" };
|
|
|
2
2
|
import EmberProtocolConfigABI from "./EmberProtocolConfig.json" with { type: "json" };
|
|
3
3
|
import ERC20TokenABI from "./ERC20Token.json" with { type: "json" };
|
|
4
4
|
import EmberETHVaultABI from "./EmberETHVault.json" with { type: "json" };
|
|
5
|
+
import EmberVaultOFTAdapterABI from "./EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
|
|
5
6
|
import { Interface } from "ethers";
|
|
6
7
|
const EmberVault = new Interface(EmberVaultABI.abi);
|
|
7
8
|
const EmberProtocolConfig = new Interface(EmberProtocolConfigABI.abi);
|
|
8
9
|
const ERC20Token = new Interface(ERC20TokenABI.abi);
|
|
9
10
|
const EmberETHVault = new Interface(EmberETHVaultABI.abi);
|
|
10
|
-
|
|
11
|
+
const EmberVaultOFTAdapter = new Interface(EmberVaultOFTAdapterABI.abi);
|
|
12
|
+
export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter };
|
|
@@ -57,6 +57,12 @@ export interface Chain {
|
|
|
57
57
|
* @memberof Chain
|
|
58
58
|
*/
|
|
59
59
|
wagmiChainId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The LayerZero chain id of the chain
|
|
62
|
+
* @type {number}
|
|
63
|
+
* @memberof Chain
|
|
64
|
+
*/
|
|
65
|
+
lzChainId?: number;
|
|
60
66
|
}
|
|
61
67
|
export declare const ChainTypeEnum: {
|
|
62
68
|
readonly Evm: "EVM";
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import type { EvmDepositToken } from "./evm-deposit-token.js";
|
|
13
|
+
import type { EvmOFTAdapter } from "./evm-oftadapter.js";
|
|
13
14
|
import type { EvmPriceFeed } from "./evm-price-feed.js";
|
|
14
15
|
import type { EvmProtocolConfig } from "./evm-protocol-config.js";
|
|
15
16
|
import type { EvmReceiptToken } from "./evm-receipt-token.js";
|
|
@@ -58,4 +59,12 @@ export interface EvmContracts {
|
|
|
58
59
|
vaults?: {
|
|
59
60
|
[key: string]: EvmVault;
|
|
60
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Map of OFT adapters by name
|
|
64
|
+
* @type {{ [key: string]: EvmOFTAdapter; }}
|
|
65
|
+
* @memberof EvmContracts
|
|
66
|
+
*/
|
|
67
|
+
oftAdapters?: {
|
|
68
|
+
[key: string]: EvmOFTAdapter;
|
|
69
|
+
};
|
|
61
70
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ember Protocol Vaults API
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 2.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { EvmOFTPeer } from "./evm-oftpeer.js";
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface EvmOFTAdapter
|
|
17
|
+
*/
|
|
18
|
+
export interface EvmOFTAdapter {
|
|
19
|
+
/**
|
|
20
|
+
* The OFT adapter contract address
|
|
21
|
+
* @type {string}
|
|
22
|
+
* @memberof EvmOFTAdapter
|
|
23
|
+
*/
|
|
24
|
+
address?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The contract name (e.g., EmberVaultMintBurnOFTAdapter)
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @memberof EvmOFTAdapter
|
|
29
|
+
*/
|
|
30
|
+
contractName?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The key of the associated vault
|
|
33
|
+
* @type {string}
|
|
34
|
+
* @memberof EvmOFTAdapter
|
|
35
|
+
*/
|
|
36
|
+
vaultKey?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The address of the associated vault
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @memberof EvmOFTAdapter
|
|
41
|
+
*/
|
|
42
|
+
vaultAddress?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The receipt token symbol
|
|
45
|
+
* @type {string}
|
|
46
|
+
* @memberof EvmOFTAdapter
|
|
47
|
+
*/
|
|
48
|
+
receiptTokenSymbol?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The LayerZero endpoint address
|
|
51
|
+
* @type {string}
|
|
52
|
+
* @memberof EvmOFTAdapter
|
|
53
|
+
*/
|
|
54
|
+
lzEndpointAddress?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The delegate address
|
|
57
|
+
* @type {string}
|
|
58
|
+
* @memberof EvmOFTAdapter
|
|
59
|
+
*/
|
|
60
|
+
delegate?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The owner address
|
|
63
|
+
* @type {string}
|
|
64
|
+
* @memberof EvmOFTAdapter
|
|
65
|
+
*/
|
|
66
|
+
owner?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The decimal conversion rate
|
|
69
|
+
* @type {string}
|
|
70
|
+
* @memberof EvmOFTAdapter
|
|
71
|
+
*/
|
|
72
|
+
decimalConversionRate?: string;
|
|
73
|
+
/**
|
|
74
|
+
* The deployment timestamp
|
|
75
|
+
* @type {string}
|
|
76
|
+
* @memberof EvmOFTAdapter
|
|
77
|
+
*/
|
|
78
|
+
deployedAt?: string;
|
|
79
|
+
/**
|
|
80
|
+
* The block number at which the contract was deployed
|
|
81
|
+
* @type {number}
|
|
82
|
+
* @memberof EvmOFTAdapter
|
|
83
|
+
*/
|
|
84
|
+
deploymentBlockNumber?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Map of peers by LayerZero endpoint ID
|
|
87
|
+
* @type {{ [key: string]: EvmOFTPeer; }}
|
|
88
|
+
* @memberof EvmOFTAdapter
|
|
89
|
+
*/
|
|
90
|
+
peers?: {
|
|
91
|
+
[key: string]: EvmOFTPeer;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Ember Protocol Vaults API
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 2.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ember Protocol Vaults API
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 2.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface EvmOFTPeer
|
|
16
|
+
*/
|
|
17
|
+
export interface EvmOFTPeer {
|
|
18
|
+
/**
|
|
19
|
+
* The peer address in bytes32 format
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof EvmOFTPeer
|
|
22
|
+
*/
|
|
23
|
+
peerAddress?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The decoded peer address
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof EvmOFTPeer
|
|
28
|
+
*/
|
|
29
|
+
decodedAddress?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The timestamp when the peer was configured
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof EvmOFTPeer
|
|
34
|
+
*/
|
|
35
|
+
configuredAt?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The transaction hash of the peer configuration
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof EvmOFTPeer
|
|
40
|
+
*/
|
|
41
|
+
txHash?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The block number of the peer configuration
|
|
44
|
+
* @type {number}
|
|
45
|
+
* @memberof EvmOFTPeer
|
|
46
|
+
*/
|
|
47
|
+
blockNumber?: number;
|
|
48
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Ember Protocol Vaults API
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 2.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
@@ -45,4 +45,10 @@ export interface EvmProtocolConfig {
|
|
|
45
45
|
* @memberof EvmProtocolConfig
|
|
46
46
|
*/
|
|
47
47
|
deployedAt?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The block number at which the contract was deployed
|
|
50
|
+
* @type {number}
|
|
51
|
+
* @memberof EvmProtocolConfig
|
|
52
|
+
*/
|
|
53
|
+
deploymentBlockNumber?: number;
|
|
48
54
|
}
|
|
@@ -111,4 +111,28 @@ export interface EvmVault {
|
|
|
111
111
|
* @memberof EvmVault
|
|
112
112
|
*/
|
|
113
113
|
deploymentBlockNumber?: number;
|
|
114
|
+
/**
|
|
115
|
+
* The receipt token symbol
|
|
116
|
+
* @type {string}
|
|
117
|
+
* @memberof EvmVault
|
|
118
|
+
*/
|
|
119
|
+
receiptTokenSymbol?: string;
|
|
120
|
+
/**
|
|
121
|
+
* The collateral token address
|
|
122
|
+
* @type {string}
|
|
123
|
+
* @memberof EvmVault
|
|
124
|
+
*/
|
|
125
|
+
collateralToken?: string;
|
|
126
|
+
/**
|
|
127
|
+
* The bridge adapter contract address
|
|
128
|
+
* @type {string}
|
|
129
|
+
* @memberof EvmVault
|
|
130
|
+
*/
|
|
131
|
+
bridgeAdapter?: string;
|
|
132
|
+
/**
|
|
133
|
+
* The timestamp when the bridge adapter was last updated
|
|
134
|
+
* @type {string}
|
|
135
|
+
* @memberof EvmVault
|
|
136
|
+
*/
|
|
137
|
+
bridgeAdapterUpdatedAt?: string;
|
|
114
138
|
}
|
|
@@ -17,6 +17,8 @@ export * from "./deposit-transaction.js";
|
|
|
17
17
|
export * from "./ember-position.js";
|
|
18
18
|
export * from "./evm-contracts.js";
|
|
19
19
|
export * from "./evm-deposit-token.js";
|
|
20
|
+
export * from "./evm-oftadapter.js";
|
|
21
|
+
export * from "./evm-oftpeer.js";
|
|
20
22
|
export * from "./evm-price-feed.js";
|
|
21
23
|
export * from "./evm-protocol-config.js";
|
|
22
24
|
export * from "./evm-protocol-info.js";
|
|
@@ -17,6 +17,8 @@ export * from "./deposit-transaction.js";
|
|
|
17
17
|
export * from "./ember-position.js";
|
|
18
18
|
export * from "./evm-contracts.js";
|
|
19
19
|
export * from "./evm-deposit-token.js";
|
|
20
|
+
export * from "./evm-oftadapter.js";
|
|
21
|
+
export * from "./evm-oftpeer.js";
|
|
20
22
|
export * from "./evm-price-feed.js";
|
|
21
23
|
export * from "./evm-protocol-config.js";
|
|
22
24
|
export * from "./evm-protocol-info.js";
|
|
@@ -7,7 +7,7 @@ import { OperatorCalls as SuiOperatorCalls } from "./sui-vaults/on-chain-calls/o
|
|
|
7
7
|
import { UserCalls as SuiUserCalls } from "./sui-vaults/on-chain-calls/user.js";
|
|
8
8
|
import { VaultAdminCalls as SuiVaultAdminCalls } from "./sui-vaults/on-chain-calls/vault-admin.js";
|
|
9
9
|
import { SuiDeploymentParser } from "./sui-vaults/utils/deployment-parser.js";
|
|
10
|
-
import {
|
|
10
|
+
import { EvmProtocolInfo } from "./evm-vaults/interfaces/index.js";
|
|
11
11
|
import { EVMTxBuilder } from "./evm-vaults/on-chain-calls/tx-builder.js";
|
|
12
12
|
import { EVMAdminCalls } from "./evm-vaults/on-chain-calls/admin.js";
|
|
13
13
|
import { EVMOperatorCalls } from "./evm-vaults/on-chain-calls/operator.js";
|
|
@@ -17,8 +17,7 @@ import { EVMDeploymentParser } from "./evm-vaults/utils/deployment-parser.js";
|
|
|
17
17
|
import { EVMVaultReader } from "./evm-vaults/on-chain-calls/vault-reader.js";
|
|
18
18
|
import { AccountsApi, VaultsApi } from "./api/index.js";
|
|
19
19
|
import { AccountsApi as AccountsV2Api, VaultsApi as VaultsV2Api } from "./api/v2/index.js";
|
|
20
|
-
|
|
21
|
-
export type ChainType = "sui" | "evm";
|
|
20
|
+
import { ChainType, PlatformEnv } from "./common/constants.js";
|
|
22
21
|
/**
|
|
23
22
|
* SUI-specific initialization options
|
|
24
23
|
*/
|
|
@@ -41,7 +40,7 @@ export interface EvmInitOptions {
|
|
|
41
40
|
signer?: EvmSigner;
|
|
42
41
|
provider?: EvmProvider;
|
|
43
42
|
walletAddress?: string;
|
|
44
|
-
deployment?:
|
|
43
|
+
deployment?: EvmProtocolInfo;
|
|
45
44
|
basePath?: string;
|
|
46
45
|
environment?: PlatformEnv;
|
|
47
46
|
chainIdentifier: string;
|
|
@@ -78,7 +77,7 @@ export interface EvmEmberVaults {
|
|
|
78
77
|
operator: EVMOperatorCalls;
|
|
79
78
|
vaultAdmin: EVMVaultAdminCalls;
|
|
80
79
|
user: EVMUserCalls;
|
|
81
|
-
deployment:
|
|
80
|
+
deployment: EvmProtocolInfo;
|
|
82
81
|
reader: EVMVaultReader;
|
|
83
82
|
}
|
|
84
83
|
/**
|
|
@@ -144,9 +143,9 @@ export declare class EmberVaults {
|
|
|
144
143
|
init(): Promise<void>;
|
|
145
144
|
/**
|
|
146
145
|
* Updates the deployment configuration
|
|
147
|
-
* @param newDeployment The new deployment configuration (ISuiDeployment or
|
|
146
|
+
* @param newDeployment The new deployment configuration (ISuiDeployment or EvmProtocolInfo)
|
|
148
147
|
*/
|
|
149
|
-
updateDeployment(newDeployment: ISuiDeployment |
|
|
148
|
+
updateDeployment(newDeployment: ISuiDeployment | EvmProtocolInfo): void;
|
|
150
149
|
get suiClient(): SuiClient;
|
|
151
150
|
get network(): string;
|
|
152
151
|
get provider(): EvmProvider | undefined;
|
|
@@ -158,7 +157,7 @@ export declare class EmberVaults {
|
|
|
158
157
|
get operator(): SuiOperatorCalls | EVMOperatorCalls;
|
|
159
158
|
get vaultAdmin(): SuiVaultAdminCalls | EVMVaultAdminCalls;
|
|
160
159
|
get user(): SuiUserCalls | EVMUserCalls;
|
|
161
|
-
get deployment(): ISuiDeployment |
|
|
160
|
+
get deployment(): ISuiDeployment | EvmProtocolInfo;
|
|
162
161
|
/**
|
|
163
162
|
* Check if this is a SUI instance
|
|
164
163
|
*/
|
package/dist/src/ember-vaults.js
CHANGED
|
@@ -14,17 +14,7 @@ import { EVMVaultReader } from "./evm-vaults/on-chain-calls/vault-reader.js";
|
|
|
14
14
|
// API imports
|
|
15
15
|
import { AccountsApi, Configuration, VaultsApi } from "./api/index.js";
|
|
16
16
|
import { AccountsApi as AccountsV2Api, Configuration as ConfigurationV2, VaultsApi as VaultsV2Api } from "./api/v2/index.js";
|
|
17
|
-
|
|
18
|
-
prod: {
|
|
19
|
-
apiHost: "https://vaults.api.sui-prod.bluefin.io"
|
|
20
|
-
},
|
|
21
|
-
staging: {
|
|
22
|
-
apiHost: "https://vaults.api.sui-staging.bluefin.io"
|
|
23
|
-
},
|
|
24
|
-
dev: {
|
|
25
|
-
apiHost: "https://vaults.api.sui-dev.bluefin.io"
|
|
26
|
-
}
|
|
27
|
-
};
|
|
17
|
+
import { environmentConfig } from "./common/constants.js";
|
|
28
18
|
/**
|
|
29
19
|
* EmberVaults - Unified interface for both SUI and EVM chains
|
|
30
20
|
*
|
|
@@ -119,7 +109,7 @@ export class EmberVaults {
|
|
|
119
109
|
}
|
|
120
110
|
/**
|
|
121
111
|
* Updates the deployment configuration
|
|
122
|
-
* @param newDeployment The new deployment configuration (ISuiDeployment or
|
|
112
|
+
* @param newDeployment The new deployment configuration (ISuiDeployment or EvmProtocolInfo)
|
|
123
113
|
*/
|
|
124
114
|
updateDeployment(newDeployment) {
|
|
125
115
|
if (this.chainType === "sui") {
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
export * from "./interfaces/index.js";
|
|
2
2
|
export * from "./on-chain-calls/index.js";
|
|
3
3
|
export * from "./utils/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Converts an EVM address to bytes32 format
|
|
6
|
+
* @param address EVM address (with or without 0x prefix)
|
|
7
|
+
* @returns 32-byte hex string
|
|
8
|
+
*/
|
|
9
|
+
export declare function addressToBytes32(address: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a bytes32 value back to an EVM address.
|
|
12
|
+
* @param bytes32 32-byte hex string
|
|
13
|
+
* @returns EVM address (checksummed)
|
|
14
|
+
*/
|
|
15
|
+
export declare function bytes32ToAddress(bytes32: string): string;
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
export * from "./interfaces/index.js";
|
|
2
2
|
export * from "./on-chain-calls/index.js";
|
|
3
3
|
export * from "./utils/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Converts an EVM address to bytes32 format
|
|
6
|
+
* @param address EVM address (with or without 0x prefix)
|
|
7
|
+
* @returns 32-byte hex string
|
|
8
|
+
*/
|
|
9
|
+
export function addressToBytes32(address) {
|
|
10
|
+
const clean = address.toLowerCase().replace("0x", "");
|
|
11
|
+
return "0x" + clean.padStart(64, "0");
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Converts a bytes32 value back to an EVM address.
|
|
15
|
+
* @param bytes32 32-byte hex string
|
|
16
|
+
* @returns EVM address (checksummed)
|
|
17
|
+
*/
|
|
18
|
+
export function bytes32ToAddress(bytes32) {
|
|
19
|
+
const clean = bytes32.toLowerCase().replace("0x", "");
|
|
20
|
+
return "0x" + clean.slice(-40);
|
|
21
|
+
}
|
|
@@ -1,53 +1,81 @@
|
|
|
1
1
|
import { Signer, Provider, TransactionResponse, TransactionReceipt, Log, LogDescription } from "ethers";
|
|
2
|
+
import type { EvmProtocolInfo as ApiEvmProtocolInfo } from "../../api/v2/models/evm-protocol-info.js";
|
|
3
|
+
import { Chain } from "../../api/v2/index.js";
|
|
2
4
|
/**
|
|
3
|
-
*
|
|
5
|
+
* Minimal chain metadata used to map LayerZero chain IDs to Ember chain identifiers.
|
|
4
6
|
*/
|
|
5
|
-
export interface
|
|
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
|
-
|
|
7
|
+
export interface IChainMetadata {
|
|
8
|
+
/** Ember chain identifier (e.g., "base", "arbitrum") */
|
|
9
|
+
identifier: string;
|
|
10
|
+
/** LayerZero chain ID for this chain */
|
|
11
|
+
lzChainId?: number;
|
|
12
|
+
/** Additional API fields from supported chains response */
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Deployment type for SDK internals, based on generated EvmProtocolInfo.
|
|
17
|
+
* Keeps required fields strict for parser usage.
|
|
18
|
+
*/
|
|
19
|
+
export type EvmProtocolInfo = ApiEvmProtocolInfo;
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for an OFT send operation (LayerZero SendParam struct)
|
|
22
|
+
*/
|
|
23
|
+
export interface IOFTSendParam {
|
|
24
|
+
/** LayerZero endpoint ID of the destination chain */
|
|
25
|
+
dstEid: number;
|
|
26
|
+
/** Recipient address on the destination chain in bytes32 format */
|
|
27
|
+
to: string;
|
|
28
|
+
/** Amount to send in local decimals */
|
|
29
|
+
amountLD: bigint;
|
|
30
|
+
/** Minimum amount to receive on destination in local decimals (slippage protection) */
|
|
31
|
+
minAmountLD: bigint;
|
|
32
|
+
/** Extra options for LayerZero (hex string, defaults to "0x") */
|
|
33
|
+
extraOptions?: string;
|
|
34
|
+
/** Compose message for additional execution on destination (hex string, defaults to "0x") */
|
|
35
|
+
composeMsg?: string;
|
|
36
|
+
/** OFT command (hex string, defaults to "0x") */
|
|
37
|
+
oftCmd?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Quoted fee for a bridge send operation
|
|
41
|
+
*/
|
|
42
|
+
export interface IOFTFeeQuote {
|
|
43
|
+
/** Native gas fee required to pay LayerZero (in wei) */
|
|
44
|
+
nativeFee: bigint;
|
|
45
|
+
/** LZ token fee (typically 0 when paying in native token) */
|
|
46
|
+
lzTokenFee: bigint;
|
|
47
|
+
/** Amount that will be deducted from the sender */
|
|
48
|
+
amountSentLD: bigint;
|
|
49
|
+
/** Amount that will be received on the destination chain */
|
|
50
|
+
amountReceivedLD: bigint;
|
|
51
|
+
/** Minimum sendable amount from the OFT limit */
|
|
52
|
+
minAmountLD: bigint;
|
|
53
|
+
/** Maximum sendable amount from the OFT limit */
|
|
54
|
+
maxAmountLD: bigint;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A destination chain supported by an OFT adapter (has a peer configured)
|
|
58
|
+
*/
|
|
59
|
+
export interface IOFTVaultSupportedChain extends Chain {
|
|
60
|
+
/** Resolved OFT adapter contract address from deployment */
|
|
61
|
+
adapterAddress: string;
|
|
62
|
+
/** Input vault identifier used to resolve the adapter */
|
|
63
|
+
vaultId: string;
|
|
64
|
+
/** LayerZero endpoint ID of the destination chain */
|
|
65
|
+
lzEndpointId: number;
|
|
66
|
+
/** Ember API chain identifier (e.g., "base", "arbitrum") */
|
|
67
|
+
chainIdentifier: string | undefined;
|
|
68
|
+
/** Peer OFT adapter address on the destination chain (bytes32) */
|
|
69
|
+
peerAddress: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Messaging fee struct for OFT send (LayerZero MessagingFee)
|
|
73
|
+
*/
|
|
74
|
+
export interface IOFTMessagingFee {
|
|
75
|
+
/** Native fee in wei */
|
|
76
|
+
nativeFee: bigint;
|
|
77
|
+
/** LZ token fee (0 to pay in native token) */
|
|
78
|
+
lzTokenFee: bigint;
|
|
51
79
|
}
|
|
52
80
|
/**
|
|
53
81
|
* Optional parameters for EVM transaction building
|
|
@@ -135,6 +163,23 @@ export interface IUserCallOptions extends IEvmCallOptions {
|
|
|
135
163
|
/** Receiver address for shares/funds. Defaults to the caller's address if not provided */
|
|
136
164
|
receiver?: string;
|
|
137
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Optional parameters for high-level OFT bridge send calls.
|
|
168
|
+
*/
|
|
169
|
+
export interface IBridgeSendOptions extends IEvmCallOptions {
|
|
170
|
+
/** Minimum amount to receive on destination; defaults to amount */
|
|
171
|
+
minAmount?: bigint;
|
|
172
|
+
/** Additional LayerZero options bytes */
|
|
173
|
+
extraOptions?: string;
|
|
174
|
+
/** Optional compose message bytes */
|
|
175
|
+
composeMsg?: string;
|
|
176
|
+
/** Optional OFT command bytes */
|
|
177
|
+
oftCmd?: string;
|
|
178
|
+
/** Whether to pay fees in the LZ token */
|
|
179
|
+
payInLzToken?: boolean;
|
|
180
|
+
/** Refund address for excess fee; defaults to caller wallet */
|
|
181
|
+
refundAddress?: string;
|
|
182
|
+
}
|
|
138
183
|
/**
|
|
139
184
|
* EIP-2612 Permit signature components
|
|
140
185
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signer, Provider } from "ethers";
|
|
2
2
|
import { EVMOnChainCalls } from "./onchain-calls.js";
|
|
3
|
-
import {
|
|
3
|
+
import { EvmProtocolInfo, IEvmCallOptions, EvmOnChainCallResponse } from "../interfaces/index.js";
|
|
4
4
|
import { NumStr } from "../../common/types.js";
|
|
5
5
|
/**
|
|
6
6
|
* Admin Calls for Ember Protocol on EVM
|
|
@@ -32,7 +32,7 @@ import { NumStr } from "../../common/types.js";
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
export declare class EVMAdminCalls extends EVMOnChainCalls {
|
|
35
|
-
constructor(_deployment:
|
|
35
|
+
constructor(_deployment: EvmProtocolInfo, _signer?: Signer, _provider?: Provider, _walletAddress?: string);
|
|
36
36
|
/**
|
|
37
37
|
* Update the admin address of a vault
|
|
38
38
|
* @param vaultAddress The address of the vault
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signer, Provider, Log } from "ethers";
|
|
2
2
|
import { EVMDeploymentParser } from "../utils/deployment-parser.js";
|
|
3
|
-
import { EvmOnChainCallResponse, IEvmCallOptions,
|
|
3
|
+
import { EvmOnChainCallResponse, IEvmCallOptions, EvmProtocolInfo, ITransactionCall, IParsedEvent } from "../interfaces/index.js";
|
|
4
4
|
import { EVMTxBuilder } from "./tx-builder.js";
|
|
5
5
|
/**
|
|
6
6
|
* EVM On-Chain Calls for Ember Protocol
|
|
@@ -33,12 +33,12 @@ export declare class EVMOnChainCalls {
|
|
|
33
33
|
signer?: Signer;
|
|
34
34
|
provider?: Provider;
|
|
35
35
|
walletAddress?: string;
|
|
36
|
-
constructor(_deployment:
|
|
36
|
+
constructor(_deployment: EvmProtocolInfo, _signer?: Signer, _provider?: Provider, _walletAddress?: string);
|
|
37
37
|
/**
|
|
38
38
|
* Updates the deployment configuration
|
|
39
39
|
* @param newDeployment The new deployment configuration
|
|
40
40
|
*/
|
|
41
|
-
updateDeployment(newDeployment:
|
|
41
|
+
updateDeployment(newDeployment: EvmProtocolInfo): void;
|
|
42
42
|
/**
|
|
43
43
|
* Gets the wallet address
|
|
44
44
|
* @returns The wallet address
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signer, Provider } from "ethers";
|
|
2
2
|
import { EVMOnChainCalls } from "./onchain-calls.js";
|
|
3
|
-
import {
|
|
3
|
+
import { EvmProtocolInfo, IEvmCallOptions, EvmOnChainCallResponse } from "../interfaces/index.js";
|
|
4
4
|
import { NumStr } from "../../common/types.js";
|
|
5
5
|
/**
|
|
6
6
|
* Operator Calls for Ember Protocol on EVM
|
|
@@ -34,7 +34,7 @@ import { NumStr } from "../../common/types.js";
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
export declare class EVMOperatorCalls extends EVMOnChainCalls {
|
|
37
|
-
constructor(_deployment:
|
|
37
|
+
constructor(_deployment: EvmProtocolInfo, _signer?: Signer, _provider?: Provider, _walletAddress?: string);
|
|
38
38
|
/**
|
|
39
39
|
* Update the rate of a vault
|
|
40
40
|
* Note: This requires the rate manager role, which may or may not be the operator
|