signer-test-sdk-react 0.0.23 → 0.0.24
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/CHANGELOG.md +29 -0
- package/README.md +4 -0
- package/dist/src/OnboardingUI.d.ts +1 -1
- package/dist/src/chains.d.ts +1 -1
- package/dist/src/components/AbstraxnProvider/AbstraxnProvider.js.map +1 -1
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderInner.js +1 -1
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderInner.js.map +1 -1
- package/dist/src/components/AbstraxnProvider/useAbstraxnProviderBase.d.ts +2 -2
- package/dist/src/components/AbstraxnProvider/useOAuthCallbacks.d.ts +1 -1
- package/dist/src/components/AbstraxnProvider/useWalletInitialization.d.ts +1 -1
- package/dist/src/components/AbstraxnProvider/useWalletInitialization.js +1 -1
- package/dist/src/components/AbstraxnProvider/useWalletInitialization.js.map +1 -1
- package/dist/src/components/OnboardingUI/OnboardingUIReact.d.ts +1 -1
- package/dist/src/components/OnboardingUI/OnboardingUIWeb.d.ts +1 -1
- package/dist/src/components/OnboardingUI/OnboardingUIWeb.js +1 -1
- package/dist/src/components/OnboardingUI/OnboardingUIWeb.js.map +1 -1
- package/dist/src/components/OnboardingUI/components/EmailForm.d.ts +1 -1
- package/dist/src/components/OnboardingUI/components/EmailForm.js +1 -1
- package/dist/src/components/OnboardingUI/components/EmailForm.js.map +1 -1
- package/dist/src/components/OnboardingUI/components/OtpForm.d.ts +1 -1
- package/dist/src/components/OnboardingUI/components/PasskeyButton.d.ts +1 -1
- package/dist/src/components/OnboardingUI/components/SocialButtons.d.ts +1 -1
- package/dist/src/components/OnboardingUI/hooks/useAuthMethods.d.ts +1 -1
- package/dist/src/components/OnboardingUI/hooks/useOnboarding.d.ts +1 -1
- package/dist/src/components/OnboardingUI/index.d.ts +1 -1
- package/dist/src/components/WalletModal/components/UserAvatar.d.ts +1 -1
- package/dist/src/components/WalletModal/hooks/useSendTransaction.d.ts +1 -1
- package/dist/src/hooks.d.ts +104 -36
- package/dist/src/hooks.js +334 -121
- package/dist/src/hooks.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/types.d.ts +6 -6
- package/dist/src/wagmiConfig.d.ts +1 -1
- package/dist/src/wagmiConfig.js +1 -1
- package/dist/src/wagmiConfig.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
export { OnboardingUIReact } from './OnboardingUIReact';
|
|
8
8
|
export type { OnboardingUIReactProps } from './OnboardingUIReact';
|
|
9
9
|
export { OnboardingUIWeb } from './OnboardingUIWeb';
|
|
10
|
-
export type { OnboardingUIConfig, Theme } from 'signer-
|
|
10
|
+
export type { OnboardingUIConfig, Theme } from '@abstraxn/signer-core';
|
|
11
11
|
export * from './components';
|
|
12
12
|
export * from './hooks';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TransactionRequest } from 'signer-
|
|
1
|
+
import type { TransactionRequest } from '@abstraxn/signer-core';
|
|
2
2
|
import type { ChainData } from '../../../chains';
|
|
3
3
|
interface UseSendTransactionProps {
|
|
4
4
|
sendTransaction?: (tx: TransactionRequest) => Promise<{
|
package/dist/src/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WhoamiResponse, TransactionRequest } from 'signer-
|
|
1
|
+
import type { WhoamiResponse, TransactionRequest } from '@abstraxn/signer-core';
|
|
2
2
|
import type { Chain, PublicClient, Address, Abi, GetContractReturnType, TransactionReceipt } from 'viem';
|
|
3
3
|
import { type ConnectorType, type ConnectorMeta } from './connectors';
|
|
4
4
|
/**
|
|
@@ -14,7 +14,7 @@ export declare function useAddress(): string | null;
|
|
|
14
14
|
* Returns an object with both user and whoami data
|
|
15
15
|
*/
|
|
16
16
|
export declare function useAuthContext(): {
|
|
17
|
-
user: import("signer-
|
|
17
|
+
user: import("@abstraxn/signer-core").User | null;
|
|
18
18
|
whoami: WhoamiResponse | null;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
@@ -29,7 +29,7 @@ export { useAbstraxnWallet } from './AbstraxnProvider';
|
|
|
29
29
|
/**
|
|
30
30
|
* Hook to get wallet instance (for advanced usage)
|
|
31
31
|
*/
|
|
32
|
-
export declare function useWallet(): import("signer-
|
|
32
|
+
export declare function useWallet(): import("@abstraxn/signer-core").AbstraxnWallet | null;
|
|
33
33
|
/**
|
|
34
34
|
* Hook to export wallet private key
|
|
35
35
|
* Returns the export bundle containing the private key
|
|
@@ -141,7 +141,7 @@ export declare function useExternalWalletInfo(): {
|
|
|
141
141
|
* @param tx - Transaction request object
|
|
142
142
|
* @returns Promise resolving to transaction response with hash
|
|
143
143
|
*/
|
|
144
|
-
sendTransaction: (tx: TransactionRequest) => Promise<import("signer-
|
|
144
|
+
sendTransaction: (tx: TransactionRequest) => Promise<import("@abstraxn/signer-core").TransactionResponse>;
|
|
145
145
|
/**
|
|
146
146
|
* Sign a message using external wallet
|
|
147
147
|
* @param message - Message string to sign
|
|
@@ -172,7 +172,7 @@ export declare function useExternalWalletInfo(): {
|
|
|
172
172
|
*
|
|
173
173
|
* @example
|
|
174
174
|
* ```tsx
|
|
175
|
-
* import { usePublicClient } from 'signer-
|
|
175
|
+
* import { usePublicClient } from '@abstraxn/signer-react';
|
|
176
176
|
* import { polygonAmoy } from 'viem/chains';
|
|
177
177
|
*
|
|
178
178
|
* function MyComponent() {
|
|
@@ -3832,7 +3832,7 @@ export declare function usePublicClient(chain: Chain, rpcUrl: string): {
|
|
|
3832
3832
|
*
|
|
3833
3833
|
* @example
|
|
3834
3834
|
* ```tsx
|
|
3835
|
-
* import { useWalletClient } from 'signer-
|
|
3835
|
+
* import { useWalletClient } from '@abstraxn/signer-react';
|
|
3836
3836
|
* import { polygonAmoy } from 'viem/chains';
|
|
3837
3837
|
*
|
|
3838
3838
|
* function MyComponent() {
|
|
@@ -8292,7 +8292,7 @@ export declare function useWalletClient(chain: any, rpcUrl?: string): {
|
|
|
8292
8292
|
*
|
|
8293
8293
|
* @example
|
|
8294
8294
|
* ```tsx
|
|
8295
|
-
* import { useContract, usePublicClient } from 'signer-
|
|
8295
|
+
* import { useContract, usePublicClient } from '@abstraxn/signer-react';
|
|
8296
8296
|
* import { polygonAmoy } from 'viem/chains';
|
|
8297
8297
|
* import erc20Abi from './erc20Abi.json';
|
|
8298
8298
|
*
|
|
@@ -8366,14 +8366,14 @@ export declare function usePrepareRawTxn(provider: PublicClient): {
|
|
|
8366
8366
|
prepareRawTxn: ({ from, to, value, data, abi, functionName, args, }: {
|
|
8367
8367
|
from: Address;
|
|
8368
8368
|
to: Address;
|
|
8369
|
-
value?: string | number;
|
|
8369
|
+
value?: string | number | bigint;
|
|
8370
8370
|
data?: `0x${string}`;
|
|
8371
8371
|
abi?: Abi;
|
|
8372
8372
|
functionName?: string;
|
|
8373
8373
|
args?: any[];
|
|
8374
8374
|
}) => Promise<{
|
|
8375
8375
|
to: Address;
|
|
8376
|
-
value:
|
|
8376
|
+
value: string | bigint;
|
|
8377
8377
|
data: `0x${string}`;
|
|
8378
8378
|
}>;
|
|
8379
8379
|
};
|
|
@@ -8390,28 +8390,34 @@ export declare function usePrepareRawTxn(provider: PublicClient): {
|
|
|
8390
8390
|
* const { signTxn } = useSignTxn(publicClient);
|
|
8391
8391
|
*
|
|
8392
8392
|
* // Prepare transaction
|
|
8393
|
-
* const rawTx = await prepareRawTxn({
|
|
8394
|
-
*
|
|
8395
|
-
*
|
|
8396
|
-
*
|
|
8397
|
-
*
|
|
8398
|
-
*
|
|
8399
|
-
* // Sign transaction
|
|
8393
|
+
* const rawTx = await prepareRawTxn({ from: address!, to: '0x...', value: '0.001' });
|
|
8394
|
+
* const { estimateGas } = useEstimateGas(publicClient);
|
|
8395
|
+
* const { getGasPrice } = useGetGasPrice(publicClient);
|
|
8396
|
+
* const { gasLimit } = await estimateGas({ account: address!, to: rawTx.to, data: rawTx.data, value: rawTx.value });
|
|
8397
|
+
* const fees = await getGasPrice();
|
|
8400
8398
|
* const signedTx = await signTxn({
|
|
8401
8399
|
* from: address!,
|
|
8402
|
-
* ...rawTx,
|
|
8400
|
+
* ...rawTx,
|
|
8401
|
+
* gas: { gasLimit, maxFeePerGas: fees.maxFeePerGas!, maxPriorityFeePerGas: fees.maxPriorityFeePerGas! },
|
|
8403
8402
|
* });
|
|
8404
8403
|
* ```
|
|
8405
8404
|
*/
|
|
8406
8405
|
export declare function useSignTxn(provider: PublicClient): {
|
|
8407
|
-
signTxn: ({ from, to, value, data, chainId, }: {
|
|
8406
|
+
signTxn: ({ from, to, value, data, chainId, gas, }: {
|
|
8408
8407
|
from: Address;
|
|
8409
8408
|
to: Address;
|
|
8410
|
-
value:
|
|
8409
|
+
value: string | bigint;
|
|
8411
8410
|
data: `0x${string}`;
|
|
8412
8411
|
chainId?: number;
|
|
8412
|
+
/** Gas: optionally pass gasLimit + (maxFeePerGas & maxPriorityFeePerGas for EIP-1559) or (gasPrice for legacy). */
|
|
8413
|
+
gas?: {
|
|
8414
|
+
gasLimit?: bigint;
|
|
8415
|
+
gasPrice?: bigint;
|
|
8416
|
+
maxFeePerGas?: bigint;
|
|
8417
|
+
maxPriorityFeePerGas?: bigint;
|
|
8418
|
+
};
|
|
8413
8419
|
}) => Promise<{
|
|
8414
|
-
unsignedTransaction: `0x02${string}
|
|
8420
|
+
unsignedTransaction: `0x02${string}` | `0x01${string}` | `0x03${string}` | `0x04${string}` | import("viem").TransactionSerializedLegacy;
|
|
8415
8421
|
signedTransaction: string;
|
|
8416
8422
|
}>;
|
|
8417
8423
|
isConnected: boolean;
|
|
@@ -8430,31 +8436,36 @@ export declare function useSignTxn(provider: PublicClient): {
|
|
|
8430
8436
|
* const { signAndSendTxn } = useSignAndSendTxn(publicClient);
|
|
8431
8437
|
*
|
|
8432
8438
|
* // Prepare transaction
|
|
8433
|
-
* const rawTx = await prepareRawTxn({
|
|
8434
|
-
*
|
|
8435
|
-
*
|
|
8436
|
-
*
|
|
8437
|
-
*
|
|
8438
|
-
*
|
|
8439
|
-
* // Sign and send transaction
|
|
8439
|
+
* const rawTx = await prepareRawTxn({ from: address!, to: '0x...', value: '0.001' });
|
|
8440
|
+
* const { estimateGas } = useEstimateGas(publicClient);
|
|
8441
|
+
* const { getGasPrice } = useGetGasPrice(publicClient);
|
|
8442
|
+
* const { gasLimit } = await estimateGas({ account: address!, to: rawTx.to, data: rawTx.data, value: rawTx.value });
|
|
8443
|
+
* const fees = await getGasPrice();
|
|
8440
8444
|
* const result = await signAndSendTxn({
|
|
8441
8445
|
* from: address!,
|
|
8442
|
-
* ...rawTx,
|
|
8446
|
+
* ...rawTx,
|
|
8447
|
+
* gas: { gasLimit, maxFeePerGas: fees.maxFeePerGas!, maxPriorityFeePerGas: fees.maxPriorityFeePerGas! },
|
|
8443
8448
|
* });
|
|
8444
|
-
*
|
|
8445
8449
|
* console.log('Transaction hash:', result.hash);
|
|
8446
8450
|
* ```
|
|
8447
8451
|
*/
|
|
8448
8452
|
export declare function useSignAndSendTxn(provider: PublicClient): {
|
|
8449
|
-
signAndSendTxn: ({ from, to, value, data, chainId, }: {
|
|
8453
|
+
signAndSendTxn: ({ from, to, value, data, chainId, gas, }: {
|
|
8450
8454
|
from: Address;
|
|
8451
8455
|
to: Address;
|
|
8452
|
-
value:
|
|
8456
|
+
value: string | bigint;
|
|
8453
8457
|
data: `0x${string}`;
|
|
8454
8458
|
chainId?: number;
|
|
8459
|
+
/** Gas: optionally pass gasLimit + (maxFeePerGas & maxPriorityFeePerGas for EIP-1559) or (gasPrice for legacy). */
|
|
8460
|
+
gas?: {
|
|
8461
|
+
gasLimit?: bigint;
|
|
8462
|
+
gasPrice?: bigint;
|
|
8463
|
+
maxFeePerGas?: bigint;
|
|
8464
|
+
maxPriorityFeePerGas?: bigint;
|
|
8465
|
+
};
|
|
8455
8466
|
}) => Promise<{
|
|
8456
8467
|
hash: `0x${string}`;
|
|
8457
|
-
unsignedTransaction: `0x02${string}
|
|
8468
|
+
unsignedTransaction: `0x02${string}` | `0x01${string}` | `0x03${string}` | `0x04${string}` | import("viem").TransactionSerializedLegacy;
|
|
8458
8469
|
signedTransaction: string;
|
|
8459
8470
|
}>;
|
|
8460
8471
|
isConnected: boolean;
|
|
@@ -8494,6 +8505,58 @@ export declare function useWaitForTxnReceipt(provider: PublicClient): {
|
|
|
8494
8505
|
timeout?: number;
|
|
8495
8506
|
}) => Promise<TransactionReceipt>;
|
|
8496
8507
|
};
|
|
8508
|
+
/**
|
|
8509
|
+
* Hook to estimate gas for a transaction
|
|
8510
|
+
* Returns gasLimit to pass as gas.gasLimit to useSignTxn / useSignAndSendTxn (use useGetGasPrice for fees; no estimation inside those hooks).
|
|
8511
|
+
*
|
|
8512
|
+
* @param provider - PublicClient instance (can be created using usePublicClient hook)
|
|
8513
|
+
* @returns Object with estimateGas function
|
|
8514
|
+
*
|
|
8515
|
+
* @example
|
|
8516
|
+
* ```tsx
|
|
8517
|
+
* const { estimateGas } = useEstimateGas(publicClient);
|
|
8518
|
+
* const result = await estimateGas({
|
|
8519
|
+
* account: address!,
|
|
8520
|
+
* to: rawTx.to,
|
|
8521
|
+
* data: rawTx.data,
|
|
8522
|
+
* value: rawTx.value,
|
|
8523
|
+
* });
|
|
8524
|
+
* // gas: { gasLimit: result.gasLimit }
|
|
8525
|
+
* ```
|
|
8526
|
+
*/
|
|
8527
|
+
export declare function useEstimateGas(provider: PublicClient): {
|
|
8528
|
+
estimateGas: ({ account, to, data, value, }: {
|
|
8529
|
+
account: Address;
|
|
8530
|
+
to: Address;
|
|
8531
|
+
data?: `0x${string}`;
|
|
8532
|
+
value?: string | bigint;
|
|
8533
|
+
}) => Promise<{
|
|
8534
|
+
gasLimit: bigint;
|
|
8535
|
+
}>;
|
|
8536
|
+
};
|
|
8537
|
+
/**
|
|
8538
|
+
* Hook to get current gas price / EIP-1559 fees from the chain.
|
|
8539
|
+
* Use with useEstimateGas when you need gas limit and gas price for the gas param in useSignTxn / useSignAndSendTxn.
|
|
8540
|
+
*
|
|
8541
|
+
* @param provider - PublicClient instance (can be created using usePublicClient hook)
|
|
8542
|
+
* @returns Object with getGasPrice function returning maxFeePerGas, maxPriorityFeePerGas, and/or gasPrice
|
|
8543
|
+
*
|
|
8544
|
+
* @example
|
|
8545
|
+
* ```tsx
|
|
8546
|
+
* const { publicClient } = usePublicClient(...);
|
|
8547
|
+
* const { getGasPrice } = useGetGasPrice(publicClient);
|
|
8548
|
+
* const fees = await getGasPrice();
|
|
8549
|
+
* // EIP-1559: gas: { gasLimit, maxFeePerGas: fees.maxFeePerGas!, maxPriorityFeePerGas: fees.maxPriorityFeePerGas! }
|
|
8550
|
+
* // Legacy: gas: { gasLimit, gasPrice: fees.gasPrice! }
|
|
8551
|
+
* ```
|
|
8552
|
+
*/
|
|
8553
|
+
export declare function useGetGasPrice(provider: PublicClient): {
|
|
8554
|
+
getGasPrice: () => Promise<{
|
|
8555
|
+
gasPrice?: bigint;
|
|
8556
|
+
maxFeePerGas?: bigint;
|
|
8557
|
+
maxPriorityFeePerGas?: bigint;
|
|
8558
|
+
}>;
|
|
8559
|
+
};
|
|
8497
8560
|
/**
|
|
8498
8561
|
* Hook to read from contract
|
|
8499
8562
|
* Reads contract data using publicClient.readContract
|
|
@@ -8540,7 +8603,7 @@ export declare function useReadContract(provider: PublicClient): {
|
|
|
8540
8603
|
*
|
|
8541
8604
|
* @example
|
|
8542
8605
|
* ```tsx
|
|
8543
|
-
* import { useExternalWalletClient } from 'signer-
|
|
8606
|
+
* import { useExternalWalletClient } from '@abstraxn/signer-react';
|
|
8544
8607
|
*
|
|
8545
8608
|
* function MyComponent() {
|
|
8546
8609
|
* const { walletClient, isConnected } = useExternalWalletClient();
|
|
@@ -12999,7 +13062,7 @@ export declare function useExternalWalletClient(): {
|
|
|
12999
13062
|
*
|
|
13000
13063
|
* @example
|
|
13001
13064
|
* ```tsx
|
|
13002
|
-
* import { useWriteContract } from 'signer-
|
|
13065
|
+
* import { useWriteContract } from '@abstraxn/signer-react';
|
|
13003
13066
|
* import erc20Abi from './erc20Abi.json';
|
|
13004
13067
|
*
|
|
13005
13068
|
* function MyComponent() {
|
|
@@ -13036,7 +13099,7 @@ export declare function useExternalWalletClient(): {
|
|
|
13036
13099
|
* ```
|
|
13037
13100
|
*/
|
|
13038
13101
|
export declare function useWriteContract(): {
|
|
13039
|
-
writeContract: <TAbi extends Abi>({ address, abi, functionName, args, value, account, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, }: {
|
|
13102
|
+
writeContract: <TAbi extends Abi>({ address, abi, functionName, args, value, account, gas, gasLimit, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, }: {
|
|
13040
13103
|
address: Address;
|
|
13041
13104
|
abi: TAbi;
|
|
13042
13105
|
functionName: string;
|
|
@@ -13044,6 +13107,11 @@ export declare function useWriteContract(): {
|
|
|
13044
13107
|
value?: bigint;
|
|
13045
13108
|
account?: Address;
|
|
13046
13109
|
gas?: bigint;
|
|
13110
|
+
/**
|
|
13111
|
+
* Optional gas limit override. This is equivalent to viem's `gas` option.
|
|
13112
|
+
* If both `gas` and `gasLimit` are provided, `gas` takes precedence.
|
|
13113
|
+
*/
|
|
13114
|
+
gasLimit?: bigint;
|
|
13047
13115
|
gasPrice?: bigint;
|
|
13048
13116
|
maxFeePerGas?: bigint;
|
|
13049
13117
|
maxPriorityFeePerGas?: bigint;
|
|
@@ -13059,7 +13127,7 @@ export declare function useWriteContract(): {
|
|
|
13059
13127
|
*
|
|
13060
13128
|
* @example
|
|
13061
13129
|
* ```tsx
|
|
13062
|
-
* import { useConnectionType } from 'signer-
|
|
13130
|
+
* import { useConnectionType } from '@abstraxn/signer-react';
|
|
13063
13131
|
*
|
|
13064
13132
|
* function MyComponent() {
|
|
13065
13133
|
* const { connectionType, connectorMeta } = useConnectionType();
|