@unlink-xyz/react 0.1.3-canary.f8763d3 → 0.1.3-canary.fd96273
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/index.d.ts +20 -17
- package/dist/index.js +473 -263
- package/dist/index.js.map +1 -1
- package/dist/multisig/index.d.ts +106 -0
- package/dist/multisig/index.js +31353 -0
- package/dist/multisig/index.js.map +1 -0
- package/package.json +12 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { BrowserWalletOptions, SupportedChain, UnlinkWallet, AccountInfo, Account, NoteRecord, BurnerAccount, HistoryStatus, TransferResult, TransferPlanResult, DepositRelayResult, WithdrawalInput, WithdrawResult, WithdrawPlanResult, BurnerSendParams, SimpleBurnerFundParams, SimpleBurnerSweepToPoolParams, SimpleAdapterExecuteParams, AdapterExecuteResult, RelayState, HistoryEntry } from '@unlink-xyz/core';
|
|
4
|
-
export { Account, AccountInfo, AdapterExecuteResult, AdapterExecutionCall, BurnerAccount, BurnerSendParams, Chain, HistoryEntry, InputTokenSpec, NoteRecord, ParsedZkAddress, ReshieldInput, SimpleAdapterExecuteParams, SimpleBurnerFundParams, SimpleBurnerSweepToPoolParams, SupportedChain, TransferPlanResult, TransferResult, TxStatusChangedEvent, UnlinkWallet, WalletSDKEvent, WithdrawPlanResult, WithdrawResult, computeBalances, decodeAddress, encodeAddress, formatAmount, normalizeAddress, parseAmount, parseZkAddress, randomHex, shortenHex } from '@unlink-xyz/core';
|
|
3
|
+
import { BrowserWalletOptions, SupportedChain, UnlinkWallet, AccountInfo, Account, NoteRecord, BurnerAccount, HistoryStatus, SignerOverride, TransferResult, TransferPlanResult, DepositRelayResult, WithdrawalInput, WithdrawResult, WithdrawPlanResult, BurnerSendParams, SimpleBurnerFundParams, SimpleBurnerSweepToPoolParams, SimpleAdapterExecuteParams, AdapterExecuteResult, RelayState, HistoryEntry } from '@unlink-xyz/core';
|
|
4
|
+
export { Account, AccountInfo, AdapterExecuteResult, AdapterExecutionCall, BurnerAccount, BurnerSendParams, Chain, HistoryEntry, InputTokenSpec, NoteRecord, ParsedZkAddress, ReceiveInput, ReshieldInput, SignerOverride, SimpleAdapterExecuteParams, SimpleBurnerFundParams, SimpleBurnerSweepToPoolParams, SpendInput, SupportedChain, TransactionLike, TransferPlanResult, TransferResult, TxStatusChangedEvent, UnlinkWallet, WalletSDKEvent, WithdrawPlanResult, WithdrawResult, approve, buildApproveCall, computeBalances, contract, decodeAddress, encodeAddress, formatAmount, normalizeAddress, parseAmount, parseZkAddress, randomHex, shortenHex, toCall } from '@unlink-xyz/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Wallet note with value as bigint for convenience.
|
|
@@ -103,7 +103,7 @@ type UnlinkState = {
|
|
|
103
103
|
*/
|
|
104
104
|
type TransferInput = {
|
|
105
105
|
token: string;
|
|
106
|
-
/** Unlink address (
|
|
106
|
+
/** Unlink address (unlink1... bech32m) */
|
|
107
107
|
recipient: string;
|
|
108
108
|
amount: bigint;
|
|
109
109
|
};
|
|
@@ -145,7 +145,7 @@ type UnlinkActions = {
|
|
|
145
145
|
* @param params - Array of transfers (token + amount + recipient)
|
|
146
146
|
* @returns TransferResult with array of plans
|
|
147
147
|
*/
|
|
148
|
-
send(params: TransferInput[]): Promise<TransferResult>;
|
|
148
|
+
send(params: TransferInput[], overrides?: SignerOverride): Promise<TransferResult>;
|
|
149
149
|
/**
|
|
150
150
|
* Get a transfer plan without executing (for preview).
|
|
151
151
|
* Validates balances and returns plans for each transfer.
|
|
@@ -155,7 +155,7 @@ type UnlinkActions = {
|
|
|
155
155
|
*/
|
|
156
156
|
planTransfer(params: TransferInput[]): Promise<TransferPlanResult>;
|
|
157
157
|
/** Execute a pre-built transfer plan */
|
|
158
|
-
executeTransfer(plans: TransferPlanResult): Promise<TransferResult>;
|
|
158
|
+
executeTransfer(plans: TransferPlanResult, overrides?: SignerOverride): Promise<TransferResult>;
|
|
159
159
|
/**
|
|
160
160
|
* Request a deposit (1 or more tokens).
|
|
161
161
|
* Returns calldata that the user must submit on-chain via their EOA.
|
|
@@ -173,7 +173,7 @@ type UnlinkActions = {
|
|
|
173
173
|
* @param params - Array of withdrawals (token + amount + recipient)
|
|
174
174
|
* @returns WithdrawResult with array of plans
|
|
175
175
|
*/
|
|
176
|
-
requestWithdraw(params: WithdrawInput[]): Promise<WithdrawResult>;
|
|
176
|
+
requestWithdraw(params: WithdrawInput[], overrides?: SignerOverride): Promise<WithdrawResult>;
|
|
177
177
|
/**
|
|
178
178
|
* Get a withdrawal plan without executing (for preview).
|
|
179
179
|
* Validates balances and returns plans for each withdrawal.
|
|
@@ -183,7 +183,7 @@ type UnlinkActions = {
|
|
|
183
183
|
*/
|
|
184
184
|
planWithdraw(params: WithdrawInput[]): Promise<WithdrawPlanResult>;
|
|
185
185
|
/** Execute a pre-built withdrawal plan */
|
|
186
|
-
executeWithdraw(plans: WithdrawPlanResult): Promise<WithdrawResult>;
|
|
186
|
+
executeWithdraw(plans: WithdrawPlanResult, overrides?: SignerOverride): Promise<WithdrawResult>;
|
|
187
187
|
/** Derive and track burner account at index */
|
|
188
188
|
createBurner(index: number): Promise<BurnerAccount>;
|
|
189
189
|
/** Remove tracked burner account (client-side only) */
|
|
@@ -462,8 +462,8 @@ declare function useUnlinkBalances(): {
|
|
|
462
462
|
declare function useTxStatus(txId: string | null): UseTxStatusResult;
|
|
463
463
|
|
|
464
464
|
type UseOperationMutationResult<TInput, TOutput> = {
|
|
465
|
-
/** Execute the
|
|
466
|
-
|
|
465
|
+
/** Execute the operation */
|
|
466
|
+
execute: (input: TInput) => Promise<TOutput>;
|
|
467
467
|
/** Last successful result */
|
|
468
468
|
data: TOutput | null;
|
|
469
469
|
/** Whether the mutation is currently running */
|
|
@@ -487,10 +487,10 @@ type UseOperationMutationResult<TInput, TOutput> = {
|
|
|
487
487
|
* ```tsx
|
|
488
488
|
* function DepositButton() {
|
|
489
489
|
* const { requestDeposit } = useUnlink();
|
|
490
|
-
* const {
|
|
490
|
+
* const { execute, isPending, error } = useOperationMutation(requestDeposit);
|
|
491
491
|
*
|
|
492
492
|
* return (
|
|
493
|
-
* <button onClick={() =>
|
|
493
|
+
* <button onClick={() => execute(params)} disabled={isPending}>
|
|
494
494
|
* {isPending ? "Depositing..." : "Deposit"}
|
|
495
495
|
* </button>
|
|
496
496
|
* );
|
|
@@ -527,6 +527,8 @@ declare function useDeposit(): UseOperationMutationResult<DepositInput[], Deposi
|
|
|
527
527
|
/**
|
|
528
528
|
* Hook for sending private transfers with loading/error state.
|
|
529
529
|
*
|
|
530
|
+
* @param overrides - Optional signer override for multisig transactions
|
|
531
|
+
*
|
|
530
532
|
* @example
|
|
531
533
|
* ```tsx
|
|
532
534
|
* function SendForm() {
|
|
@@ -534,7 +536,7 @@ declare function useDeposit(): UseOperationMutationResult<DepositInput[], Deposi
|
|
|
534
536
|
*
|
|
535
537
|
* const handleSend = async () => {
|
|
536
538
|
* const result = await send([
|
|
537
|
-
* { token: "0x...", recipient: "
|
|
539
|
+
* { token: "0x...", recipient: "unlink1...", amount: 100n },
|
|
538
540
|
* ]);
|
|
539
541
|
* console.log("Relay ID:", result.relayId);
|
|
540
542
|
* };
|
|
@@ -547,11 +549,13 @@ declare function useDeposit(): UseOperationMutationResult<DepositInput[], Deposi
|
|
|
547
549
|
* }
|
|
548
550
|
* ```
|
|
549
551
|
*/
|
|
550
|
-
declare function useTransfer(): UseOperationMutationResult<TransferInput[], TransferResult>;
|
|
552
|
+
declare function useTransfer(overrides?: SignerOverride): UseOperationMutationResult<TransferInput[], TransferResult>;
|
|
551
553
|
|
|
552
554
|
/**
|
|
553
555
|
* Hook for requesting withdrawals with loading/error state.
|
|
554
556
|
*
|
|
557
|
+
* @param overrides - Optional signer override for multisig transactions
|
|
558
|
+
*
|
|
555
559
|
* @example
|
|
556
560
|
* ```tsx
|
|
557
561
|
* function WithdrawForm() {
|
|
@@ -572,7 +576,7 @@ declare function useTransfer(): UseOperationMutationResult<TransferInput[], Tran
|
|
|
572
576
|
* }
|
|
573
577
|
* ```
|
|
574
578
|
*/
|
|
575
|
-
declare function useWithdraw(): UseOperationMutationResult<WithdrawInput[], WithdrawResult>;
|
|
579
|
+
declare function useWithdraw(overrides?: SignerOverride): UseOperationMutationResult<WithdrawInput[], WithdrawResult>;
|
|
576
580
|
|
|
577
581
|
/**
|
|
578
582
|
* Hook for executing private DeFi adapter operations with loading/error state.
|
|
@@ -586,10 +590,9 @@ declare function useWithdraw(): UseOperationMutationResult<WithdrawInput[], With
|
|
|
586
590
|
*
|
|
587
591
|
* const handleSwap = async () => {
|
|
588
592
|
* const result = await executeAdapter({
|
|
589
|
-
*
|
|
590
|
-
* inputs: [{ token: "0x...", amount: 1000n }],
|
|
593
|
+
* spend: [{ token: "0x...", amount: 1000n }],
|
|
591
594
|
* calls: [approveCall, swapCall],
|
|
592
|
-
*
|
|
595
|
+
* receive: [{ token: "0x...", minAmount: 500n }],
|
|
593
596
|
* });
|
|
594
597
|
* console.log("Relay ID:", result.relayId);
|
|
595
598
|
* };
|