@stableflow/wallet-evm 0.0.0-experimental-5a8afd7389-20260703
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/LICENSE +21 -0
- package/README.md +36 -0
- package/dist/index.d.mts +109 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +1557 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1548 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 StableFlow AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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 };
|