@smoothsend/sdk 2.3.2 → 2.3.4
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/avax/SmoothSendAvaxClient.d.ts +4 -2
- package/dist/avax/SmoothSendAvaxClient.d.ts.map +1 -1
- package/dist/avax/index.cjs +155 -28
- package/dist/avax/index.cjs.map +1 -1
- package/dist/avax/index.d.ts +58 -437
- package/dist/avax/index.d.ts.map +1 -1
- package/dist/avax/index.js +153 -29
- package/dist/avax/index.js.map +1 -1
- package/dist/avax/privySigner.d.ts +12 -0
- package/dist/avax/privySigner.d.ts.map +1 -0
- package/dist/avax/types.d.ts +6 -0
- package/dist/avax/types.d.ts.map +1 -1
- package/dist/avax/useSmoothSendAvax.d.ts +6 -2
- package/dist/avax/useSmoothSendAvax.d.ts.map +1 -1
- package/dist/avax/useSmoothSendPrivyWrite.d.ts +35 -0
- package/dist/avax/useSmoothSendPrivyWrite.d.ts.map +1 -0
- package/dist/avax/useSmoothSendWrite.d.ts +30 -0
- package/dist/avax/useSmoothSendWrite.d.ts.map +1 -0
- package/dist/avax-entry.d.ts +1 -1
- package/dist/avax-entry.d.ts.map +1 -1
- package/dist/chunks/shared-Cgb7mhwI.d.ts +471 -0
- package/dist/chunks/shared-viO0MYao.d.ts +459 -0
- package/dist/index.cjs +43 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +43 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/avax/index.d.ts
CHANGED
|
@@ -1,461 +1,82 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { F as UserOpSignerAvax, y as AvaxSponsorshipMode, P as PaymasterSignRequestAvax } from '../chunks/shared-Cgb7mhwI.js';
|
|
2
|
+
export { m as AvaxAaPublicDefaults, w as AvaxFeePreview, x as AvaxHashTypes, A as AvaxSubmitter, E as ENTRY_POINT_V07_ADDRESS, s as EstimateUserPaysFeeAvaxOptions, G as GasEstimateAvax, z as PaymasterSignResponseAvax, j as SIMPLE_ACCOUNT_FACTORY_ABI, q as SimpleCallInput, S as SmoothSendAvaxClient, o as SmoothSendAvaxClientConfig, v as SmoothSendAvaxContextValue, d as SmoothSendAvaxProvider, a as SmoothSendAvaxSubmitter, n as SmoothSendAvaxSubmitterConfig, B as SponsoredUserOpDraftAvax, t as SubmitSponsoredAvaxUserOpOptions, U as UseSmoothSendAvaxParams, C as UserOperationAvax, D as UserOperationReceiptAvax, i as avaxExecuteAbi, c as createSmoothSendAvaxClient, b as createSmoothSendAvaxSubmitter, f as encodeAvaxExecuteCalldata, k as encodeCreateAccountFactoryData, l as fetchAvaxAaPublicDefaults, h as hashUserOperationAvax, p as predictSimpleAccountAddress, r as readAvaxSenderNonce, u as useSmoothSendAvax, e as useSmoothSendAvaxContext, g as userOperationAvaxToViem } from '../chunks/shared-Cgb7mhwI.js';
|
|
3
|
+
import { Address, PublicClient, WalletClient } from 'viem';
|
|
5
4
|
export { H as HttpClient, O as SmoothSendError, V as VERSION } from '../chunks/shared-Cn4duBJT.js';
|
|
5
|
+
import 'viem/account-abstraction';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import 'react';
|
|
6
8
|
import 'axios';
|
|
7
9
|
|
|
10
|
+
type PrivyMessageSigner = (args: {
|
|
11
|
+
message: string;
|
|
12
|
+
}) => Promise<string>;
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
14
|
+
* Build a SmoothSend-compatible UserOp signer from a Privy `signMessage` function.
|
|
15
|
+
*
|
|
16
|
+
* This keeps the SDK wallet-agnostic: Privy handles auth/signing UX, SmoothSend handles
|
|
17
|
+
* paymaster + bundler sponsorship for AVAX.
|
|
10
18
|
*/
|
|
11
|
-
|
|
12
|
-
/** Unpacked UserOperation as accepted by the bundler JSON-RPC + paymaster/sign */
|
|
13
|
-
interface UserOperationAvax {
|
|
14
|
-
sender: string;
|
|
15
|
-
nonce: string;
|
|
16
|
-
factory?: string;
|
|
17
|
-
factoryData?: string;
|
|
18
|
-
initCode?: string;
|
|
19
|
-
callData: string;
|
|
20
|
-
callGasLimit?: string;
|
|
21
|
-
verificationGasLimit?: string;
|
|
22
|
-
preVerificationGas?: string;
|
|
23
|
-
maxFeePerGas?: string;
|
|
24
|
-
maxPriorityFeePerGas?: string;
|
|
25
|
-
paymaster?: string;
|
|
26
|
-
paymasterVerificationGasLimit?: string;
|
|
27
|
-
paymasterPostOpGasLimit?: string;
|
|
28
|
-
paymasterData?: string;
|
|
29
|
-
accountGasLimits?: string;
|
|
30
|
-
gasFees?: string;
|
|
31
|
-
paymasterAndData?: string;
|
|
32
|
-
/** Empty (`0x`) until the wallet/account signs the hash UserOp */
|
|
33
|
-
signature: string;
|
|
34
|
-
}
|
|
35
|
-
interface GasEstimateAvax {
|
|
36
|
-
preVerificationGas: string;
|
|
37
|
-
verificationGasLimit: string;
|
|
38
|
-
callGasLimit: string;
|
|
39
|
-
paymasterVerificationGasLimit?: string;
|
|
40
|
-
paymasterPostOpGasLimit?: string;
|
|
41
|
-
}
|
|
42
|
-
interface PaymasterSignRequestAvax {
|
|
43
|
-
mode: AvaxSponsorshipMode;
|
|
44
|
-
userOp: UserOperationAvax;
|
|
45
|
-
token?: string;
|
|
46
|
-
receiver?: string;
|
|
47
|
-
precheckBalance?: boolean;
|
|
48
|
-
prepaymentRequired?: boolean;
|
|
49
|
-
allowAnyBundler?: boolean;
|
|
50
|
-
sponsorUUID?: string;
|
|
51
|
-
}
|
|
52
|
-
interface AvaxFeePreview {
|
|
53
|
-
predictedGasCostWei: string;
|
|
54
|
-
predictedTokenFee: string;
|
|
55
|
-
minTokenFee: string;
|
|
56
|
-
variableTokenFee: string;
|
|
57
|
-
floorApplied: boolean;
|
|
58
|
-
}
|
|
59
|
-
interface AvaxHashTypes {
|
|
60
|
-
sendUserOperationResult?: 'userOpHash';
|
|
61
|
-
explorerTxLinkRequires?: 'transactionHash';
|
|
62
|
-
userOpHash?: 'userOpHash';
|
|
63
|
-
transactionHash?: 'transactionHash';
|
|
64
|
-
}
|
|
65
|
-
interface PaymasterSignResponseAvax {
|
|
66
|
-
success: boolean;
|
|
67
|
-
requestId?: string;
|
|
68
|
-
network?: string;
|
|
69
|
-
hashTypes?: AvaxHashTypes;
|
|
70
|
-
paymasterAndData: string;
|
|
71
|
-
paymasterData?: string;
|
|
72
|
-
signature?: string;
|
|
73
|
-
exchangeRate?: string;
|
|
74
|
-
feePreview?: AvaxFeePreview;
|
|
75
|
-
paymasterDataParts?: Record<string, string>;
|
|
76
|
-
error?: string;
|
|
77
|
-
}
|
|
78
|
-
interface UserOperationReceiptAvax {
|
|
79
|
-
userOpHash: string;
|
|
80
|
-
sender: string;
|
|
81
|
-
nonce: string;
|
|
82
|
-
paymaster: string;
|
|
83
|
-
success: boolean;
|
|
84
|
-
actualGasCost: string;
|
|
85
|
-
actualGasUsed: string;
|
|
86
|
-
reason?: string;
|
|
87
|
-
logs: unknown[];
|
|
88
|
-
receipt: {
|
|
89
|
-
transactionHash: string;
|
|
90
|
-
blockNumber: number;
|
|
91
|
-
blockHash: string;
|
|
92
|
-
};
|
|
93
|
-
hashTypes?: AvaxHashTypes;
|
|
94
|
-
}
|
|
95
|
-
/** Partial UserOp before estimate/paymaster (signature optional, usually `0x` until wallet signs). */
|
|
96
|
-
type SponsoredUserOpDraftAvax = Omit<UserOperationAvax, 'signature'> & {
|
|
97
|
-
signature?: string;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Public gateway defaults for Avalanche AA (no API key).
|
|
102
|
-
*/
|
|
103
|
-
/** Canonical ERC-4337 EntryPoint v0.7 on Fuji / Avalanche C-Chain */
|
|
104
|
-
declare const ENTRY_POINT_V07_ADDRESS: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
105
|
-
type AvaxAaPublicDefaults = {
|
|
106
|
-
success?: boolean;
|
|
107
|
-
simpleAccountFactoryFuji: `0x${string}` | null;
|
|
108
|
-
simpleAccountFactoryMainnet: `0x${string}` | null;
|
|
109
|
-
entryPointV07: typeof ENTRY_POINT_V07_ADDRESS;
|
|
110
|
-
paymasterFuji: `0x${string}` | null;
|
|
111
|
-
paymasterMainnet: `0x${string}` | null;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Fetch SimpleAccount factory and Paymaster hints from SmoothSend gateway (GET; no auth).
|
|
115
|
-
*/
|
|
116
|
-
declare function fetchAvaxAaPublicDefaults(gatewayUrl?: string): Promise<AvaxAaPublicDefaults>;
|
|
19
|
+
declare function createPrivyUserOpSigner(signMessage: PrivyMessageSigner): UserOpSignerAvax;
|
|
117
20
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/** Sender must match your smart account; nonce/callData/fees from your app */
|
|
121
|
-
userOp: SponsoredUserOpDraftAvax;
|
|
122
|
-
/** Wallet / viem / ethers signs the UserOp hash your stack expects */
|
|
123
|
-
signUserOp: (userOp: UserOperationAvax) => Promise<string>;
|
|
124
|
-
mode?: AvaxSponsorshipMode;
|
|
125
|
-
/** Defaults to first entry point from `eth_supportedEntryPoints` */
|
|
126
|
-
entryPoint?: string;
|
|
127
|
-
/** Extra `paymaster/sign` fields (`token`, `receiver`, …) for user-pays-ERC20 */
|
|
128
|
-
paymaster?: Omit<PaymasterSignRequestAvax, 'mode' | 'userOp'>;
|
|
129
|
-
/** @default true */
|
|
130
|
-
waitForReceipt?: boolean;
|
|
131
|
-
receiptPoll?: {
|
|
132
|
-
pollMs?: number;
|
|
133
|
-
timeoutMs?: number;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
interface EstimateUserPaysFeeAvaxOptions {
|
|
137
|
-
/** Draft UserOperation (same shape as submit flow before signing) */
|
|
138
|
-
userOp: SponsoredUserOpDraftAvax;
|
|
139
|
-
/** Optional entrypoint, defaults to eth_supportedEntryPoints()[0] */
|
|
140
|
-
entryPoint?: string;
|
|
141
|
-
/** Optional paymaster params such as token/receiver overrides */
|
|
142
|
-
paymaster?: Omit<PaymasterSignRequestAvax, 'mode' | 'userOp'>;
|
|
143
|
-
}
|
|
144
|
-
interface SmoothSendAvaxSubmitterConfig {
|
|
145
|
-
apiKey: string;
|
|
146
|
-
network?: 'testnet' | 'mainnet';
|
|
147
|
-
gatewayUrl?: string;
|
|
148
|
-
timeout?: number;
|
|
149
|
-
/**
|
|
150
|
-
* Gateway chain routing bucket. Default `avalanche` matches `core/gateway` routing.
|
|
151
|
-
*/
|
|
152
|
-
chain?: string;
|
|
153
|
-
/**
|
|
154
|
-
* Public keys (`pk_nogas_*`) require an `Origin` header matching your project's allowed CORS origins.
|
|
155
|
-
* Set this for Node/scripts (e.g. `http://localhost:5173`). Browsers send Origin automatically.
|
|
156
|
-
*/
|
|
157
|
-
corsOrigin?: string;
|
|
158
|
-
}
|
|
159
|
-
declare class SmoothSendAvaxSubmitter {
|
|
160
|
-
private readonly config;
|
|
161
|
-
private readonly http;
|
|
162
|
-
private rpcId;
|
|
163
|
-
constructor(config: SmoothSendAvaxSubmitterConfig);
|
|
164
|
-
getConfig(): Readonly<SmoothSendAvaxSubmitterConfig>;
|
|
165
|
-
/** Merge gas estimate fields into a partial UserOp */
|
|
166
|
-
static applyGasEstimate(userOp: UserOperationAvax, gas: GasEstimateAvax): UserOperationAvax;
|
|
167
|
-
/** Attach packed paymaster data returned from {@link paymasterSign} */
|
|
168
|
-
static applyPaymasterAndData(userOp: UserOperationAvax, paymasterAndData: string): UserOperationAvax;
|
|
169
|
-
getChainId(): Promise<string>;
|
|
170
|
-
getSupportedEntryPoints(): Promise<string[]>;
|
|
171
|
-
estimateUserOperationGas(userOp: UserOperationAvax, entryPoint: string): Promise<GasEstimateAvax>;
|
|
172
|
-
sendUserOperation(userOp: UserOperationAvax, entryPoint: string): Promise<string>;
|
|
173
|
-
getUserOperationReceipt(userOpHash: string): Promise<UserOperationReceiptAvax | null>;
|
|
174
|
-
waitForUserOperationReceipt(userOpHash: string, options?: {
|
|
175
|
-
pollMs?: number;
|
|
176
|
-
timeoutMs?: number;
|
|
177
|
-
}): Promise<UserOperationReceiptAvax | null>;
|
|
178
|
-
paymasterSign(body: PaymasterSignRequestAvax): Promise<PaymasterSignResponseAvax>;
|
|
179
|
-
/**
|
|
180
|
-
* Preflight fee estimate for `user-pays-erc20` mode.
|
|
181
|
-
*
|
|
182
|
-
* This performs:
|
|
183
|
-
* 1) `eth_estimateUserOperationGas`
|
|
184
|
-
* 2) `paymaster/sign` in `user-pays-erc20` mode
|
|
185
|
-
* and returns `feePreview` when available.
|
|
186
|
-
*/
|
|
187
|
-
estimateUserPaysFee(opts: EstimateUserPaysFeeAvaxOptions): Promise<{
|
|
188
|
-
entryPoint: string;
|
|
189
|
-
userOp: UserOperationAvax;
|
|
190
|
-
gas: GasEstimateAvax;
|
|
191
|
-
exchangeRate?: string;
|
|
192
|
-
feePreview?: AvaxFeePreview;
|
|
193
|
-
}>;
|
|
194
|
-
getBundlerHealth(): Promise<unknown>;
|
|
195
|
-
/** Fetch public AA addresses (Factory, Paymaster) from gateway. */
|
|
196
|
-
getPublicAaDefaults(): Promise<AvaxAaPublicDefaults>;
|
|
197
|
-
/**
|
|
198
|
-
* One call: estimate gas → paymaster/sign → merge → your sign → send → (optional) wait for receipt.
|
|
199
|
-
*/
|
|
200
|
-
submitSponsoredUserOperation(opts: SubmitSponsoredAvaxUserOpOptions): Promise<{
|
|
201
|
-
userOpHash: string;
|
|
202
|
-
receipt: UserOperationReceiptAvax | null;
|
|
203
|
-
}>;
|
|
204
|
-
private rpc;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* @alias {@link SmoothSendAvaxSubmitter}
|
|
208
|
-
*/
|
|
209
|
-
declare const AvaxSubmitter: typeof SmoothSendAvaxSubmitter;
|
|
210
|
-
declare function createSmoothSendAvaxSubmitter(config: SmoothSendAvaxSubmitterConfig): SmoothSendAvaxSubmitter;
|
|
211
|
-
|
|
212
|
-
interface SmoothSendAvaxClientConfig {
|
|
213
|
-
apiKey: string;
|
|
21
|
+
interface UseSmoothSendWriteParams {
|
|
22
|
+
apiKey?: string;
|
|
214
23
|
network?: 'testnet' | 'mainnet';
|
|
215
|
-
gatewayUrl?: string;
|
|
216
|
-
timeout?: number;
|
|
217
|
-
chain?: string;
|
|
218
|
-
corsOrigin?: string;
|
|
219
|
-
publicClient: PublicClient;
|
|
220
|
-
walletClient: WalletClient;
|
|
221
24
|
smartAccountAddress?: Address;
|
|
222
25
|
accountFactory?: Address;
|
|
223
26
|
accountSalt?: bigint;
|
|
27
|
+
ownerAddress?: Address;
|
|
28
|
+
publicClient?: PublicClient | null;
|
|
29
|
+
walletClient?: WalletClient | null;
|
|
30
|
+
signUserOpHash?: UserOpSignerAvax;
|
|
224
31
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
readonly config: SmoothSendAvaxClientConfig;
|
|
233
|
-
constructor(config: SmoothSendAvaxClientConfig);
|
|
234
|
-
submitCall(args: {
|
|
235
|
-
call: SimpleCallInput;
|
|
236
|
-
mode?: AvaxSponsorshipMode;
|
|
237
|
-
paymaster?: Omit<PaymasterSignRequestAvax, 'mode' | 'userOp'>;
|
|
238
|
-
smartAccountAddress?: Address;
|
|
239
|
-
accountFactory?: Address;
|
|
240
|
-
accountSalt?: bigint;
|
|
241
|
-
waitForReceipt?: boolean;
|
|
242
|
-
}): Promise<{
|
|
243
|
-
userOpHash: string;
|
|
244
|
-
transactionHash: string | undefined;
|
|
245
|
-
receipt: UserOperationReceiptAvax | null;
|
|
246
|
-
}>;
|
|
247
|
-
submitCalls(args: {
|
|
248
|
-
calls: SimpleCallInput[];
|
|
32
|
+
declare function useSmoothSendWrite(params?: UseSmoothSendWriteParams): {
|
|
33
|
+
writeContract: (args: {
|
|
34
|
+
address: Address;
|
|
35
|
+
abi: any;
|
|
36
|
+
functionName: string;
|
|
37
|
+
args?: any[];
|
|
38
|
+
value?: bigint;
|
|
249
39
|
mode?: AvaxSponsorshipMode;
|
|
250
|
-
paymaster?: Omit<PaymasterSignRequestAvax,
|
|
251
|
-
smartAccountAddress?: Address;
|
|
252
|
-
accountFactory?: Address;
|
|
253
|
-
accountSalt?: bigint;
|
|
40
|
+
paymaster?: Omit<PaymasterSignRequestAvax, "mode" | "userOp">;
|
|
254
41
|
waitForReceipt?: boolean;
|
|
255
|
-
})
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
estimateUserPaysFee(args: {
|
|
261
|
-
calls: SimpleCallInput[];
|
|
262
|
-
paymaster?: Omit<PaymasterSignRequestAvax, 'mode' | 'userOp'>;
|
|
263
|
-
smartAccountAddress?: Address;
|
|
264
|
-
accountFactory?: Address;
|
|
265
|
-
accountSalt?: bigint;
|
|
266
|
-
}): Promise<{
|
|
267
|
-
feePreview?: AvaxFeePreview;
|
|
268
|
-
exchangeRate?: string;
|
|
269
|
-
entryPoint: string;
|
|
270
|
-
}>;
|
|
271
|
-
private buildDraft;
|
|
272
|
-
private signUserOpHash;
|
|
273
|
-
}
|
|
274
|
-
declare function createSmoothSendAvaxClient(config: SmoothSendAvaxClientConfig): SmoothSendAvaxClient;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Viem helpers for ERC-4337 v0.7 + common smart-account `execute` encoding.
|
|
278
|
-
* Peer dependency: `viem` (optional install).
|
|
279
|
-
*/
|
|
280
|
-
|
|
281
|
-
/** Typical SimpleAccount-style `execute(dest,value,func)`. */
|
|
282
|
-
declare const avaxExecuteAbi: readonly [{
|
|
283
|
-
readonly name: "execute";
|
|
284
|
-
readonly type: "function";
|
|
285
|
-
readonly stateMutability: "nonpayable";
|
|
286
|
-
readonly inputs: readonly [{
|
|
287
|
-
readonly name: "dest";
|
|
288
|
-
readonly type: "address";
|
|
289
|
-
}, {
|
|
290
|
-
readonly name: "value";
|
|
291
|
-
readonly type: "uint256";
|
|
292
|
-
}, {
|
|
293
|
-
readonly name: "func";
|
|
294
|
-
readonly type: "bytes";
|
|
295
|
-
}];
|
|
296
|
-
readonly outputs: readonly [];
|
|
297
|
-
}, {
|
|
298
|
-
readonly name: "executeBatch";
|
|
299
|
-
readonly type: "function";
|
|
300
|
-
readonly stateMutability: "nonpayable";
|
|
301
|
-
readonly inputs: readonly [{
|
|
302
|
-
readonly name: "dest";
|
|
303
|
-
readonly type: "address[]";
|
|
304
|
-
}, {
|
|
305
|
-
readonly name: "value";
|
|
306
|
-
readonly type: "uint256[]";
|
|
307
|
-
}, {
|
|
308
|
-
readonly name: "func";
|
|
309
|
-
readonly type: "bytes[]";
|
|
310
|
-
}];
|
|
311
|
-
readonly outputs: readonly [];
|
|
312
|
-
}];
|
|
313
|
-
declare function encodeAvaxExecuteCalldata(to: Address, value: bigint, data?: Hex): Hex;
|
|
314
|
-
/** Convert API UserOp → viem shape for {@link getUserOperationHash}. */
|
|
315
|
-
declare function userOperationAvaxToViem(u: UserOperationAvax): UserOperation<'0.7'>;
|
|
316
|
-
declare function hashUserOperationAvax(params: {
|
|
317
|
-
chainId: number;
|
|
318
|
-
entryPointAddress: Address;
|
|
319
|
-
userOperation: UserOperationAvax;
|
|
320
|
-
}): Hex;
|
|
321
|
-
/** EntryPoint v0.7 `getNonce(sender, key)` with key `0`. */
|
|
322
|
-
declare function readAvaxSenderNonce(params: {
|
|
323
|
-
publicClient: PublicClient;
|
|
324
|
-
entryPointAddress: Address;
|
|
325
|
-
sender: Address;
|
|
326
|
-
key?: bigint;
|
|
327
|
-
}): Promise<bigint>;
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Standard SimpleAccountFactory (EntryPoint v0.7) helpers for counterfactual address + init calldata.
|
|
331
|
-
*/
|
|
332
|
-
|
|
333
|
-
/** Minimal ABI for eth-infinitism–style SimpleAccountFactory. */
|
|
334
|
-
declare const SIMPLE_ACCOUNT_FACTORY_ABI: readonly [{
|
|
335
|
-
readonly inputs: readonly [{
|
|
336
|
-
readonly name: "owner";
|
|
337
|
-
readonly type: "address";
|
|
338
|
-
}, {
|
|
339
|
-
readonly name: "salt";
|
|
340
|
-
readonly type: "uint256";
|
|
341
|
-
}];
|
|
342
|
-
readonly name: "createAccount";
|
|
343
|
-
readonly outputs: readonly [{
|
|
344
|
-
readonly name: "account";
|
|
345
|
-
readonly type: "address";
|
|
346
|
-
}];
|
|
347
|
-
readonly stateMutability: "nonpayable";
|
|
348
|
-
readonly type: "function";
|
|
349
|
-
}, {
|
|
350
|
-
readonly inputs: readonly [{
|
|
351
|
-
readonly name: "owner";
|
|
352
|
-
readonly type: "address";
|
|
353
|
-
}, {
|
|
354
|
-
readonly name: "salt";
|
|
355
|
-
readonly type: "uint256";
|
|
356
|
-
}];
|
|
357
|
-
readonly name: "getAddress";
|
|
358
|
-
readonly outputs: readonly [{
|
|
359
|
-
readonly name: "";
|
|
360
|
-
readonly type: "address";
|
|
361
|
-
}];
|
|
362
|
-
readonly stateMutability: "view";
|
|
363
|
-
readonly type: "function";
|
|
364
|
-
}];
|
|
365
|
-
declare function predictSimpleAccountAddress(params: {
|
|
366
|
-
publicClient: PublicClient;
|
|
367
|
-
factory: Address;
|
|
368
|
-
owner: Address;
|
|
369
|
-
salt?: bigint;
|
|
370
|
-
}): Promise<Address>;
|
|
371
|
-
declare function encodeCreateAccountFactoryData(owner: Address, salt: bigint): Hex;
|
|
372
|
-
|
|
373
|
-
type SmoothSendAvaxContextValue = {
|
|
374
|
-
apiKey: string;
|
|
375
|
-
network: 'testnet' | 'mainnet';
|
|
376
|
-
/** Set when the SCW is already known. If you use `accountFactory`, you can omit this. */
|
|
377
|
-
smartAccountAddress?: Address;
|
|
378
|
-
/**
|
|
379
|
-
* SimpleAccountFactory (v0.7). When set, the hook derives the counterfactual sender via
|
|
380
|
-
* `getAddress(owner, salt)` and, if the account has no code, adds `factory` + `factoryData` so the
|
|
381
|
-
* first sponsored UserOp deploys the SCW and runs `callData` in the same op.
|
|
382
|
-
*/
|
|
383
|
-
accountFactory?: Address;
|
|
384
|
-
accountSalt?: bigint;
|
|
42
|
+
}) => Promise<string>;
|
|
43
|
+
data: `0x${string}` | undefined;
|
|
44
|
+
isPending: boolean;
|
|
45
|
+
isIdle: boolean;
|
|
46
|
+
status: string;
|
|
385
47
|
};
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
accountSalt?: bigint;
|
|
392
|
-
children: ReactNode;
|
|
393
|
-
}): react_jsx_runtime.JSX.Element;
|
|
394
|
-
declare function useSmoothSendAvaxContext(): SmoothSendAvaxContextValue | null;
|
|
395
|
-
type UseSmoothSendAvaxParams = {
|
|
48
|
+
|
|
49
|
+
interface UseSmoothSendPrivyWriteParams {
|
|
50
|
+
publicClient: PublicClient | null | undefined;
|
|
51
|
+
ownerAddress: Address;
|
|
52
|
+
signMessage: PrivyMessageSigner;
|
|
396
53
|
apiKey?: string;
|
|
397
54
|
network?: 'testnet' | 'mainnet';
|
|
398
55
|
smartAccountAddress?: Address;
|
|
399
56
|
accountFactory?: Address;
|
|
400
|
-
/** @default 0n */
|
|
401
57
|
accountSalt?: bigint;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Privy-first wrapper for one-line AVAX sponsored writes.
|
|
61
|
+
*
|
|
62
|
+
* Privy provides auth + signing UX, SmoothSend handles UserOp sponsorship/submission.
|
|
63
|
+
*/
|
|
64
|
+
declare function useSmoothSendPrivyWrite(params: UseSmoothSendPrivyWriteParams): {
|
|
65
|
+
writeContract: (args: {
|
|
66
|
+
address: Address;
|
|
67
|
+
abi: any;
|
|
68
|
+
functionName: string;
|
|
69
|
+
args?: any[];
|
|
413
70
|
value?: bigint;
|
|
414
|
-
call?: {
|
|
415
|
-
to: Address;
|
|
416
|
-
data?: Hex;
|
|
417
|
-
value?: bigint;
|
|
418
|
-
};
|
|
419
|
-
calls?: {
|
|
420
|
-
to: Address;
|
|
421
|
-
data?: Hex;
|
|
422
|
-
value?: bigint;
|
|
423
|
-
}[];
|
|
424
71
|
mode?: AvaxSponsorshipMode;
|
|
425
|
-
paymaster?: Omit<PaymasterSignRequestAvax,
|
|
72
|
+
paymaster?: Omit<PaymasterSignRequestAvax, "mode" | "userOp">;
|
|
426
73
|
waitForReceipt?: boolean;
|
|
427
|
-
}) =>
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
value?: bigint;
|
|
433
|
-
}>;
|
|
434
|
-
sponsorshipMode?: AvaxSponsorshipMode;
|
|
435
|
-
paymaster?: Omit<PaymasterSignRequestAvax, 'mode' | 'userOp'>;
|
|
436
|
-
waitForReceipt?: boolean;
|
|
437
|
-
}) => ReturnType<SmoothSendAvaxSubmitter['submitSponsoredUserOperation']>;
|
|
438
|
-
estimateUserPaysFee: (args: {
|
|
439
|
-
to?: Address;
|
|
440
|
-
data?: Hex;
|
|
441
|
-
value?: bigint;
|
|
442
|
-
call?: {
|
|
443
|
-
to: Address;
|
|
444
|
-
data?: Hex;
|
|
445
|
-
value?: bigint;
|
|
446
|
-
};
|
|
447
|
-
calls?: {
|
|
448
|
-
to: Address;
|
|
449
|
-
data?: Hex;
|
|
450
|
-
value?: bigint;
|
|
451
|
-
}[];
|
|
452
|
-
paymaster?: Omit<PaymasterSignRequestAvax, 'mode' | 'userOp'>;
|
|
453
|
-
}) => Promise<{
|
|
454
|
-
entryPoint: string;
|
|
455
|
-
feePreview?: AvaxFeePreview;
|
|
456
|
-
exchangeRate?: string;
|
|
457
|
-
}>;
|
|
74
|
+
}) => Promise<string>;
|
|
75
|
+
data: `0x${string}` | undefined;
|
|
76
|
+
isPending: boolean;
|
|
77
|
+
isIdle: boolean;
|
|
78
|
+
status: string;
|
|
458
79
|
};
|
|
459
80
|
|
|
460
|
-
export {
|
|
461
|
-
export type {
|
|
81
|
+
export { AvaxSponsorshipMode, PaymasterSignRequestAvax, UserOpSignerAvax, createPrivyUserOpSigner, useSmoothSendPrivyWrite, useSmoothSendWrite };
|
|
82
|
+
export type { PrivyMessageSigner, UseSmoothSendPrivyWriteParams, UseSmoothSendWriteParams };
|
package/dist/avax/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/avax/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,6BAA6B,EAC7B,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,GACtC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,8BAA8B,EAC9B,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/avax/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,6BAA6B,EAC7B,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,GACtC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,8BAA8B,EAC9B,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,uBAAuB,EACvB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,uBAAuB,EACvB,KAAK,6BAA6B,GACnC,MAAM,2BAA2B,CAAC"}
|