@stableflow/wallet-evm 3.0.0-beta-02a59f37a0-20260515
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/README.md +36 -0
- package/dist/index.d.mts +109 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +1549 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1540 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @stableflow/wallet-evm
|
|
2
|
+
|
|
3
|
+
EVM wallet adapter for the StableFlow SDK. Implements `WalletConfig` methods used by `BridgeSFA` and `ServiceMap` routes (approve, transfer, sign, quote simulation).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @stableflow/wallet-evm @stableflow/core @stableflow/bridges
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Peer dependencies:**
|
|
12
|
+
|
|
13
|
+
- `@layerzerolabs/lz-v2-utilities` ^3.0.151
|
|
14
|
+
|
|
15
|
+
## When to use
|
|
16
|
+
|
|
17
|
+
Connect any EVM-compatible wallet (MetaMask, WalletConnect via wagmi/ethers, etc.) and pass `wallet.wallet` (`WalletConfig`) into `BridgeSFA.getAllQuote` / `BridgeSFA.send`.
|
|
18
|
+
|
|
19
|
+
For routes that require a separate EVM signer (e.g. permit on another chain), also pass `evmWallet` and `evmAddress` in `GetAllQuoteParams`.
|
|
20
|
+
|
|
21
|
+
## Main exports
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import EVMWallet, { EVMWallet as Named } from '@stableflow/wallet-evm';
|
|
25
|
+
|
|
26
|
+
const adapter = new EVMWallet(/* ethers signer or wagmi client */);
|
|
27
|
+
const walletConfig = adapter.wallet; // WalletConfig
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
See `dist/index.d.ts` after `pnpm build`.
|
|
31
|
+
|
|
32
|
+
## See also
|
|
33
|
+
|
|
34
|
+
- [Developer Guide](../../DEVELOPER_GUIDE.md)
|
|
35
|
+
- [demo-evm example](../../examples/demo-evm/README.md)
|
|
36
|
+
- [@stableflow/bridges](../bridges/README.md)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Service, SendType } from '@stableflow/core';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
|
|
4
|
+
declare class EVMWallet {
|
|
5
|
+
provider: any;
|
|
6
|
+
signer: any;
|
|
7
|
+
private csl;
|
|
8
|
+
constructor(_provider: any, _signer?: any);
|
|
9
|
+
transfer(data: {
|
|
10
|
+
originAsset: string;
|
|
11
|
+
depositAddress: string;
|
|
12
|
+
amount: string;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
getBalance(token: any, account: string, options?: {
|
|
15
|
+
isCatchError?: boolean;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
balanceOf(token: any, account: string, options?: {
|
|
18
|
+
isCatchError?: boolean;
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Estimate gas limit for transfer transaction
|
|
22
|
+
* @param data Transfer data
|
|
23
|
+
* @returns Gas limit estimate, gas price, and estimated gas cost
|
|
24
|
+
*/
|
|
25
|
+
estimateTransferGas(data: {
|
|
26
|
+
fromToken: any;
|
|
27
|
+
depositAddress: string;
|
|
28
|
+
amount: string;
|
|
29
|
+
account: string;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
gasLimit: bigint;
|
|
32
|
+
gasPrice: bigint;
|
|
33
|
+
estimateGas: bigint;
|
|
34
|
+
}>;
|
|
35
|
+
getContract(params: any): ethers.Contract;
|
|
36
|
+
allowance(params: any): Promise<{
|
|
37
|
+
contract: ethers.Contract;
|
|
38
|
+
allowance: string;
|
|
39
|
+
needApprove: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
approve(params: any): Promise<any>;
|
|
42
|
+
getEstimateGas(params: any): Promise<{
|
|
43
|
+
gasPrice: any;
|
|
44
|
+
usd: string;
|
|
45
|
+
wei: bigint;
|
|
46
|
+
amount: string;
|
|
47
|
+
}>;
|
|
48
|
+
estimateTransaction(params: any): Promise<{
|
|
49
|
+
estimateSourceGasLimit: bigint;
|
|
50
|
+
estimateSourceGas: bigint;
|
|
51
|
+
estimateSourceGasUsd: string;
|
|
52
|
+
}>;
|
|
53
|
+
quoteOFT(params: any): Promise<any>;
|
|
54
|
+
sendTransaction(params: any): Promise<any>;
|
|
55
|
+
/**
|
|
56
|
+
* Unified quote method that routes to specific quote methods based on type
|
|
57
|
+
* @param type Service type from Service
|
|
58
|
+
* @param params Parameters for the quote
|
|
59
|
+
*/
|
|
60
|
+
quote(type: Service, params: any): Promise<any>;
|
|
61
|
+
/**
|
|
62
|
+
* Unified send method that routes to specific send methods based on type
|
|
63
|
+
* @param type Send type from SendType enum
|
|
64
|
+
* @param params Parameters for the send transaction
|
|
65
|
+
*/
|
|
66
|
+
send(type: SendType, params: any): Promise<any>;
|
|
67
|
+
quoteCCTP(params: any): Promise<any>;
|
|
68
|
+
quoteOneClickProxy(params: any): Promise<any>;
|
|
69
|
+
quoteNative(params: any): Promise<any>;
|
|
70
|
+
quoteFraxZero(params: any): Promise<any>;
|
|
71
|
+
preivewRedeemFrxUSD(params: any): Promise<{
|
|
72
|
+
maxUsdc: any;
|
|
73
|
+
maxRwa: any;
|
|
74
|
+
amountWeiBigInt: bigint;
|
|
75
|
+
totalAssetsOut: bigint;
|
|
76
|
+
isInsufficientLiquidity: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
previewMintFrxUSD(params: any): Promise<{
|
|
79
|
+
maxUsdc: any;
|
|
80
|
+
amountWeiBigInt: bigint;
|
|
81
|
+
totalMax: any;
|
|
82
|
+
totalAssetsOut: any;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Redeem frxUSD to USDC via USDC and/or RWA custodian contracts.
|
|
86
|
+
* Uses mdwrComboView to get max redeemable liquidity and splits redemption across USDC/RWA paths.
|
|
87
|
+
* Uses previewRedeem to get accurate output amount (USDC).
|
|
88
|
+
*/
|
|
89
|
+
redeemFrxUSD(params: any): Promise<any>;
|
|
90
|
+
/**
|
|
91
|
+
* Mint frxUSD by depositing USDC into the custodian contract.
|
|
92
|
+
* Calls deposit(assetsIn, receiver) on usdcCustodianAddress.
|
|
93
|
+
* assetsIn = USDC amount (6 decimals), sharesOut = frxUSD amount (18 decimals).
|
|
94
|
+
*/
|
|
95
|
+
mintFrxUSD(params: any): Promise<any>;
|
|
96
|
+
mintAndSendFrxUSD(params: any): Promise<any>;
|
|
97
|
+
retryLayerzeroLzComponse(params: any): Promise<any>;
|
|
98
|
+
signTypedData(params: any): Promise<{
|
|
99
|
+
owner: any;
|
|
100
|
+
value: any;
|
|
101
|
+
deadline: number;
|
|
102
|
+
nonce: number;
|
|
103
|
+
v: 27 | 28;
|
|
104
|
+
r: string;
|
|
105
|
+
s: string;
|
|
106
|
+
}>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { EVMWallet, EVMWallet as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Service, SendType } from '@stableflow/core';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
|
|
4
|
+
declare class EVMWallet {
|
|
5
|
+
provider: any;
|
|
6
|
+
signer: any;
|
|
7
|
+
private csl;
|
|
8
|
+
constructor(_provider: any, _signer?: any);
|
|
9
|
+
transfer(data: {
|
|
10
|
+
originAsset: string;
|
|
11
|
+
depositAddress: string;
|
|
12
|
+
amount: string;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
getBalance(token: any, account: string, options?: {
|
|
15
|
+
isCatchError?: boolean;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
balanceOf(token: any, account: string, options?: {
|
|
18
|
+
isCatchError?: boolean;
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Estimate gas limit for transfer transaction
|
|
22
|
+
* @param data Transfer data
|
|
23
|
+
* @returns Gas limit estimate, gas price, and estimated gas cost
|
|
24
|
+
*/
|
|
25
|
+
estimateTransferGas(data: {
|
|
26
|
+
fromToken: any;
|
|
27
|
+
depositAddress: string;
|
|
28
|
+
amount: string;
|
|
29
|
+
account: string;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
gasLimit: bigint;
|
|
32
|
+
gasPrice: bigint;
|
|
33
|
+
estimateGas: bigint;
|
|
34
|
+
}>;
|
|
35
|
+
getContract(params: any): ethers.Contract;
|
|
36
|
+
allowance(params: any): Promise<{
|
|
37
|
+
contract: ethers.Contract;
|
|
38
|
+
allowance: string;
|
|
39
|
+
needApprove: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
approve(params: any): Promise<any>;
|
|
42
|
+
getEstimateGas(params: any): Promise<{
|
|
43
|
+
gasPrice: any;
|
|
44
|
+
usd: string;
|
|
45
|
+
wei: bigint;
|
|
46
|
+
amount: string;
|
|
47
|
+
}>;
|
|
48
|
+
estimateTransaction(params: any): Promise<{
|
|
49
|
+
estimateSourceGasLimit: bigint;
|
|
50
|
+
estimateSourceGas: bigint;
|
|
51
|
+
estimateSourceGasUsd: string;
|
|
52
|
+
}>;
|
|
53
|
+
quoteOFT(params: any): Promise<any>;
|
|
54
|
+
sendTransaction(params: any): Promise<any>;
|
|
55
|
+
/**
|
|
56
|
+
* Unified quote method that routes to specific quote methods based on type
|
|
57
|
+
* @param type Service type from Service
|
|
58
|
+
* @param params Parameters for the quote
|
|
59
|
+
*/
|
|
60
|
+
quote(type: Service, params: any): Promise<any>;
|
|
61
|
+
/**
|
|
62
|
+
* Unified send method that routes to specific send methods based on type
|
|
63
|
+
* @param type Send type from SendType enum
|
|
64
|
+
* @param params Parameters for the send transaction
|
|
65
|
+
*/
|
|
66
|
+
send(type: SendType, params: any): Promise<any>;
|
|
67
|
+
quoteCCTP(params: any): Promise<any>;
|
|
68
|
+
quoteOneClickProxy(params: any): Promise<any>;
|
|
69
|
+
quoteNative(params: any): Promise<any>;
|
|
70
|
+
quoteFraxZero(params: any): Promise<any>;
|
|
71
|
+
preivewRedeemFrxUSD(params: any): Promise<{
|
|
72
|
+
maxUsdc: any;
|
|
73
|
+
maxRwa: any;
|
|
74
|
+
amountWeiBigInt: bigint;
|
|
75
|
+
totalAssetsOut: bigint;
|
|
76
|
+
isInsufficientLiquidity: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
previewMintFrxUSD(params: any): Promise<{
|
|
79
|
+
maxUsdc: any;
|
|
80
|
+
amountWeiBigInt: bigint;
|
|
81
|
+
totalMax: any;
|
|
82
|
+
totalAssetsOut: any;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Redeem frxUSD to USDC via USDC and/or RWA custodian contracts.
|
|
86
|
+
* Uses mdwrComboView to get max redeemable liquidity and splits redemption across USDC/RWA paths.
|
|
87
|
+
* Uses previewRedeem to get accurate output amount (USDC).
|
|
88
|
+
*/
|
|
89
|
+
redeemFrxUSD(params: any): Promise<any>;
|
|
90
|
+
/**
|
|
91
|
+
* Mint frxUSD by depositing USDC into the custodian contract.
|
|
92
|
+
* Calls deposit(assetsIn, receiver) on usdcCustodianAddress.
|
|
93
|
+
* assetsIn = USDC amount (6 decimals), sharesOut = frxUSD amount (18 decimals).
|
|
94
|
+
*/
|
|
95
|
+
mintFrxUSD(params: any): Promise<any>;
|
|
96
|
+
mintAndSendFrxUSD(params: any): Promise<any>;
|
|
97
|
+
retryLayerzeroLzComponse(params: any): Promise<any>;
|
|
98
|
+
signTypedData(params: any): Promise<{
|
|
99
|
+
owner: any;
|
|
100
|
+
value: any;
|
|
101
|
+
deadline: number;
|
|
102
|
+
nonce: number;
|
|
103
|
+
v: 27 | 28;
|
|
104
|
+
r: string;
|
|
105
|
+
s: string;
|
|
106
|
+
}>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { EVMWallet, EVMWallet as default };
|