@talken/talkenkit 2.7.5-beta.1 → 2.7.5-beta.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.
Files changed (199) hide show
  1. package/dist/AbcCredentialManager-6FBGTSSM.js +7 -0
  2. package/dist/abcWallet-6BIO6Q6T.js +184 -0
  3. package/dist/abcWallet-HKEIJA6T.js +172 -0
  4. package/dist/chunk-CGSOMXYJ.js +5757 -0
  5. package/dist/chunk-PZ4TCLAJ.js +7816 -0
  6. package/dist/chunk-SUYKWM5G.js +451 -0
  7. package/dist/components/ConfirmationModal/NonEvmSignConfirmationModal.d.ts +1 -1
  8. package/dist/components/ConfirmationModal/NonEvmTransferConfirmationModal.d.ts +1 -1
  9. package/dist/components/ConfirmationModal/SignConfirmationModal.d.ts +1 -1
  10. package/dist/components/ConfirmationModal/TransactionConfirmationModal.d.ts +2 -1
  11. package/dist/components/ConfirmationModal/constants.d.ts +0 -4
  12. package/dist/components/RainbowKitProvider/RainbowKitProvider.d.ts +31 -1
  13. package/dist/components/TransactionResultModal/TransactionResultModal.css.d.ts +3 -0
  14. package/dist/components/TransactionResultModal/TransactionResultModal.d.ts +1 -1
  15. package/dist/config/networks.d.ts +2 -1
  16. package/dist/gasless/GaslessConfigSingleton.d.ts +11 -0
  17. package/dist/gasless/api/ChainConfigApi.d.ts +20 -0
  18. package/dist/gasless/api/RelayerApi.d.ts +25 -0
  19. package/dist/gasless/api/TokenCapabilityApi.d.ts +12 -0
  20. package/dist/gasless/config.d.ts +12 -0
  21. package/dist/gasless/hooks/useGaslessTransfer.d.ts +18 -0
  22. package/dist/gasless/index.d.ts +12 -0
  23. package/dist/gasless/services/Eip7702Service.d.ts +80 -0
  24. package/dist/gasless/services/GaslessFeeService.d.ts +55 -0
  25. package/dist/gasless/services/GaslessTransferService.d.ts +61 -0
  26. package/dist/gasless/services/PermitSignService.d.ts +28 -0
  27. package/dist/gasless/signer/AbcWaasSigner.d.ts +27 -0
  28. package/dist/gasless/signer/GaslessSigner.d.ts +43 -0
  29. package/dist/gasless/signer/WagmiSigner.d.ts +63 -0
  30. package/dist/gasless/signer/index.d.ts +4 -0
  31. package/dist/gasless/types.d.ts +298 -0
  32. package/dist/gasless/utils/delegationGuard.d.ts +50 -0
  33. package/dist/gasless/utils/feeTokenResolver.d.ts +35 -0
  34. package/dist/gasless/utils/revokeDelegation.d.ts +55 -0
  35. package/dist/gasless/utils/transferDetector.d.ts +20 -0
  36. package/dist/hooks/internal/abcEmbeddedWallet.d.ts +1 -1
  37. package/dist/hooks/useXrplWallet.d.ts +77 -0
  38. package/dist/index.css +41 -37
  39. package/dist/index.d.ts +9 -4
  40. package/dist/index.js +2499 -1583
  41. package/dist/providers/AbcAuthProvider.d.ts +2 -1
  42. package/dist/providers/SignConfirmationProvider/SignConfirmationProvider.d.ts +1 -1
  43. package/dist/providers/SignConfirmationProvider/SuppressSignConfirmation.d.ts +11 -0
  44. package/dist/providers/SignConfirmationProvider/index.d.ts +2 -1
  45. package/dist/providers/SignConfirmationProvider/types.d.ts +14 -1
  46. package/dist/providers/SignConfirmationProvider/useTransactionResolver.d.ts +2 -1
  47. package/dist/providers/TransactionResultProvider/SuppressTransactionResult.d.ts +11 -0
  48. package/dist/providers/TransactionResultProvider/index.d.ts +1 -0
  49. package/dist/providers/TransactionResultProvider/types.d.ts +8 -1
  50. package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.d.ts +2 -0
  51. package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.js +3 -3
  52. package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.js +6 -6
  53. package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.d.ts +14 -0
  54. package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.js +2 -2
  55. package/dist/wallets/walletConnectors/abcWallet/ProviderError.d.ts +3 -0
  56. package/dist/wallets/walletConnectors/abcWallet/ProviderError.js +5 -3
  57. package/dist/wallets/walletConnectors/abcWallet/StorageService.js +2 -2
  58. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +8 -8
  59. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +6 -6
  60. package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +22 -21
  61. package/dist/wallets/walletConnectors/abcWallet/abcProvider.d.ts +16 -0
  62. package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +10 -10
  63. package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +21 -20
  64. package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +3 -3
  65. package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +6 -6
  66. package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +23 -22
  67. package/dist/wallets/walletConnectors/abcWallet/abcXrplProvider.d.ts +99 -0
  68. package/dist/wallets/walletConnectors/abcWallet/abcXrplProvider.js +19 -0
  69. package/dist/wallets/walletConnectors/abcWallet/api/ConfigApi.js +2 -2
  70. package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.d.ts +3 -0
  71. package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +15 -14
  72. package/dist/wallets/walletConnectors/abcWallet/api/TokenApi.js +2 -2
  73. package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +3 -3
  74. package/dist/wallets/walletConnectors/abcWallet/api/index.js +20 -19
  75. package/dist/wallets/walletConnectors/abcWallet/api/modules/auth.js +5 -5
  76. package/dist/wallets/walletConnectors/abcWallet/api/modules/bitcoin.d.ts +1 -1
  77. package/dist/wallets/walletConnectors/abcWallet/api/modules/bitcoin.js +5 -5
  78. package/dist/wallets/walletConnectors/abcWallet/api/modules/evm.js +4 -4
  79. package/dist/wallets/walletConnectors/abcWallet/api/modules/solana.js +2 -2
  80. package/dist/wallets/walletConnectors/abcWallet/api/modules/tron.js +2 -2
  81. package/dist/wallets/walletConnectors/abcWallet/api/modules/wallet.js +2 -2
  82. package/dist/wallets/walletConnectors/abcWallet/api/modules/walletscan.js +2 -2
  83. package/dist/wallets/walletConnectors/abcWallet/api/modules/xrp.d.ts +85 -0
  84. package/dist/wallets/walletConnectors/abcWallet/api/modules/xrp.js +8 -0
  85. package/dist/wallets/walletConnectors/abcWallet/constants.d.ts +9 -0
  86. package/dist/wallets/walletConnectors/abcWallet/constants.js +1 -1
  87. package/dist/wallets/walletConnectors/abcWallet/index.d.ts +5 -0
  88. package/dist/wallets/walletConnectors/abcWallet/index.js +50 -35
  89. package/dist/wallets/walletConnectors/abcWallet/networkConfig.d.ts +31 -3
  90. package/dist/wallets/walletConnectors/abcWallet/networkConfig.js +11 -3
  91. package/dist/wallets/walletConnectors/abcWallet/sessionUtils.js +3 -3
  92. package/dist/wallets/walletConnectors/abcWallet/types/api.types.d.ts +13 -11
  93. package/dist/wallets/walletConnectors/abcWallet/types/auth.types.d.ts +3 -1
  94. package/dist/wallets/walletConnectors/abcWallet/types/config.types.d.ts +1 -0
  95. package/dist/wallets/walletConnectors/abcWallet/types/config.types.js +1 -1
  96. package/dist/wallets/walletConnectors/abcWallet/types/wallet.types.d.ts +15 -1
  97. package/dist/wallets/walletConnectors/abcWallet/types.js +3 -3
  98. package/dist/wallets/walletConnectors/abcWallet/utils.js +6 -6
  99. package/dist/wallets/walletConnectors/abcWallet/walletGeneration.d.ts +2 -1
  100. package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +8 -8
  101. package/dist/wallets/walletConnectors/chunk-25VIZXJZ.js +341 -0
  102. package/dist/wallets/walletConnectors/chunk-26URNKLZ.js +341 -0
  103. package/dist/wallets/walletConnectors/chunk-2H2JI5BJ.js +108 -0
  104. package/dist/wallets/walletConnectors/chunk-2LH53QET.js +71 -0
  105. package/dist/wallets/walletConnectors/chunk-2LOET2LX.js +64 -0
  106. package/dist/wallets/walletConnectors/chunk-2XNFYA54.js +492 -0
  107. package/dist/wallets/walletConnectors/chunk-326CQ42T.js +378 -0
  108. package/dist/wallets/walletConnectors/chunk-3NWM24MH.js +61 -0
  109. package/dist/wallets/walletConnectors/chunk-3QC567QK.js +94 -0
  110. package/dist/wallets/walletConnectors/chunk-3Z5DO42M.js +240 -0
  111. package/dist/wallets/walletConnectors/chunk-4K2V7RCL.js +96 -0
  112. package/dist/wallets/walletConnectors/chunk-4QNRNDMZ.js +378 -0
  113. package/dist/wallets/walletConnectors/chunk-4V3HRM2R.js +95 -0
  114. package/dist/wallets/walletConnectors/chunk-4Y7YP4IR.js +115 -0
  115. package/dist/wallets/walletConnectors/chunk-5QYCHHVB.js +98 -0
  116. package/dist/wallets/walletConnectors/chunk-6P3FYHAH.js +108 -0
  117. package/dist/wallets/walletConnectors/chunk-76M232IF.js +101 -0
  118. package/dist/wallets/walletConnectors/chunk-7IBMHOYD.js +102 -0
  119. package/dist/wallets/walletConnectors/chunk-ACGSFRMZ.js +73 -0
  120. package/dist/wallets/walletConnectors/chunk-AJ2YNYCD.js +277 -0
  121. package/dist/wallets/walletConnectors/chunk-BOHX6ZNO.js +3030 -0
  122. package/dist/wallets/walletConnectors/chunk-BZPKBSWY.js +66 -0
  123. package/dist/wallets/walletConnectors/chunk-CHEPDEJ2.js +73 -0
  124. package/dist/wallets/walletConnectors/chunk-CMETID7A.js +1463 -0
  125. package/dist/wallets/walletConnectors/chunk-DDRPEB2X.js +366 -0
  126. package/dist/wallets/walletConnectors/chunk-DHWJ3552.js +93 -0
  127. package/dist/wallets/walletConnectors/chunk-DPVILLWF.js +492 -0
  128. package/dist/wallets/walletConnectors/chunk-E4B4UELA.js +3030 -0
  129. package/dist/wallets/walletConnectors/chunk-EJALZNAR.js +101 -0
  130. package/dist/wallets/walletConnectors/chunk-F74FF7OS.js +370 -0
  131. package/dist/wallets/walletConnectors/chunk-FVA6H2VF.js +95 -0
  132. package/dist/wallets/walletConnectors/chunk-FWX2HD26.js +30 -0
  133. package/dist/wallets/walletConnectors/chunk-G7QF44XS.js +378 -0
  134. package/dist/wallets/walletConnectors/chunk-GCHYGJNO.js +131 -0
  135. package/dist/wallets/walletConnectors/chunk-GNF5CHDQ.js +102 -0
  136. package/dist/wallets/walletConnectors/chunk-GZPGNUNF.js +94 -0
  137. package/dist/wallets/walletConnectors/chunk-HALTGRQW.js +87 -0
  138. package/dist/wallets/walletConnectors/chunk-I2LB6GVH.js +341 -0
  139. package/dist/wallets/walletConnectors/chunk-ICGK5DGY.js +146 -0
  140. package/dist/wallets/walletConnectors/chunk-IGZOEVKN.js +58 -0
  141. package/dist/wallets/walletConnectors/chunk-IJJQA3AB.js +218 -0
  142. package/dist/wallets/walletConnectors/chunk-JL3QLDZK.js +186 -0
  143. package/dist/wallets/walletConnectors/chunk-JU6AJBYS.js +20 -0
  144. package/dist/wallets/walletConnectors/chunk-KLCVXROA.js +71 -0
  145. package/dist/wallets/walletConnectors/chunk-KNNHGFKJ.js +98 -0
  146. package/dist/wallets/walletConnectors/chunk-KQDFRZT4.js +65 -0
  147. package/dist/wallets/walletConnectors/chunk-KTVJLN3O.js +58 -0
  148. package/dist/wallets/walletConnectors/chunk-L3EPZ4NZ.js +52 -0
  149. package/dist/wallets/walletConnectors/chunk-LKNK2KKU.js +76 -0
  150. package/dist/wallets/walletConnectors/chunk-LLOSDVCH.js +58 -0
  151. package/dist/wallets/walletConnectors/chunk-LQI5HRAB.js +218 -0
  152. package/dist/wallets/walletConnectors/chunk-LTN4JK3R.js +340 -0
  153. package/dist/wallets/walletConnectors/chunk-MGVZ2TUF.js +318 -0
  154. package/dist/wallets/walletConnectors/chunk-MQ57XDYK.js +340 -0
  155. package/dist/wallets/walletConnectors/chunk-MU46EEQT.js +128 -0
  156. package/dist/wallets/walletConnectors/chunk-MUAOEA3O.js +103 -0
  157. package/dist/wallets/walletConnectors/chunk-MVZX47XV.js +366 -0
  158. package/dist/wallets/walletConnectors/chunk-MWHKTQPO.js +71 -0
  159. package/dist/wallets/walletConnectors/chunk-MY7UE4VE.js +240 -0
  160. package/dist/wallets/walletConnectors/chunk-MYQPTETH.js +186 -0
  161. package/dist/wallets/walletConnectors/chunk-NEMEHJ72.js +93 -0
  162. package/dist/wallets/walletConnectors/chunk-NF72HTDP.js +378 -0
  163. package/dist/wallets/walletConnectors/chunk-NP7RQXKC.js +94 -0
  164. package/dist/wallets/walletConnectors/chunk-OKTFRDOV.js +340 -0
  165. package/dist/wallets/walletConnectors/chunk-PXL5G2PM.js +96 -0
  166. package/dist/wallets/walletConnectors/chunk-QB3QLNSL.js +76 -0
  167. package/dist/wallets/walletConnectors/chunk-QCM7BJYI.js +366 -0
  168. package/dist/wallets/walletConnectors/chunk-QI5BHIHY.js +318 -0
  169. package/dist/wallets/walletConnectors/chunk-QLPGMWGT.js +132 -0
  170. package/dist/wallets/walletConnectors/chunk-QODJUJ3A.js +370 -0
  171. package/dist/wallets/walletConnectors/chunk-QRU6XFHH.js +110 -0
  172. package/dist/wallets/walletConnectors/chunk-RIN5NUVA.js +1463 -0
  173. package/dist/wallets/walletConnectors/chunk-RM3S3BY3.js +58 -0
  174. package/dist/wallets/walletConnectors/chunk-S5XGT2XC.js +131 -0
  175. package/dist/wallets/walletConnectors/chunk-SJ7H7FJB.js +58 -0
  176. package/dist/wallets/walletConnectors/chunk-TA4DDCKN.js +96 -0
  177. package/dist/wallets/walletConnectors/chunk-TBWPVX5M.js +148 -0
  178. package/dist/wallets/walletConnectors/chunk-TLRR3FFT.js +132 -0
  179. package/dist/wallets/walletConnectors/chunk-TM6YD43A.js +341 -0
  180. package/dist/wallets/walletConnectors/chunk-TWVKSPTP.js +91 -0
  181. package/dist/wallets/walletConnectors/chunk-TYJR3KGY.js +46 -0
  182. package/dist/wallets/walletConnectors/chunk-U5UPCM5V.js +66 -0
  183. package/dist/wallets/walletConnectors/chunk-UPQCNBIW.js +341 -0
  184. package/dist/wallets/walletConnectors/chunk-UZAUWE5E.js +27 -0
  185. package/dist/wallets/walletConnectors/chunk-V2C47DTB.js +66 -0
  186. package/dist/wallets/walletConnectors/chunk-VVXSRRXI.js +189 -0
  187. package/dist/wallets/walletConnectors/chunk-WHL6MSKS.js +492 -0
  188. package/dist/wallets/walletConnectors/chunk-WZ4ZJB74.js +340 -0
  189. package/dist/wallets/walletConnectors/chunk-X3DT5G3F.js +215 -0
  190. package/dist/wallets/walletConnectors/chunk-XDNFWX2X.js +199 -0
  191. package/dist/wallets/walletConnectors/chunk-XFUNA24R.js +195 -0
  192. package/dist/wallets/walletConnectors/chunk-XS6GJRRA.js +98 -0
  193. package/dist/wallets/walletConnectors/chunk-XSJUQHR7.js +95 -0
  194. package/dist/wallets/walletConnectors/chunk-XSX5EECZ.js +96 -0
  195. package/dist/wallets/walletConnectors/chunk-YJ5RF7V4.js +492 -0
  196. package/dist/wallets/walletConnectors/chunk-YNE2UX2Z.js +137 -0
  197. package/dist/wallets/walletConnectors/chunk-YXWHHI4S.js +64 -0
  198. package/dist/wallets/walletConnectors/index.js +80 -79
  199. package/package.json +2 -2
