@agg-build/hooks 4.26.1 → 4.27.3
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/deposit.d.mts +142 -138
- package/dist/deposit.d.mts.map +1 -0
- package/dist/deposit.d.ts +142 -138
- package/dist/deposit.d.ts.map +1 -0
- package/dist/deposit.js +751 -2414
- package/dist/deposit.mjs +744 -727
- package/dist/deposit.mjs.map +1 -0
- package/dist/index-CbNR3EIA.d.mts +341 -0
- package/dist/index-CbNR3EIA.d.mts.map +1 -0
- package/dist/index-CsP1jRMD.d.ts +341 -0
- package/dist/index-CsP1jRMD.d.ts.map +1 -0
- package/dist/index-D0fXU85a.d.mts +743 -0
- package/dist/index-D0fXU85a.d.mts.map +1 -0
- package/dist/index-D0fXU85a.d.ts +743 -0
- package/dist/index-D0fXU85a.d.ts.map +1 -0
- package/dist/index.d.mts +6458 -7515
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +6458 -7515
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7451 -11417
- package/dist/index.mjs +7154 -5221
- package/dist/index.mjs.map +1 -0
- package/dist/use-ramp-session-7RAG9tvY.js +30 -0
- package/dist/use-ramp-session-BFWHCtuc.mjs +21 -0
- package/dist/use-ramp-session-BFWHCtuc.mjs.map +1 -0
- package/dist/use-sync-balances-BkcqInJh.mjs +1779 -0
- package/dist/use-sync-balances-BkcqInJh.mjs.map +1 -0
- package/dist/{use-sync-balances-CeD8qZWP.d.ts → use-sync-balances-CVEg__2V.d.mts} +7 -8
- package/dist/use-sync-balances-CVEg__2V.d.mts.map +1 -0
- package/dist/{use-sync-balances-CeD8qZWP.d.mts → use-sync-balances-CVEg__2V.d.ts} +7 -8
- package/dist/use-sync-balances-CVEg__2V.d.ts.map +1 -0
- package/dist/use-sync-balances-HryB8Q7F.js +1974 -0
- package/dist/withdraw--f5kYKJA.mjs +1474 -0
- package/dist/withdraw--f5kYKJA.mjs.map +1 -0
- package/dist/withdraw-BXWZYmJa.js +1591 -0
- package/dist/withdraw.d.mts +3 -351
- package/dist/withdraw.d.ts +3 -351
- package/dist/withdraw.js +10 -2229
- package/dist/withdraw.mjs +3 -20
- package/package.json +7 -6
- package/dist/chunk-JFJNW2PD.mjs +0 -5649
- package/dist/chunk-LNIAMJTZ.mjs +0 -505
- package/dist/chunk-OZQ3K47U.mjs +0 -31
- package/dist/use-deposit-addresses-B9ICS-3U.d.mts +0 -236
- package/dist/use-deposit-addresses-B9ICS-3U.d.ts +0 -236
package/dist/deposit.d.mts
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '@agg-build/sdk';
|
|
5
|
-
|
|
1
|
+
import { g as UseDepositAddressesOptions, v as useDepositAddresses } from "./index-D0fXU85a.mjs";
|
|
2
|
+
import { n as useSyncBalances, t as UseSyncBalancesOptions } from "./use-sync-balances-CVEg__2V.mjs";
|
|
3
|
+
//#region src/deposit/normalize-wallet-error.d.ts
|
|
6
4
|
type SupportedChain = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
chainId: number;
|
|
6
|
+
name: string;
|
|
7
|
+
tokens: Array<{
|
|
8
|
+
symbol: string;
|
|
9
|
+
address: string;
|
|
10
|
+
decimals: number;
|
|
11
|
+
}>;
|
|
14
12
|
};
|
|
15
|
-
declare function normalizeWalletError(error: unknown, supportedChains: SupportedChain[] | undefined): {
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
export declare function normalizeWalletError(error: unknown, supportedChains: SupportedChain[] | undefined): {
|
|
14
|
+
message: string;
|
|
15
|
+
tone: "warning" | "error";
|
|
18
16
|
};
|
|
19
|
-
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/deposit/use-wallet-token-balance.d.ts
|
|
20
19
|
interface UseWalletTokenBalanceParams {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
isOpen?: boolean;
|
|
21
|
+
chainId: number | undefined;
|
|
22
|
+
tokenAddress: string | undefined;
|
|
23
|
+
decimals: number | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Explicit Solana wallet address (base58) fallback — used when the
|
|
26
|
+
* wallet-adapter and Phantom injected provider haven't hydrated yet.
|
|
27
|
+
*/
|
|
28
|
+
svmAddress?: string;
|
|
30
29
|
}
|
|
31
30
|
interface UseWalletTokenBalanceResult {
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
balance: number;
|
|
32
|
+
isLoading: boolean;
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
35
|
* Reads the connected wallet's on-chain balance for a given token on a given chain.
|
|
37
36
|
* Dispatches to wagmi (EVM) or @solana/web3.js (SVM) based on chainId.
|
|
38
37
|
*/
|
|
39
|
-
declare function useWalletTokenBalance({ isOpen, chainId, tokenAddress, decimals, svmAddress
|
|
40
|
-
|
|
38
|
+
export declare function useWalletTokenBalance({ isOpen, chainId, tokenAddress, decimals, svmAddress }: UseWalletTokenBalanceParams): UseWalletTokenBalanceResult;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/deposit/use-wallet-send-token.d.ts
|
|
41
41
|
interface UseWalletSendTokenParams {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
chainId: number;
|
|
43
|
+
token: {
|
|
44
|
+
symbol: string;
|
|
45
|
+
address?: string;
|
|
46
|
+
decimals: number;
|
|
47
|
+
};
|
|
48
|
+
to: string;
|
|
49
|
+
amount: string;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Dual-chain sendToken implementation:
|
|
@@ -56,42 +56,44 @@ interface UseWalletSendTokenParams {
|
|
|
56
56
|
* Matches the `WalletActions.sendToken` signature so it can be passed into
|
|
57
57
|
* `AggProvider` config directly, or composed inside `useDepositFlow`.
|
|
58
58
|
*/
|
|
59
|
-
declare function useWalletSendToken(): (params: UseWalletSendTokenParams) => Promise<{
|
|
60
|
-
|
|
59
|
+
export declare function useWalletSendToken(): (params: UseWalletSendTokenParams) => Promise<{
|
|
60
|
+
txId: string;
|
|
61
61
|
}>;
|
|
62
|
-
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/deposit/use-wallet-transaction-status.d.ts
|
|
63
64
|
type WalletTransactionStatus = "submitted" | "confirming" | "settled" | "error";
|
|
64
65
|
interface UseWalletTransactionStatusParams {
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
chainId: number | undefined;
|
|
67
|
+
txId: string | null;
|
|
67
68
|
}
|
|
68
69
|
interface UseWalletTransactionStatusResult {
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
status: WalletTransactionStatus | null;
|
|
71
|
+
gasFee: string;
|
|
71
72
|
}
|
|
72
|
-
declare function useWalletTransactionStatus({ chainId, txId
|
|
73
|
-
|
|
73
|
+
export declare function useWalletTransactionStatus({ chainId, txId }: UseWalletTransactionStatusParams): UseWalletTransactionStatusResult;
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/deposit/use-deposit-flow.d.ts
|
|
74
76
|
type CardProviderOption = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
quote: string;
|
|
80
|
+
fee: string;
|
|
81
|
+
badge?: "best" | "low-kyc";
|
|
80
82
|
};
|
|
81
83
|
type CardPurchaseSummary = {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
amountReceived: string;
|
|
85
|
+
network: string;
|
|
86
|
+
fees: string;
|
|
85
87
|
};
|
|
86
88
|
type WalletDepositConfirmParams = {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
address: string;
|
|
90
|
+
amount: string;
|
|
91
|
+
chainId: number;
|
|
92
|
+
token: string;
|
|
91
93
|
};
|
|
92
94
|
type DepositSelectOption = {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
value: string;
|
|
96
|
+
label: string;
|
|
95
97
|
};
|
|
96
98
|
/**
|
|
97
99
|
* Subset of `DepositModalProps` populated by {@link useDepositFlow}. Callers
|
|
@@ -100,81 +102,81 @@ type DepositSelectOption = {
|
|
|
100
102
|
* doesn't take a build-time dependency on `@agg-build/ui`.
|
|
101
103
|
*/
|
|
102
104
|
interface UseDepositFlowResult {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
onWalletAmountChange: (amount: string) => void;
|
|
122
|
-
onWalletMax: () => void;
|
|
123
|
-
onConfirmWalletDeposit: (params: WalletDepositConfirmParams) => Promise<void>;
|
|
124
|
-
/**
|
|
125
|
-
* Clears any in-flight wallet-transaction state so the deposit modal can
|
|
126
|
-
* return the user to the wallet form. Called from the processing step's
|
|
127
|
-
* Cancel affordance when a wallet popup was dismissed silently or a
|
|
128
|
-
* broadcast tx was canceled/replaced without a clean error.
|
|
129
|
-
*/
|
|
130
|
-
onCancelWalletDeposit: () => void;
|
|
131
|
-
onWalletNetworkChange: (chainId: string) => void;
|
|
132
|
-
onWalletTokenChange: (tokenSymbol: string) => void;
|
|
133
|
-
initialWalletChainId: string | undefined;
|
|
134
|
-
/** External wallet kind, when only one is connected. Lets the modal filter
|
|
135
|
-
* wallet-flow network options to chains compatible with that wallet.
|
|
136
|
-
* `undefined` when neither or both are connected — modal shows all chains. */
|
|
137
|
-
connectedWalletKind?: "evm" | "solana";
|
|
138
|
-
sendCryptoConfig: {
|
|
139
|
-
minDeposit: string;
|
|
140
|
-
eta: string;
|
|
141
|
-
};
|
|
142
|
-
onDoneSendCrypto: () => void;
|
|
143
|
-
cardFlow: {
|
|
144
|
-
amount: string;
|
|
145
|
-
currency: string;
|
|
146
|
-
tokenOptions: DepositSelectOption[];
|
|
147
|
-
selectedToken: string;
|
|
148
|
-
selectedNetwork: string;
|
|
149
|
-
providers: CardProviderOption[];
|
|
150
|
-
purchaseSummary: CardPurchaseSummary;
|
|
151
|
-
minAmount: number;
|
|
105
|
+
open: boolean;
|
|
106
|
+
onOpenChange: (open: boolean) => void;
|
|
107
|
+
pendingCardPurchaseSummary: CardPurchaseSummary | null;
|
|
108
|
+
walletFlow: {
|
|
109
|
+
balance: number;
|
|
110
|
+
walletLabel: string;
|
|
111
|
+
walletBalance: number;
|
|
112
|
+
isWalletBalanceLoading: boolean;
|
|
113
|
+
amount: string;
|
|
114
|
+
formErrorMessage?: string;
|
|
115
|
+
formErrorTone: "warning" | "error";
|
|
116
|
+
transactionStatus: WalletTransactionStatus | undefined;
|
|
117
|
+
transactionErrorMessage?: string;
|
|
118
|
+
successSummary: {
|
|
119
|
+
fromWallet: string;
|
|
120
|
+
gasFee: string;
|
|
152
121
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
122
|
+
};
|
|
123
|
+
onWalletAmountChange: (amount: string) => void;
|
|
124
|
+
onWalletMax: () => void;
|
|
125
|
+
onConfirmWalletDeposit: (params: WalletDepositConfirmParams) => Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Clears any in-flight wallet-transaction state so the deposit modal can
|
|
128
|
+
* return the user to the wallet form. Called from the processing step's
|
|
129
|
+
* Cancel affordance when a wallet popup was dismissed silently or a
|
|
130
|
+
* broadcast tx was canceled/replaced without a clean error.
|
|
131
|
+
*/
|
|
132
|
+
onCancelWalletDeposit: () => void;
|
|
133
|
+
onWalletNetworkChange: (chainId: string) => void;
|
|
134
|
+
onWalletTokenChange: (tokenSymbol: string) => void;
|
|
135
|
+
initialWalletChainId: string | undefined;
|
|
136
|
+
/** External wallet kind, when only one is connected. Lets the modal filter
|
|
137
|
+
* wallet-flow network options to chains compatible with that wallet.
|
|
138
|
+
* `undefined` when neither or both are connected — modal shows all chains. */
|
|
139
|
+
connectedWalletKind?: "evm" | "solana";
|
|
140
|
+
sendCryptoConfig: {
|
|
141
|
+
minDeposit: string;
|
|
142
|
+
eta: string;
|
|
143
|
+
};
|
|
144
|
+
onDoneSendCrypto: () => void;
|
|
145
|
+
cardFlow: {
|
|
146
|
+
amount: string;
|
|
147
|
+
currency: string;
|
|
148
|
+
tokenOptions: DepositSelectOption[];
|
|
149
|
+
selectedToken: string;
|
|
150
|
+
selectedNetwork: string;
|
|
151
|
+
providers: CardProviderOption[];
|
|
152
|
+
purchaseSummary: CardPurchaseSummary;
|
|
153
|
+
minAmount: number;
|
|
154
|
+
};
|
|
155
|
+
onCardAmountChange: (amount: string) => void;
|
|
156
|
+
onCardNetworkChange: (network: string) => void;
|
|
157
|
+
onDoneCardPurchase: () => void;
|
|
158
|
+
cardRedirectUrl: string | undefined;
|
|
159
|
+
onGetCardQuotes: (params: {
|
|
160
|
+
sourceAmount: string;
|
|
161
|
+
sourceCurrencyCode: string;
|
|
162
|
+
destinationCurrencyCode: string;
|
|
163
|
+
}) => Promise<CardProviderOption[]>;
|
|
164
|
+
onCreateCardSession: (params: {
|
|
165
|
+
serviceProvider: string;
|
|
166
|
+
sourceAmount: string;
|
|
167
|
+
sourceCurrencyCode: string;
|
|
168
|
+
destinationCurrencyCode: string;
|
|
169
|
+
walletAddress: string;
|
|
170
|
+
redirectUrl?: string;
|
|
171
|
+
}) => Promise<{
|
|
172
|
+
id: string;
|
|
173
|
+
widgetUrl: string;
|
|
174
|
+
serviceProviderWidgetUrl: string;
|
|
175
|
+
}>;
|
|
174
176
|
}
|
|
175
177
|
interface UseDepositFlowOptions {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
open: boolean;
|
|
179
|
+
onOpenChange: (open: boolean) => void;
|
|
178
180
|
}
|
|
179
181
|
/**
|
|
180
182
|
* Orchestrator hook that encapsulates all wallet + card deposit state and
|
|
@@ -183,13 +185,15 @@ interface UseDepositFlowOptions {
|
|
|
183
185
|
*
|
|
184
186
|
* Requires wagmi + @solana/wallet-adapter-react providers in the React tree.
|
|
185
187
|
*/
|
|
186
|
-
declare function useDepositFlow(options: UseDepositFlowOptions): UseDepositFlowResult;
|
|
187
|
-
|
|
188
|
+
export declare function useDepositFlow(options: UseDepositFlowOptions): UseDepositFlowResult;
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/deposit/constants.d.ts
|
|
188
191
|
/**
|
|
189
192
|
* Back-compat alias for callers that still want a single default endpoint.
|
|
190
193
|
* New code should prefer the full list and the failover helper.
|
|
191
194
|
*/
|
|
192
|
-
declare const DEFAULT_SOLANA_RPC_ENDPOINT = "https://solana-rpc.publicnode.com";
|
|
193
|
-
declare const SVM_CHAIN_IDS: ReadonlySet<number>;
|
|
194
|
-
|
|
195
|
-
export {
|
|
195
|
+
export declare const DEFAULT_SOLANA_RPC_ENDPOINT = "https://solana-rpc.publicnode.com";
|
|
196
|
+
export declare const SVM_CHAIN_IDS: ReadonlySet<number>;
|
|
197
|
+
//#endregion
|
|
198
|
+
export { type UseDepositAddressesOptions, type UseDepositFlowOptions, type UseDepositFlowResult, type UseSyncBalancesOptions, type UseWalletSendTokenParams, type UseWalletTokenBalanceParams, type UseWalletTokenBalanceResult, type UseWalletTransactionStatusParams, type UseWalletTransactionStatusResult, type WalletTransactionStatus, useDepositAddresses, useSyncBalances };
|
|
199
|
+
//# sourceMappingURL=deposit.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deposit.d.mts","names":[],"sources":["../src/deposit/normalize-wallet-error.ts","../src/deposit/use-wallet-token-balance.ts","../src/deposit/use-wallet-send-token.ts","../src/deposit/use-wallet-transaction-status.ts","../src/deposit/use-deposit-flow.ts","../src/deposit/constants.ts"],"mappings":";;;KAAK;EACH;EACA;EACA,QAAQ;IAAQ;IAAgB;IAAiB;;;wBAGnC,qBACd,gBACA,iBAAiB;EACd;EAAiB;;;;UCSL;EACf;EACA;EACA;EACA;;;;;EAKA;;UAGe;EACf;EACA;;;;;;wBAqEc,wBACd,QACA,SACA,cACA,UACA,cACC,8BAA8B;;;UC/DhB;EACf;EACA;IAAS;IAAgB;IAAkB;;EAC3C;EACA;;;;;;;;;;wBAWc,uBACd,QAAQ,6BACL;EAAU;;;;KCvDH;UAEK;EACf;EACA;;UAGe;EACf,QAAQ;EACR;;wBAGc,6BACd,SACA,QACC,mCAAmC;;;KCIjC;EACH;EACA;EACA;EACA;EACA;;KAGG;EACH;EACA;EACA;;KAGG;EACH;EACA;EACA;EACA;;KAGG;EAAwB;EAAe;;;;;;;;UAQ3B;EACf;EACA,eAAe;EACf,4BAA4B;EAC5B;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA,mBAAmB;IACnB;IACA;MACE;MACA;;;EAGJ,uBAAuB;EACvB;EACA,yBAAyB,QAAQ,+BAA+B;;;;;;;EAOhE;EACA,wBAAwB;EACxB,sBAAsB;EACtB;;;;EAIA;EACA;IAAoB;IAAoB;;EACxC;EACA;IACE;IACA;IACA,cAAc;IACd;IACA;IACA,WAAW;IACX,iBAAiB;IACjB;;EAEF,qBAAqB;EACrB,sBAAsB;EACtB;EACA;EACA,kBAAkB;IAChB;IACA;IACA;QACI,QAAQ;EACd,sBAAsB;IACpB;IACA;IACA;IACA;IACA;IACA;QACI;IAAU;IAAY;IAAmB;;;UAGhC;EACf;EACA,eAAe;;;;;;;;;wBAUD,eAAe,SAAS,wBAAwB;;;;;;;qBCnHnD;qBAEA,eAAe"}
|