@nerochain/mpc-sdk 0.1.0
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 +91 -0
- package/dist/aa.d.mts +185 -0
- package/dist/aa.d.ts +185 -0
- package/dist/aa.js +520 -0
- package/dist/aa.js.map +1 -0
- package/dist/aa.mjs +511 -0
- package/dist/aa.mjs.map +1 -0
- package/dist/chain-manager-C3eHsVt9.d.mts +98 -0
- package/dist/chain-manager-C3eHsVt9.d.ts +98 -0
- package/dist/chains.d.mts +17 -0
- package/dist/chains.d.ts +17 -0
- package/dist/chains.js +331 -0
- package/dist/chains.js.map +1 -0
- package/dist/chains.mjs +315 -0
- package/dist/chains.mjs.map +1 -0
- package/dist/index.d.mts +656 -0
- package/dist/index.d.ts +656 -0
- package/dist/index.js +6627 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6502 -0
- package/dist/index.mjs.map +1 -0
- package/dist/modal.d.mts +68 -0
- package/dist/modal.d.ts +68 -0
- package/dist/modal.js +4867 -0
- package/dist/modal.js.map +1 -0
- package/dist/modal.mjs +4850 -0
- package/dist/modal.mjs.map +1 -0
- package/dist/nero-sdk-Cm8gzHZJ.d.mts +684 -0
- package/dist/nero-sdk-IhuTBrXZ.d.ts +684 -0
- package/dist/no-modal.d.mts +56 -0
- package/dist/no-modal.d.ts +56 -0
- package/dist/no-modal.js +4060 -0
- package/dist/no-modal.js.map +1 -0
- package/dist/no-modal.mjs +4041 -0
- package/dist/no-modal.mjs.map +1 -0
- package/dist/react.d.mts +28 -0
- package/dist/react.d.ts +28 -0
- package/dist/react.js +4033 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +4016 -0
- package/dist/react.mjs.map +1 -0
- package/dist/useNeroWallet-PZh940vV.d.ts +164 -0
- package/dist/useNeroWallet-awIYqM6e.d.mts +164 -0
- package/package.json +126 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 NERO Network
|
|
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,91 @@
|
|
|
1
|
+
# @nerochain/mpc-sdk
|
|
2
|
+
|
|
3
|
+
Browser-based threshold signature client for self-custodial wallets. Uses MPC-TSS (Multi-Party Computation Threshold Signature Schemes) to generate and manage Ethereum wallets from social logins.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @nerochain/mpc-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { NeroMpcSDK } from "@nerochain/mpc-sdk";
|
|
15
|
+
|
|
16
|
+
const sdk = new NeroMpcSDK({
|
|
17
|
+
backendUrl: "https://your-api.example.com",
|
|
18
|
+
chainId: 689, // NERO Testnet
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
await sdk.init();
|
|
22
|
+
await sdk.connect("google");
|
|
23
|
+
|
|
24
|
+
const address = await sdk.getAccounts();
|
|
25
|
+
const signature = await sdk.signMessage("Hello NERO");
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## React Integration
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { NeroMpcAuthProvider, useNeroConnect, useNeroUser } from "@nerochain/mpc-sdk/react";
|
|
32
|
+
|
|
33
|
+
function App() {
|
|
34
|
+
return (
|
|
35
|
+
<NeroMpcAuthProvider config={{ backendUrl: "https://your-api.example.com" }}>
|
|
36
|
+
<Wallet />
|
|
37
|
+
</NeroMpcAuthProvider>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function Wallet() {
|
|
42
|
+
const { connect, isLoading } = useNeroConnect();
|
|
43
|
+
const { user } = useNeroUser();
|
|
44
|
+
|
|
45
|
+
return user ? (
|
|
46
|
+
<p>Connected: {user.walletAddress}</p>
|
|
47
|
+
) : (
|
|
48
|
+
<button onClick={() => connect("google")} disabled={isLoading}>
|
|
49
|
+
Login with Google
|
|
50
|
+
</button>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Package Exports
|
|
56
|
+
|
|
57
|
+
| Export | Import Path | Description |
|
|
58
|
+
|--------|------------|-------------|
|
|
59
|
+
| Core SDK | `@nerochain/mpc-sdk` | Main SDK class, wallet operations, transport |
|
|
60
|
+
| React | `@nerochain/mpc-sdk/react` | Provider, hooks, theme context |
|
|
61
|
+
| Modal | `@nerochain/mpc-sdk/modal` | Pre-built login modal UI |
|
|
62
|
+
| No Modal | `@nerochain/mpc-sdk/no-modal` | Headless SDK for custom UI |
|
|
63
|
+
| Chains | `@nerochain/mpc-sdk/chains` | Chain configurations and manager |
|
|
64
|
+
| Account Abstraction | `@nerochain/mpc-sdk/aa` | ERC-4337 smart account support |
|
|
65
|
+
|
|
66
|
+
## Features
|
|
67
|
+
|
|
68
|
+
- **Social Login** - Google, GitHub, Apple, and more via OAuth
|
|
69
|
+
- **MPC-TSS** - Threshold signatures with 2-of-3 key shares
|
|
70
|
+
- **DKLS Protocol** - True threshold ECDSA (key never reconstructed on server)
|
|
71
|
+
- **ERC-4337** - Smart account support with bundler and paymaster
|
|
72
|
+
- **Multi-Chain** - NERO Chain, Ethereum, Polygon, Arbitrum, Base
|
|
73
|
+
- **React Hooks** - `useNeroConnect`, `useNeroUser`, `useNeroWallet`, and more
|
|
74
|
+
- **External Wallets** - WalletConnect, MetaMask SDK, Coinbase Wallet
|
|
75
|
+
- **Theming** - Full whitelabel support with light/dark modes
|
|
76
|
+
|
|
77
|
+
## Peer Dependencies
|
|
78
|
+
|
|
79
|
+
Required:
|
|
80
|
+
- `@noble/curves` ^1.4.0
|
|
81
|
+
- `@noble/hashes` ^1.4.0
|
|
82
|
+
|
|
83
|
+
Optional (install based on features you use):
|
|
84
|
+
- `react` ^18.0.0 || ^19.0.0 (for React hooks)
|
|
85
|
+
- `@walletconnect/ethereum-provider` ^2.0.0 (for WalletConnect)
|
|
86
|
+
- `@metamask/sdk` ^0.20.0 (for MetaMask)
|
|
87
|
+
- `@coinbase/wallet-sdk` ^4.0.0 (for Coinbase Wallet)
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
package/dist/aa.d.mts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { R as RpcConnection } from './chain-manager-C3eHsVt9.mjs';
|
|
2
|
+
|
|
3
|
+
interface UserOperation {
|
|
4
|
+
sender: string;
|
|
5
|
+
nonce: bigint;
|
|
6
|
+
initCode: string;
|
|
7
|
+
callData: string;
|
|
8
|
+
callGasLimit: bigint;
|
|
9
|
+
verificationGasLimit: bigint;
|
|
10
|
+
preVerificationGas: bigint;
|
|
11
|
+
maxFeePerGas: bigint;
|
|
12
|
+
maxPriorityFeePerGas: bigint;
|
|
13
|
+
paymasterAndData: string;
|
|
14
|
+
signature: string;
|
|
15
|
+
}
|
|
16
|
+
interface UserOperationHex {
|
|
17
|
+
sender: string;
|
|
18
|
+
nonce: string;
|
|
19
|
+
initCode: string;
|
|
20
|
+
callData: string;
|
|
21
|
+
callGasLimit: string;
|
|
22
|
+
verificationGasLimit: string;
|
|
23
|
+
preVerificationGas: string;
|
|
24
|
+
maxFeePerGas: string;
|
|
25
|
+
maxPriorityFeePerGas: string;
|
|
26
|
+
paymasterAndData: string;
|
|
27
|
+
signature: string;
|
|
28
|
+
}
|
|
29
|
+
interface GasEstimate {
|
|
30
|
+
preVerificationGas: bigint;
|
|
31
|
+
verificationGasLimit: bigint;
|
|
32
|
+
callGasLimit: bigint;
|
|
33
|
+
}
|
|
34
|
+
interface UserOperationReceipt {
|
|
35
|
+
userOpHash: string;
|
|
36
|
+
entryPoint: string;
|
|
37
|
+
sender: string;
|
|
38
|
+
nonce: string;
|
|
39
|
+
paymaster: string;
|
|
40
|
+
actualGasCost: string;
|
|
41
|
+
actualGasUsed: string;
|
|
42
|
+
success: boolean;
|
|
43
|
+
logs: Array<{
|
|
44
|
+
address: string;
|
|
45
|
+
topics: string[];
|
|
46
|
+
data: string;
|
|
47
|
+
}>;
|
|
48
|
+
receipt: {
|
|
49
|
+
transactionHash: string;
|
|
50
|
+
transactionIndex: string;
|
|
51
|
+
blockHash: string;
|
|
52
|
+
blockNumber: string;
|
|
53
|
+
from: string;
|
|
54
|
+
to: string;
|
|
55
|
+
gasUsed: string;
|
|
56
|
+
status: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
interface PaymasterResult {
|
|
60
|
+
paymasterAndData: string;
|
|
61
|
+
preVerificationGas?: bigint;
|
|
62
|
+
verificationGasLimit?: bigint;
|
|
63
|
+
callGasLimit?: bigint;
|
|
64
|
+
}
|
|
65
|
+
interface PaymasterContext {
|
|
66
|
+
mode?: "free" | "sponsored" | "erc20";
|
|
67
|
+
token?: string;
|
|
68
|
+
sponsorId?: string;
|
|
69
|
+
}
|
|
70
|
+
interface SimpleAccountFactoryData {
|
|
71
|
+
factoryAddress: string;
|
|
72
|
+
ownerAddress: string;
|
|
73
|
+
salt: bigint;
|
|
74
|
+
}
|
|
75
|
+
declare function userOpToHex(userOp: UserOperation): UserOperationHex;
|
|
76
|
+
declare function userOpFromHex(userOpHex: UserOperationHex): UserOperation;
|
|
77
|
+
|
|
78
|
+
interface BundlerClientConfig {
|
|
79
|
+
bundlerUrl: string;
|
|
80
|
+
entryPointAddress: string;
|
|
81
|
+
chainId: number;
|
|
82
|
+
}
|
|
83
|
+
declare class BundlerClient {
|
|
84
|
+
private bundlerUrl;
|
|
85
|
+
private entryPointAddress;
|
|
86
|
+
private requestId;
|
|
87
|
+
constructor(config: BundlerClientConfig);
|
|
88
|
+
sendUserOperation(userOp: UserOperation): Promise<string>;
|
|
89
|
+
estimateUserOperationGas(userOp: Partial<UserOperation>): Promise<GasEstimate>;
|
|
90
|
+
getUserOperationByHash(hash: string): Promise<UserOperationReceipt | null>;
|
|
91
|
+
getUserOperationReceipt(hash: string): Promise<UserOperationReceipt | null>;
|
|
92
|
+
getSupportedEntryPoints(): Promise<string[]>;
|
|
93
|
+
getChainId(): Promise<number>;
|
|
94
|
+
waitForUserOperationReceipt(hash: string, timeout?: number, interval?: number): Promise<UserOperationReceipt>;
|
|
95
|
+
private call;
|
|
96
|
+
}
|
|
97
|
+
declare function createBundlerClient(config: BundlerClientConfig): BundlerClient;
|
|
98
|
+
|
|
99
|
+
interface PaymasterClientConfig {
|
|
100
|
+
paymasterUrl: string;
|
|
101
|
+
entryPointAddress: string;
|
|
102
|
+
chainId: number;
|
|
103
|
+
}
|
|
104
|
+
declare class PaymasterClient {
|
|
105
|
+
private paymasterUrl;
|
|
106
|
+
private entryPointAddress;
|
|
107
|
+
private chainId;
|
|
108
|
+
private requestId;
|
|
109
|
+
constructor(config: PaymasterClientConfig);
|
|
110
|
+
getPaymasterData(userOp: Partial<UserOperation>, context?: PaymasterContext): Promise<PaymasterResult>;
|
|
111
|
+
validatePaymasterUserOp(userOp: UserOperation): Promise<{
|
|
112
|
+
valid: boolean;
|
|
113
|
+
validAfter?: bigint;
|
|
114
|
+
validUntil?: bigint;
|
|
115
|
+
}>;
|
|
116
|
+
getSupportedTokens(): Promise<Array<{
|
|
117
|
+
address: string;
|
|
118
|
+
symbol: string;
|
|
119
|
+
decimals: number;
|
|
120
|
+
}>>;
|
|
121
|
+
getTokenPaymasterData(userOp: Partial<UserOperation>, tokenAddress: string): Promise<PaymasterResult>;
|
|
122
|
+
private partialUserOpToHex;
|
|
123
|
+
private call;
|
|
124
|
+
}
|
|
125
|
+
declare function createPaymasterClient(config: PaymasterClientConfig): PaymasterClient;
|
|
126
|
+
|
|
127
|
+
interface SimpleAccountConfig {
|
|
128
|
+
ownerAddress: string;
|
|
129
|
+
factoryAddress: string;
|
|
130
|
+
entryPointAddress: string;
|
|
131
|
+
bundlerUrl: string;
|
|
132
|
+
paymasterUrl?: string;
|
|
133
|
+
chainId: number;
|
|
134
|
+
salt?: bigint;
|
|
135
|
+
rpcConnection: RpcConnection;
|
|
136
|
+
}
|
|
137
|
+
interface TransactionRequest {
|
|
138
|
+
to: string;
|
|
139
|
+
value?: bigint;
|
|
140
|
+
data?: string;
|
|
141
|
+
}
|
|
142
|
+
declare class SimpleAccount {
|
|
143
|
+
private ownerAddress;
|
|
144
|
+
private factoryAddress;
|
|
145
|
+
private entryPointAddress;
|
|
146
|
+
private salt;
|
|
147
|
+
private bundlerClient;
|
|
148
|
+
private paymasterClient;
|
|
149
|
+
private chainId;
|
|
150
|
+
private rpcConnection;
|
|
151
|
+
private _accountAddress;
|
|
152
|
+
private _isDeployed;
|
|
153
|
+
private _cachedNonce;
|
|
154
|
+
constructor(config: SimpleAccountConfig);
|
|
155
|
+
/**
|
|
156
|
+
* @deprecated Use getAccountAddress() instead. This sync getter is removed
|
|
157
|
+
* because address derivation now requires an RPC call to the factory.
|
|
158
|
+
*/
|
|
159
|
+
get accountAddress(): string;
|
|
160
|
+
getAccountAddress(): Promise<string>;
|
|
161
|
+
isDeployed(): Promise<boolean>;
|
|
162
|
+
invalidateDeploymentCache(): void;
|
|
163
|
+
buildUserOperation(transactions: TransactionRequest | TransactionRequest[], options?: {
|
|
164
|
+
usePaymaster?: boolean;
|
|
165
|
+
paymasterContext?: PaymasterContext;
|
|
166
|
+
}): Promise<UserOperation>;
|
|
167
|
+
computeUserOpHash(userOp: UserOperation): string;
|
|
168
|
+
sendUserOperation(userOp: UserOperation): Promise<{
|
|
169
|
+
userOpHash: string;
|
|
170
|
+
wait: () => Promise<void>;
|
|
171
|
+
}>;
|
|
172
|
+
private fetchAccountAddressFromFactory;
|
|
173
|
+
private getInitCode;
|
|
174
|
+
private encodeExecute;
|
|
175
|
+
private packUserOp;
|
|
176
|
+
private getDummySignature;
|
|
177
|
+
private getNonce;
|
|
178
|
+
invalidateNonceCache(): void;
|
|
179
|
+
private estimateGas;
|
|
180
|
+
private getFeeData;
|
|
181
|
+
private getAccountCode;
|
|
182
|
+
}
|
|
183
|
+
declare function createSimpleAccount(config: SimpleAccountConfig): SimpleAccount;
|
|
184
|
+
|
|
185
|
+
export { BundlerClient, type BundlerClientConfig, type GasEstimate, PaymasterClient, type PaymasterClientConfig, type PaymasterContext, type PaymasterResult, SimpleAccount, type SimpleAccountConfig, type SimpleAccountFactoryData, type TransactionRequest, type UserOperation, type UserOperationHex, type UserOperationReceipt, createBundlerClient, createPaymasterClient, createSimpleAccount, userOpFromHex, userOpToHex };
|
package/dist/aa.d.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { R as RpcConnection } from './chain-manager-C3eHsVt9.js';
|
|
2
|
+
|
|
3
|
+
interface UserOperation {
|
|
4
|
+
sender: string;
|
|
5
|
+
nonce: bigint;
|
|
6
|
+
initCode: string;
|
|
7
|
+
callData: string;
|
|
8
|
+
callGasLimit: bigint;
|
|
9
|
+
verificationGasLimit: bigint;
|
|
10
|
+
preVerificationGas: bigint;
|
|
11
|
+
maxFeePerGas: bigint;
|
|
12
|
+
maxPriorityFeePerGas: bigint;
|
|
13
|
+
paymasterAndData: string;
|
|
14
|
+
signature: string;
|
|
15
|
+
}
|
|
16
|
+
interface UserOperationHex {
|
|
17
|
+
sender: string;
|
|
18
|
+
nonce: string;
|
|
19
|
+
initCode: string;
|
|
20
|
+
callData: string;
|
|
21
|
+
callGasLimit: string;
|
|
22
|
+
verificationGasLimit: string;
|
|
23
|
+
preVerificationGas: string;
|
|
24
|
+
maxFeePerGas: string;
|
|
25
|
+
maxPriorityFeePerGas: string;
|
|
26
|
+
paymasterAndData: string;
|
|
27
|
+
signature: string;
|
|
28
|
+
}
|
|
29
|
+
interface GasEstimate {
|
|
30
|
+
preVerificationGas: bigint;
|
|
31
|
+
verificationGasLimit: bigint;
|
|
32
|
+
callGasLimit: bigint;
|
|
33
|
+
}
|
|
34
|
+
interface UserOperationReceipt {
|
|
35
|
+
userOpHash: string;
|
|
36
|
+
entryPoint: string;
|
|
37
|
+
sender: string;
|
|
38
|
+
nonce: string;
|
|
39
|
+
paymaster: string;
|
|
40
|
+
actualGasCost: string;
|
|
41
|
+
actualGasUsed: string;
|
|
42
|
+
success: boolean;
|
|
43
|
+
logs: Array<{
|
|
44
|
+
address: string;
|
|
45
|
+
topics: string[];
|
|
46
|
+
data: string;
|
|
47
|
+
}>;
|
|
48
|
+
receipt: {
|
|
49
|
+
transactionHash: string;
|
|
50
|
+
transactionIndex: string;
|
|
51
|
+
blockHash: string;
|
|
52
|
+
blockNumber: string;
|
|
53
|
+
from: string;
|
|
54
|
+
to: string;
|
|
55
|
+
gasUsed: string;
|
|
56
|
+
status: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
interface PaymasterResult {
|
|
60
|
+
paymasterAndData: string;
|
|
61
|
+
preVerificationGas?: bigint;
|
|
62
|
+
verificationGasLimit?: bigint;
|
|
63
|
+
callGasLimit?: bigint;
|
|
64
|
+
}
|
|
65
|
+
interface PaymasterContext {
|
|
66
|
+
mode?: "free" | "sponsored" | "erc20";
|
|
67
|
+
token?: string;
|
|
68
|
+
sponsorId?: string;
|
|
69
|
+
}
|
|
70
|
+
interface SimpleAccountFactoryData {
|
|
71
|
+
factoryAddress: string;
|
|
72
|
+
ownerAddress: string;
|
|
73
|
+
salt: bigint;
|
|
74
|
+
}
|
|
75
|
+
declare function userOpToHex(userOp: UserOperation): UserOperationHex;
|
|
76
|
+
declare function userOpFromHex(userOpHex: UserOperationHex): UserOperation;
|
|
77
|
+
|
|
78
|
+
interface BundlerClientConfig {
|
|
79
|
+
bundlerUrl: string;
|
|
80
|
+
entryPointAddress: string;
|
|
81
|
+
chainId: number;
|
|
82
|
+
}
|
|
83
|
+
declare class BundlerClient {
|
|
84
|
+
private bundlerUrl;
|
|
85
|
+
private entryPointAddress;
|
|
86
|
+
private requestId;
|
|
87
|
+
constructor(config: BundlerClientConfig);
|
|
88
|
+
sendUserOperation(userOp: UserOperation): Promise<string>;
|
|
89
|
+
estimateUserOperationGas(userOp: Partial<UserOperation>): Promise<GasEstimate>;
|
|
90
|
+
getUserOperationByHash(hash: string): Promise<UserOperationReceipt | null>;
|
|
91
|
+
getUserOperationReceipt(hash: string): Promise<UserOperationReceipt | null>;
|
|
92
|
+
getSupportedEntryPoints(): Promise<string[]>;
|
|
93
|
+
getChainId(): Promise<number>;
|
|
94
|
+
waitForUserOperationReceipt(hash: string, timeout?: number, interval?: number): Promise<UserOperationReceipt>;
|
|
95
|
+
private call;
|
|
96
|
+
}
|
|
97
|
+
declare function createBundlerClient(config: BundlerClientConfig): BundlerClient;
|
|
98
|
+
|
|
99
|
+
interface PaymasterClientConfig {
|
|
100
|
+
paymasterUrl: string;
|
|
101
|
+
entryPointAddress: string;
|
|
102
|
+
chainId: number;
|
|
103
|
+
}
|
|
104
|
+
declare class PaymasterClient {
|
|
105
|
+
private paymasterUrl;
|
|
106
|
+
private entryPointAddress;
|
|
107
|
+
private chainId;
|
|
108
|
+
private requestId;
|
|
109
|
+
constructor(config: PaymasterClientConfig);
|
|
110
|
+
getPaymasterData(userOp: Partial<UserOperation>, context?: PaymasterContext): Promise<PaymasterResult>;
|
|
111
|
+
validatePaymasterUserOp(userOp: UserOperation): Promise<{
|
|
112
|
+
valid: boolean;
|
|
113
|
+
validAfter?: bigint;
|
|
114
|
+
validUntil?: bigint;
|
|
115
|
+
}>;
|
|
116
|
+
getSupportedTokens(): Promise<Array<{
|
|
117
|
+
address: string;
|
|
118
|
+
symbol: string;
|
|
119
|
+
decimals: number;
|
|
120
|
+
}>>;
|
|
121
|
+
getTokenPaymasterData(userOp: Partial<UserOperation>, tokenAddress: string): Promise<PaymasterResult>;
|
|
122
|
+
private partialUserOpToHex;
|
|
123
|
+
private call;
|
|
124
|
+
}
|
|
125
|
+
declare function createPaymasterClient(config: PaymasterClientConfig): PaymasterClient;
|
|
126
|
+
|
|
127
|
+
interface SimpleAccountConfig {
|
|
128
|
+
ownerAddress: string;
|
|
129
|
+
factoryAddress: string;
|
|
130
|
+
entryPointAddress: string;
|
|
131
|
+
bundlerUrl: string;
|
|
132
|
+
paymasterUrl?: string;
|
|
133
|
+
chainId: number;
|
|
134
|
+
salt?: bigint;
|
|
135
|
+
rpcConnection: RpcConnection;
|
|
136
|
+
}
|
|
137
|
+
interface TransactionRequest {
|
|
138
|
+
to: string;
|
|
139
|
+
value?: bigint;
|
|
140
|
+
data?: string;
|
|
141
|
+
}
|
|
142
|
+
declare class SimpleAccount {
|
|
143
|
+
private ownerAddress;
|
|
144
|
+
private factoryAddress;
|
|
145
|
+
private entryPointAddress;
|
|
146
|
+
private salt;
|
|
147
|
+
private bundlerClient;
|
|
148
|
+
private paymasterClient;
|
|
149
|
+
private chainId;
|
|
150
|
+
private rpcConnection;
|
|
151
|
+
private _accountAddress;
|
|
152
|
+
private _isDeployed;
|
|
153
|
+
private _cachedNonce;
|
|
154
|
+
constructor(config: SimpleAccountConfig);
|
|
155
|
+
/**
|
|
156
|
+
* @deprecated Use getAccountAddress() instead. This sync getter is removed
|
|
157
|
+
* because address derivation now requires an RPC call to the factory.
|
|
158
|
+
*/
|
|
159
|
+
get accountAddress(): string;
|
|
160
|
+
getAccountAddress(): Promise<string>;
|
|
161
|
+
isDeployed(): Promise<boolean>;
|
|
162
|
+
invalidateDeploymentCache(): void;
|
|
163
|
+
buildUserOperation(transactions: TransactionRequest | TransactionRequest[], options?: {
|
|
164
|
+
usePaymaster?: boolean;
|
|
165
|
+
paymasterContext?: PaymasterContext;
|
|
166
|
+
}): Promise<UserOperation>;
|
|
167
|
+
computeUserOpHash(userOp: UserOperation): string;
|
|
168
|
+
sendUserOperation(userOp: UserOperation): Promise<{
|
|
169
|
+
userOpHash: string;
|
|
170
|
+
wait: () => Promise<void>;
|
|
171
|
+
}>;
|
|
172
|
+
private fetchAccountAddressFromFactory;
|
|
173
|
+
private getInitCode;
|
|
174
|
+
private encodeExecute;
|
|
175
|
+
private packUserOp;
|
|
176
|
+
private getDummySignature;
|
|
177
|
+
private getNonce;
|
|
178
|
+
invalidateNonceCache(): void;
|
|
179
|
+
private estimateGas;
|
|
180
|
+
private getFeeData;
|
|
181
|
+
private getAccountCode;
|
|
182
|
+
}
|
|
183
|
+
declare function createSimpleAccount(config: SimpleAccountConfig): SimpleAccount;
|
|
184
|
+
|
|
185
|
+
export { BundlerClient, type BundlerClientConfig, type GasEstimate, PaymasterClient, type PaymasterClientConfig, type PaymasterContext, type PaymasterResult, SimpleAccount, type SimpleAccountConfig, type SimpleAccountFactoryData, type TransactionRequest, type UserOperation, type UserOperationHex, type UserOperationReceipt, createBundlerClient, createPaymasterClient, createSimpleAccount, userOpFromHex, userOpToHex };
|