@@ -0,0 +1,12 @@
1
+ export type { GaslessMode, FeeToken, FeeEstimate, GaslessConfig, GaslessConfigProviderProps, GaslessTransferParams, GaslessTransferResult, UseGaslessTransferReturn, DetectedErc20Transfer, } from './types';
2
+ export { GaslessConfigProvider, useGaslessConfig, useGaslessEnabled, } from './config';
3
+ export { getGaslessConfig, setGaslessConfig } from './GaslessConfigSingleton';
4
+ export { GaslessFeeService } from './services/GaslessFeeService';
5
+ export { useGaslessTransfer } from './hooks/useGaslessTransfer';
6
+ export { detectErc20Transfer, isGaslessEligible, } from './utils/transferDetector';
7
+ export { checkDelegation, ensureDelegationCleared, type EnsureDelegationClearedOptions, } from './utils/delegationGuard';
8
+ export { type RevokeCapableClient } from './utils/revokeDelegation';
9
+ export type { GaslessSigner, TypedDataPayload } from './signer';
10
+ export { AbcWaasSigner } from './signer';
11
+ export { WagmiSigner } from './signer';
12
+ export type { WagmiWalletClient, WagmiPublicClient } from './signer';
@@ -0,0 +1,80 @@
1
+ import { ChainConfigApi } from '../api/ChainConfigApi';
2
+ import { RelayerApi } from '../api/RelayerApi';
3
+ import type { GaslessSigner, TypedDataPayload } from '../signer/GaslessSigner';
4
+ import type { EIP7702Authorization, EIP7702ExecutionAuth } from '../types';
5
+ import { type EnsureDelegationClearedOptions } from '../utils/delegationGuard';
6
+ /**
7
+ * Handles EIP-7702 authorization signing and delegation management.
8
+ *
9
+ * All signing is delegated to the injected GaslessSigner, making this
10
+ * service wallet-agnostic.
11
+ */
12
+ export declare class Eip7702Service {
13
+ private chainConfigApi;
14
+ private relayerApi;
15
+ private signer;
16
+ constructor(deps: {
17
+ chainConfigApi?: ChainConfigApi;
18
+ relayerApi?: RelayerApi;
19
+ signer: GaslessSigner;
20
+ });
21
+ /**
22
+ * Pre-flight check: detect and wait for stale delegation to clear.
23
+ * If a previous relay's revoke tx is still pending, waits for it
24
+ * to be mined before proceeding (prevents nonce collision).
25
+ */
26
+ preflight(chainKey: string, chainId: number, address: string, options?: EnsureDelegationClearedOptions): Promise<void>;
27
+ /**
28
+ * Sign EIP-7702 delegate authorization.
29
+ *
30
+ * Revoke authorization is intentionally omitted: the server previously
31
+ * broadcast revoke as a separate TX, which caused nonce competition
32
+ * (2-TX pattern). Delegation persists across relays but each new relay
33
+ * overwrites the previous delegate authorization, so this is safe.
34
+ * If the server adds single-TX delegate+revoke support in the future,
35
+ * add revokeAuth signing here (nonce + 1) and include it in the relay
36
+ * request.
37
+ */
38
+ signDelegate(chainKey: string, chainId: number, address: string): Promise<{
39
+ delegateAuth: EIP7702Authorization;
40
+ }>;
41
+ /**
42
+ * Sign the EIP-712 execution typed data for the relay.
43
+ */
44
+ signExecutionTypedData(typedData: TypedDataPayload): Promise<EIP7702ExecutionAuth>;
45
+ /**
46
+ * Get relayer info needed for EIP-7702 execution.
47
+ */
48
+ getRelayerInfo(chainKey: string, address: string): Promise<{
49
+ relayerAddress: string;
50
+ executionNonce: string;
51
+ }>;
52
+ /** Access chain config API */
53
+ getChainConfigApi(): ChainConfigApi;
54
+ }
55
+ /**
56
+ * Build ExecuteBatchWithFee typed data (Tier 2: EIP-7702 + token fee).
57
+ */
58
+ export declare function buildExecuteBatchWithFeeTypedData(params: {
59
+ chainId: number;
60
+ fromAddress: string;
61
+ tokenAddress: string;
62
+ transferCalldata: string;
63
+ executionNonce: string;
64
+ deadline: number;
65
+ relayerAddress: string;
66
+ feeToken: string;
67
+ feeAmount: string;
68
+ }): TypedDataPayload;
69
+ /**
70
+ * Build ExecuteDelegatedSwap typed data (Tier 3: EIP-7702 + points, fee=0).
71
+ */
72
+ export declare function buildExecuteDelegatedSwapTypedData(params: {
73
+ chainId: number;
74
+ fromAddress: string;
75
+ tokenAddress: string;
76
+ transferCalldata: string;
77
+ executionNonce: string;
78
+ deadline: number;
79
+ relayerAddress: string;
80
+ }): TypedDataPayload;
@@ -0,0 +1,55 @@
1
+ import { ChainConfigApi } from '../api/ChainConfigApi';
2
+ import { RelayerApi } from '../api/RelayerApi';
3
+ import { TokenCapabilityApi } from '../api/TokenCapabilityApi';
4
+ import type { FeeEstimate, GaslessConfig } from '../types';
5
+ /**
6
+ * Gasless fee estimation service.
7
+ *
8
+ * Implements the 3-tier fallback matching the Chrome Extension reference:
9
+ * Tier 1 (generic) – EIP-3009 / ERC-2612 permit relay
10
+ * Tier 2 (eip7702-fee) – EIP-7702 delegation + token fee
11
+ * Tier 3 (eip7702-points) – EIP-7702 delegation + reward points
12
+ */
13
+ export declare class GaslessFeeService {
14
+ private relayerApi;
15
+ private tokenCapabilityApi;
16
+ private chainConfigApi;
17
+ /** Per-chain cooldown for 404 (unsupported chain) */
18
+ private chainCooldown;
19
+ /** Per-token cooldown for PRICE_UNAVAILABLE */
20
+ private tokenCooldown;
21
+ constructor(deps?: {
22
+ relayerApi?: RelayerApi;
23
+ tokenCapabilityApi?: TokenCapabilityApi;
24
+ chainConfigApi?: ChainConfigApi;
25
+ });
26
+ /**
27
+ * Estimate gasless fee for a transfer across all tiers.
28
+ *
29
+ * Iterates fee token candidates in order, tries Tier 1 first,
30
+ * then Tier 2, finally Tier 3 (if getRewardsBalance provided).
31
+ *
32
+ * Returns null if gasless is not possible.
33
+ */
34
+ estimateFee(params: {
35
+ chainKey: string;
36
+ chainId: number;
37
+ tokenAddress: string;
38
+ fromAddress: string;
39
+ toAddress: string;
40
+ amount: string;
41
+ gaslessConfig: GaslessConfig;
42
+ /** Whether the connected wallet supports EIP-7702 authorization signing. Defaults to true. */
43
+ supportsAuthorization?: boolean;
44
+ }): Promise<FeeEstimate | null>;
45
+ /** Access the chain config API for external use */
46
+ getChainConfigApi(): ChainConfigApi;
47
+ /** Access the relayer API for shared use */
48
+ getRelayerApi(): RelayerApi;
49
+ /** Clear all API caches (call on disconnect or chain switch) */
50
+ clearCache(): void;
51
+ private getBalance;
52
+ private formatFee;
53
+ private buildEstimate;
54
+ }
55
+ export declare function getSharedGaslessFeeService(): GaslessFeeService;
@@ -0,0 +1,61 @@
1
+ import { RelayerApi } from '../api/RelayerApi';
2
+ import type { GaslessSigner } from '../signer/GaslessSigner';
3
+ import type { GaslessConfig, GaslessTransferParams, GaslessTransferResult } from '../types';
4
+ import type { RevokeCapableClient } from '../utils/revokeDelegation';
5
+ import { Eip7702Service } from './Eip7702Service';
6
+ /**
7
+ * Error thrown when relay Phase 2 fails after the server may have
8
+ * already processed the transaction. Callers should check the explorer
9
+ * using the requestId before retrying.
10
+ */
11
+ export declare class RelayPhase2Error extends Error {
12
+ readonly requestId: string;
13
+ readonly originalError: unknown;
14
+ constructor(requestId: string, cause: unknown);
15
+ }
16
+ /**
17
+ * Main orchestrator for gasless ERC-20 transfers.
18
+ *
19
+ * Routes to the appropriate execution path based on gaslessMode:
20
+ * - generic: 2-phase relay (permits → execute)
21
+ * - eip7702-fee: EIP-7702 delegation + token fee
22
+ * - eip7702-points: EIP-7702 delegation + reward points
23
+ */
24
+ export declare class GaslessTransferService {
25
+ private relayerApi;
26
+ private permitService;
27
+ private eip7702Service;
28
+ private signer;
29
+ private walletClient?;
30
+ constructor(deps: {
31
+ relayerApi?: RelayerApi;
32
+ eip7702Service?: Eip7702Service;
33
+ signer: GaslessSigner;
34
+ /** External wallet client for EIP-7702 delegation revoke. */
35
+ walletClient?: RevokeCapableClient;
36
+ });
37
+ execute(params: GaslessTransferParams, gaslessConfig: GaslessConfig): Promise<GaslessTransferResult>;
38
+ /**
39
+ * Generic 2-phase relay execution.
40
+ *
41
+ * Phase 1: POST /relayer/execute { auth: { method: 'auto' } }
42
+ * → Server responds with signatureRequests
43
+ * Phase 2: Sign all requests → POST /relayer/execute { requestId, signatures }
44
+ * → Server responds with txHash
45
+ */
46
+ private executeGenericRelay;
47
+ /**
48
+ * EIP-7702 relay execution (fee or points mode).
49
+ *
50
+ * 1. Pre-flight delegation check
51
+ * 2. Sign delegate authorization
52
+ * 3. Get relayer info (address + execution nonce)
53
+ * 4. Build and sign execution typed data
54
+ * 5. Submit to relayer
55
+ * 6. On failure: cleanup delegation
56
+ */
57
+ private executeEip7702Relay;
58
+ private extractResult;
59
+ /** Encode ERC-20 transfer(address,uint256) calldata */
60
+ private encodeErc20Transfer;
61
+ }
@@ -0,0 +1,28 @@
1
+ import type { GaslessSigner } from '../signer/GaslessSigner';
2
+ import type { RelaySignatureRequest } from '../types';
3
+ export interface SignedPermit {
4
+ purpose: string;
5
+ v?: number;
6
+ r?: string;
7
+ s?: string;
8
+ raw?: string;
9
+ }
10
+ /**
11
+ * Signs relay signature requests (EIP-3009, ERC-2612, EIP-712)
12
+ * using the injected GaslessSigner.
13
+ *
14
+ * Retry logic is handled by the signer implementation.
15
+ * On partial success, all signatures are discarded (abort-all semantics).
16
+ */
17
+ export declare class PermitSignService {
18
+ private signer;
19
+ constructor(signer: GaslessSigner);
20
+ /**
21
+ * Sign all signature requests from the relayer's Phase 1 response.
22
+ * Returns an array of signed signatures keyed by purpose.
23
+ */
24
+ signAll(requests: RelaySignatureRequest[]): Promise<SignedPermit[]>;
25
+ private buildTypedData;
26
+ private inferPrimaryType;
27
+ private parseSignature;
28
+ }
@@ -0,0 +1,27 @@
1
+ import type { EIP7702Authorization } from '../types';
2
+ import type { GaslessSigner, TypedDataPayload } from './GaslessSigner';
3
+ /**
4
+ * GaslessSigner implementation for ABC WaaS MPC wallets.
5
+ *
6
+ * Wraps TalkenApiClient signing methods with retry logic.
7
+ * Encapsulates WaaS-specific credentials (pinHash, network, email).
8
+ */
9
+ export declare class AbcWaasSigner implements GaslessSigner {
10
+ private pinHash;
11
+ private network;
12
+ private email?;
13
+ constructor(params: {
14
+ pinHash: string | undefined;
15
+ network: string;
16
+ email?: string;
17
+ });
18
+ supportsAuthorization(): boolean;
19
+ signTypedData(typedData: TypedDataPayload): Promise<string>;
20
+ signAuthorization(authorization: {
21
+ chainId: number;
22
+ address: string;
23
+ nonce: number;
24
+ }): Promise<EIP7702Authorization>;
25
+ getNonce(address: string): Promise<number>;
26
+ private getApiOrThrow;
27
+ }
@@ -0,0 +1,43 @@
1
+ import type { EIP7702Authorization } from '../types';
2
+ /**
3
+ * Structured EIP-712 typed data payload.
4
+ * Replaces loose Record<string, unknown> for type safety at call sites.
5
+ */
6
+ export interface TypedDataPayload {
7
+ domain: {
8
+ name: string;
9
+ version: string;
10
+ chainId: number;
11
+ verifyingContract: string;
12
+ };
13
+ types: Record<string, Array<{
14
+ name: string;
15
+ type: string;
16
+ }>>;
17
+ primaryType: string;
18
+ message: Record<string, unknown>;
19
+ }
20
+ /**
21
+ * Abstract signing interface for gasless transfers.
22
+ *
23
+ * Implementations handle wallet-specific details (MPC PIN, local key, etc.)
24
+ * and retry logic internally. Services only depend on this interface.
25
+ *
26
+ * Two implementations are provided:
27
+ * - AbcWaasSigner: ABC WaaS MPC signing (PIN + server-side key share)
28
+ * - WagmiSigner: External wallet signing via wagmi walletClient (MetaMask, etc.)
29
+ */
30
+ export interface GaslessSigner {
31
+ /** Sign EIP-712 typed data. Returns a hex-encoded signature string. */
32
+ signTypedData(typedData: TypedDataPayload): Promise<string>;
33
+ /** Sign an EIP-7702 authorization tuple. */
34
+ signAuthorization(authorization: {
35
+ chainId: number;
36
+ address: string;
37
+ nonce: number;
38
+ }): Promise<EIP7702Authorization>;
39
+ /** Get the current wallet nonce (transaction count) for EIP-7702 flows. */
40
+ getNonce(address: string): Promise<number>;
41
+ /** Whether this signer supports EIP-7702 authorization signing. */
42
+ supportsAuthorization(): boolean;
43
+ }
@@ -0,0 +1,63 @@
1
+ import type { EIP7702Authorization } from '../types';
2
+ import type { GaslessSigner, TypedDataPayload } from './GaslessSigner';
3
+ /**
4
+ * Viem WalletClient / PublicClient minimal interface.
5
+ * Avoids importing full viem types — consumers pass the real instances.
6
+ */
7
+ export interface WagmiWalletClient {
8
+ signTypedData(args: {
9
+ domain: Record<string, unknown>;
10
+ types: Record<string, Array<{
11
+ name: string;
12
+ type: string;
13
+ }>>;
14
+ primaryType: string;
15
+ message: Record<string, unknown>;
16
+ }): Promise<string>;
17
+ signAuthorization?(args: {
18
+ contractAddress: string;
19
+ chainId: number;
20
+ nonce: number;
21
+ }): Promise<{
22
+ chainId: number;
23
+ nonce: number;
24
+ address: string;
25
+ r: string;
26
+ s: string;
27
+ yParity: number;
28
+ }>;
29
+ }
30
+ export interface WagmiPublicClient {
31
+ getTransactionCount(args: {
32
+ address: string;
33
+ blockTag?: string;
34
+ }): Promise<number>;
35
+ }
36
+ /**
37
+ * GaslessSigner implementation for external wallets via wagmi/viem.
38
+ *
39
+ * Supports MetaMask, Coinbase Wallet, and any EIP-1193 compatible wallet.
40
+ * EIP-7702 authorization is available if the wallet supports it.
41
+ */
42
+ export declare class WagmiSigner implements GaslessSigner {
43
+ private walletClient;
44
+ private publicClient;
45
+ private _supportsAuth;
46
+ constructor(params: {
47
+ walletClient: WagmiWalletClient;
48
+ publicClient: WagmiPublicClient;
49
+ supportsAuthorization?: boolean;
50
+ });
51
+ supportsAuthorization(): boolean;
52
+ signTypedData(typedData: TypedDataPayload): Promise<string>;
53
+ signAuthorization(authorization: {
54
+ chainId: number;
55
+ address: string;
56
+ nonce: number;
57
+ }): Promise<EIP7702Authorization>;
58
+ getNonce(address: string): Promise<number>;
59
+ /**
60
+ * Retry wrapper. Retries on transient errors but NOT on user rejection.
61
+ */
62
+ private withRetry;
63
+ }
@@ -0,0 +1,4 @@
1
+ export type { GaslessSigner, TypedDataPayload } from './GaslessSigner';
2
+ export { AbcWaasSigner } from './AbcWaasSigner';
3
+ export { WagmiSigner } from './WagmiSigner';
4
+ export type { WagmiWalletClient, WagmiPublicClient } from './WagmiSigner';
@@ -0,0 +1,298 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * Tier 1 `generic` – EIP-3009 / ERC-2612 permit relay (2-phase)
4
+ * Tier 2 `eip7702-fee` – EIP-7702 delegation + token fee
5
+ * Tier 3 `eip7702-points`– EIP-7702 delegation + reward points (optional)
6
+ */
7
+ export type GaslessMode = 'generic' | 'eip7702-fee' | 'eip7702-points';
8
+ export interface FeeToken {
9
+ symbol: string;
10
+ address: string;
11
+ decimals: number;
12
+ icon?: string;
13
+ /** true for project-specific tokens (e.g. TALK, XYZ) */
14
+ isProjectToken?: boolean;
15
+ }
16
+ export interface FeeEstimate {
17
+ feeToken: FeeToken;
18
+ /** Human-readable fee amount (e.g. "0.50") */
19
+ feeAmount: string;
20
+ /** Raw fee amount in smallest unit */
21
+ feeAmountRaw: string;
22
+ /** Optional USD equivalent */
23
+ feeAmountUsd?: string;
24
+ gaslessMode: GaslessMode;
25
+ }
26
+ export interface TokenCapabilities {
27
+ symbol: string;
28
+ address: string;
29
+ chainKey: string;
30
+ supportsEIP3009: boolean;
31
+ supportsERC2612: boolean;
32
+ optimalAuthMethod: 'eip3009' | 'erc2612' | 'permit2';
33
+ domain?: {
34
+ name: string;
35
+ version: string;
36
+ };
37
+ }
38
+ export interface RuntimeChainConfig {
39
+ chainKey: string;
40
+ chainId?: number;
41
+ weth?: string;
42
+ usdt0Oft?: string;
43
+ usdt?: string;
44
+ usdc?: string;
45
+ talkUnderlying?: string;
46
+ crossChainRouter?: string;
47
+ destinationReceiver?: string;
48
+ quoteRouter?: string;
49
+ genericRelayer?: string;
50
+ eip7702Delegate?: string;
51
+ permit2?: string;
52
+ lzEndpoint?: string;
53
+ cctpMessageTransmitter?: string;
54
+ }
55
+ export interface EIP7702Authorization {
56
+ chainId: number;
57
+ address: string;
58
+ nonce: number;
59
+ yParity: number;
60
+ r: string;
61
+ s: string;
62
+ }
63
+ export interface EIP7702ExecutionAuth {
64
+ nonce: string;
65
+ deadline: number;
66
+ v: number;
67
+ r: string;
68
+ s: string;
69
+ }
70
+ export interface RelaySignatureRequest {
71
+ purpose: 'tokenIn' | 'feeToken' | 'relay';
72
+ type: 'eip3009' | 'erc2612' | 'eip712';
73
+ primaryType?: string;
74
+ domain: {
75
+ name: string;
76
+ version: string;
77
+ chainId: number;
78
+ verifyingContract: string;
79
+ };
80
+ types?: Record<string, Array<{
81
+ name: string;
82
+ type: string;
83
+ }>>;
84
+ message: Record<string, unknown>;
85
+ }
86
+ export type RelayAuth = {
87
+ method: 'auto';
88
+ } | {
89
+ method: 'eip7702';
90
+ usePermit2?: boolean;
91
+ authorization: EIP7702Authorization;
92
+ revokeAuthorization?: EIP7702Authorization;
93
+ executionAuth: EIP7702ExecutionAuth;
94
+ };
95
+ export interface RelayerEstimateFeeParams {
96
+ chainKey: string;
97
+ user: string;
98
+ tokenIn: string;
99
+ amountIn: string;
100
+ tokenOut: string;
101
+ minAmountOut: string;
102
+ deadline: number;
103
+ dexType: number;
104
+ dexData: string;
105
+ feeToken: string;
106
+ }
107
+ export interface RelayerFeeEstimate {
108
+ gasLimit: string;
109
+ gasPrice: string;
110
+ gasCost: string;
111
+ feeInToken: string;
112
+ feeToken: string;
113
+ relayer: string;
114
+ }
115
+ export interface RelayExecuteRequest {
116
+ chainKey: string;
117
+ user: string;
118
+ tokenIn: string;
119
+ amountIn: string;
120
+ target: string;
121
+ targetCalldata: string;
122
+ tokenOut: string;
123
+ minAmountOut: string;
124
+ recipient: string;
125
+ deadline: number;
126
+ fee: {
127
+ token: string;
128
+ amount: string;
129
+ maxAmount: string;
130
+ };
131
+ auth: RelayAuth;
132
+ /** Phase 2: request ID from Phase 1 */
133
+ requestId?: string;
134
+ /** Phase 2: signed signatures from Phase 1 */
135
+ signatures?: Array<{
136
+ purpose: string;
137
+ v?: number;
138
+ r?: string;
139
+ s?: string;
140
+ raw?: string;
141
+ }>;
142
+ }
143
+ export type RelayExecuteResponse = {
144
+ phase: 'sign';
145
+ requestId: string;
146
+ selectedMethod: string;
147
+ signatureRequests: RelaySignatureRequest[];
148
+ } | {
149
+ phase: 'done';
150
+ data?: {
151
+ txHash: string;
152
+ status: string;
153
+ authMethod: string;
154
+ crossChain: boolean;
155
+ fee: {
156
+ token: string;
157
+ amount: string;
158
+ };
159
+ cleanup?: {
160
+ revokeTxHash: string;
161
+ revokeSuccess: boolean;
162
+ };
163
+ };
164
+ error?: {
165
+ code: string;
166
+ message: string;
167
+ };
168
+ };
169
+ export interface RelayerBalanceInfo {
170
+ chainKey: string;
171
+ relayer: string;
172
+ balanceWei: string;
173
+ }
174
+ export interface TokenBalance {
175
+ address: string;
176
+ symbol: string;
177
+ decimals: number;
178
+ balance: string;
179
+ chainKey?: string;
180
+ }
181
+ export interface GaslessTransferParams {
182
+ chainId: number;
183
+ chainKey: string;
184
+ fromAddress: string;
185
+ toAddress: string;
186
+ tokenAddress: string;
187
+ /** Raw amount in smallest unit */
188
+ amount: string;
189
+ feeToken: FeeToken;
190
+ gaslessMode: GaslessMode;
191
+ feeAmountRaw: string;
192
+ }
193
+ export interface GaslessTransferResult {
194
+ txHash: string;
195
+ gaslessMode: GaslessMode;
196
+ feeToken: string;
197
+ feeAmount: string;
198
+ receipt?: {
199
+ transactionHash: string;
200
+ blockNumber: number;
201
+ status: number;
202
+ };
203
+ cleanup?: {
204
+ revokeTxHash: string;
205
+ revokeSuccess: boolean;
206
+ };
207
+ }
208
+ export interface GaslessConfig {
209
+ /** Enable gasless transfers. @default false */
210
+ enabled: boolean;
211
+ /**
212
+ * Project-specific fee tokens beyond USDT/USDC.
213
+ * Resolved per chain from address.
214
+ */
215
+ projectFeeTokens?: Array<{
216
+ chainId: number;
217
+ address: string;
218
+ symbol: string;
219
+ decimals: number;
220
+ icon?: string;
221
+ }>;
222
+ /**
223
+ * Default fee token address per chain.
224
+ * Falls back to first available token if not specified.
225
+ */
226
+ defaultFeeToken?: Record<number, string>;
227
+ /**
228
+ * Tier 3 (points) callback. If not provided, Tier 3 is disabled.
229
+ * Must return the available reward balance and an identifier.
230
+ */
231
+ getRewardsBalance?: (params: {
232
+ address: string;
233
+ chainId: number;
234
+ }) => Promise<{
235
+ balance: string;
236
+ rewardsId: string;
237
+ } | null>;
238
+ /**
239
+ * Called when EIP-7702 delegation cleanup fails.
240
+ * Consumer should surface this to the user.
241
+ */
242
+ onDelegationError?: (error: {
243
+ chainId: number;
244
+ address: string;
245
+ delegateAddress: string;
246
+ message: string;
247
+ }) => void;
248
+ /**
249
+ * Fee token priority order set by the user (e.g. from Settings UI).
250
+ * Tokens are tried in this order during fee estimation.
251
+ * Tokens NOT in this list are excluded from estimation.
252
+ * When omitted, all available tokens are tried in default order.
253
+ *
254
+ * @example ['TALK', 'USDT'] — try TALK first, then USDT; skip USDC
255
+ */
256
+ feeTokenPriority?: string[];
257
+ /**
258
+ * Override gasless mode preference order.
259
+ * @default ['generic', 'eip7702-fee', 'eip7702-points']
260
+ */
261
+ modePreference?: GaslessMode[];
262
+ }
263
+ export interface GaslessConfigProviderProps {
264
+ config: GaslessConfig | null;
265
+ children: ReactNode;
266
+ }
267
+ export interface UseGaslessTransferReturn {
268
+ /** Whether gasless is available for the current transfer */
269
+ canGasless: boolean;
270
+ /** Current gasless mode */
271
+ gaslessMode: GaslessMode | null;
272
+ /** Available fee tokens on the current chain */
273
+ feeTokens: FeeToken[];
274
+ /** Fee estimate for current parameters */
275
+ feeEstimate: FeeEstimate | null;
276
+ /** Fee estimation in progress */
277
+ isEstimating: boolean;
278
+ /** Transfer execution in progress */
279
+ isExecuting: boolean;
280
+ /** Last error message */
281
+ error: string | null;
282
+ /** Why gasless is unavailable (null if available) */
283
+ unavailableReason: 'disabled' | 'unsupportedChain' | 'unsupportedToken' | 'noFeeToken' | 'insufficientBalance' | 'insufficientRewards' | null;
284
+ /** Execute gasless transfer */
285
+ execute: (params: {
286
+ toAddress: string;
287
+ tokenAddress: string;
288
+ amount: string;
289
+ }) => Promise<GaslessTransferResult>;
290
+ /** Re-run fee estimation */
291
+ refreshEstimate: () => Promise<void>;
292
+ }
293
+ export interface DetectedErc20Transfer {
294
+ /** Recipient address */
295
+ to: string;
296
+ /** Raw amount in smallest unit */
297
+ amount: string;
298
+ }