@coti-io/coti-wallet-plugin 0.2.2 → 0.2.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/index.d.mts +162 -66
- package/dist/index.d.ts +162 -66
- package/dist/index.js +3069 -2469
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2875 -2278
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigNumberish, ethers } from 'ethers';
|
|
2
|
-
import { PodFeeEstimate, PodSdkConfig } from '@coti-io/pod-sdk';
|
|
2
|
+
import { PodFeeEstimate, PodSdkConfig, PodMethodArgument } from '@coti-io/pod-sdk';
|
|
3
3
|
import react from 'react';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as viem from 'viem';
|
|
@@ -42,6 +42,12 @@ interface PodFeeEstimationLimits {
|
|
|
42
42
|
forwardGasLimit: bigint;
|
|
43
43
|
callBackGasLimit: bigint;
|
|
44
44
|
callBackDataSize?: bigint;
|
|
45
|
+
/**
|
|
46
|
+
* Inbox forward calldata size (bytes). Required for encrypted methods (e.g. itUint256
|
|
47
|
+
* transfer) — plaintext arg-length heuristics understate encrypted payloads.
|
|
48
|
+
* PodERC20 uses 512 for remote call size.
|
|
49
|
+
*/
|
|
50
|
+
forwardDataSize?: bigint;
|
|
45
51
|
}
|
|
46
52
|
interface ChainIndexPageUi {
|
|
47
53
|
/** Extra section below token cards (e.g. PoD request tracker on Sepolia). */
|
|
@@ -66,10 +72,11 @@ interface ChainConfig {
|
|
|
66
72
|
unlockStrategy: UnlockStrategy;
|
|
67
73
|
portalStrategy: PortalStrategy;
|
|
68
74
|
walletNetwork: WalletNetworkConfig;
|
|
69
|
-
/** Inbox fee estimation gas limits for PoD portal deposit/withdraw. */
|
|
75
|
+
/** Inbox fee estimation gas limits for PoD portal deposit/withdraw and pToken transfer. */
|
|
70
76
|
podFeeEstimation?: {
|
|
71
77
|
deposit: PodFeeEstimationLimits;
|
|
72
78
|
withdraw: PodFeeEstimationLimits;
|
|
79
|
+
transfer: PodFeeEstimationLimits;
|
|
73
80
|
};
|
|
74
81
|
/** Main Index page: which chrome and labels to show for this chain. */
|
|
75
82
|
indexPage: ChainIndexPageUi;
|
|
@@ -273,7 +280,16 @@ interface CotiPluginConfig {
|
|
|
273
280
|
* Only COTI Testnet and COTI Mainnet can hold AES keys.
|
|
274
281
|
*/
|
|
275
282
|
aesKeyChainId?: AesKeyChainId;
|
|
276
|
-
/**
|
|
283
|
+
/**
|
|
284
|
+
* When false, skips native COTI grant requests during onboarding.
|
|
285
|
+
* Default: true. Uses built-in grant API when no custom grantNativeCoti is set.
|
|
286
|
+
*/
|
|
287
|
+
onboardingGrantEnabled?: boolean;
|
|
288
|
+
/** COTI Testnet gas-grant endpoint. Default: official COTI Testnet grant API. */
|
|
289
|
+
grantApiUrlTestnet?: string;
|
|
290
|
+
/** COTI Mainnet gas-grant endpoint. No default — grant is skipped on mainnet until set. */
|
|
291
|
+
grantApiUrlMainnet?: string;
|
|
292
|
+
/** Native COTI threshold required before contract onboarding. Defaults to 0.2 COTI. */
|
|
277
293
|
onboardingGrantMinBalanceWei?: BigNumberish;
|
|
278
294
|
/** Polling interval after grant callback. Defaults to 2000ms. */
|
|
279
295
|
onboardingGrantPollIntervalMs?: number;
|
|
@@ -442,7 +458,7 @@ declare const DEFAULT_POD_BALANCE_STATE: PodBalanceState;
|
|
|
442
458
|
type PodPortalRequestStatus = "wallet-signing" | "source-submitted" | "source-mined" | "target-mined" | "callback-generated" | "pod-pending" | "callback-errored" | "succeeded" | "failed" | "burn-debt";
|
|
443
459
|
interface PodPortalRequest {
|
|
444
460
|
id: string;
|
|
445
|
-
kind: "deposit" | "withdraw";
|
|
461
|
+
kind: "deposit" | "withdraw" | "transfer";
|
|
446
462
|
chainId: number;
|
|
447
463
|
sourceTxHash: string;
|
|
448
464
|
requestId?: string;
|
|
@@ -472,7 +488,7 @@ declare const PRIVACY_PORTAL_ABI: readonly ["function underlyingToken() view ret
|
|
|
472
488
|
* - maxFee == type(uint128).max is the deployed "no cap" sentinel.
|
|
473
489
|
*/
|
|
474
490
|
declare const POD_PORTAL_ADMIN_ABI: readonly ["function owner() view returns (address)", "function setDepositFee(uint256 fixedFee, uint256 percentageBps, uint256 maxFee)", "function setWithdrawFee(uint256 fixedFee, uint256 percentageBps, uint256 maxFee)", "function getFeeConfig(bool isDeposit) view returns (uint256 fixedFee, uint256 percentageBps, uint256 maxFee)", "function accumulatedPortalFees() view returns (uint256)", "function estimateDepositFees(uint256 amount) view returns (uint256 portalFee,bool usedDynamicPricing,uint256 mintTotalFee,uint256 mintCallbackFee)", "function estimateWithdrawFees(uint256 amount) view returns (uint256 portalFee,bool usedDynamicPricing,uint256 transferTotalFee,uint256 transferCallbackFee)"];
|
|
475
|
-
declare const POD_PTOKEN_ABI: readonly ["function name() view returns (string)", "function symbol() view returns (string)", "function decimals() view returns (uint8)", "function nonces(address owner) view returns (uint256)", "function failedRequests(bytes32 requestId) view returns (bytes)", "function balanceOf(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow))", "function balanceWithState(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow) balance,bool pending,bool callbackErrored)", "function balanceOfWithStatus(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow),bool)", "error TransferAlreadyPending(address from, address to, bytes32 requestId)", "event TransferRequestSubmitted(address indexed from,address indexed to,bytes32 requestId)", "event Transfer(address indexed from,address indexed to,bytes senderValue,bytes receiverValue)", "event TransferFailed(address indexed from,address indexed to,bytes errorMsg)", "event RequestCallbackFailed(address indexed from,address indexed to,bytes32 requestId,bytes callbackData)"];
|
|
491
|
+
declare const POD_PTOKEN_ABI: readonly ["function name() view returns (string)", "function symbol() view returns (string)", "function decimals() view returns (uint8)", "function nonces(address owner) view returns (uint256)", "function failedRequests(bytes32 requestId) view returns (bytes)", "function balanceOf(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow))", "function balanceWithState(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow) balance,bool pending,bool callbackErrored)", "function balanceOfWithStatus(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow),bool)", "function transfer(address to, ((uint256,uint256),bytes) value, uint256 callbackFeeLocalWei) payable returns (bytes32)", "function estimateFee() view returns (uint256 totalFeeWei, uint256 targetFeeWei, uint256 callbackFeeWei)", "error TransferAlreadyPending(address from, address to, bytes32 requestId)", "event TransferRequestSubmitted(address indexed from,address indexed to,bytes32 requestId)", "event Transfer(address indexed from,address indexed to,bytes senderValue,bytes receiverValue)", "event TransferFailed(address indexed from,address indexed to,bytes errorMsg)", "event RequestCallbackFailed(address indexed from,address indexed to,bytes32 requestId,bytes callbackData)"];
|
|
476
492
|
|
|
477
493
|
declare const podRequestsStorageKey: (wallet?: string) => string;
|
|
478
494
|
declare function loadPodRequests(wallet?: string): PodPortalRequest[];
|
|
@@ -611,6 +627,13 @@ declare const quotePodPortalTransactionFees: (params: {
|
|
|
611
627
|
gasPrice?: bigint;
|
|
612
628
|
}) => Promise<PodPortalFeeQuote>;
|
|
613
629
|
|
|
630
|
+
type PodPTokenReadinessDebugContext = {
|
|
631
|
+
portalAddress?: string;
|
|
632
|
+
tokenSymbol?: string;
|
|
633
|
+
chainId?: number;
|
|
634
|
+
provider?: ethers.Provider | null;
|
|
635
|
+
};
|
|
636
|
+
declare const assertPodPTokenReady: (pToken: ethers.Contract, account: string, action: "deposit" | "withdraw" | "transfer", debugContext?: PodPTokenReadinessDebugContext) => Promise<void>;
|
|
614
637
|
declare function signPodWithdrawPermit(params: {
|
|
615
638
|
signer: ethers.JsonRpcSigner;
|
|
616
639
|
pTokenAddress: string;
|
|
@@ -640,6 +663,138 @@ declare function executePodPortalTransaction(params: {
|
|
|
640
663
|
receipt: ethers.TransactionReceipt;
|
|
641
664
|
}>;
|
|
642
665
|
|
|
666
|
+
/**
|
|
667
|
+
* Typed EIP-1193 provider interface for window.ethereum access.
|
|
668
|
+
* Eliminates `as any` casts throughout the codebase.
|
|
669
|
+
*/
|
|
670
|
+
interface EIP1193Provider {
|
|
671
|
+
request: (args: {
|
|
672
|
+
method: string;
|
|
673
|
+
params?: unknown[] | Record<string, unknown>;
|
|
674
|
+
}) => Promise<any>;
|
|
675
|
+
isMetaMask?: boolean;
|
|
676
|
+
isRabby?: boolean;
|
|
677
|
+
isPhantom?: boolean;
|
|
678
|
+
on?: (event: string, handler: (...args: any[]) => void) => void;
|
|
679
|
+
removeListener?: (event: string, handler: (...args: any[]) => void) => void;
|
|
680
|
+
providers?: EIP1193Provider[];
|
|
681
|
+
}
|
|
682
|
+
interface InjectedWalletTarget {
|
|
683
|
+
id: string;
|
|
684
|
+
name: string;
|
|
685
|
+
provider: EIP1193Provider;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Returns the EIP-6963 discovered MetaMask provider when available.
|
|
689
|
+
*/
|
|
690
|
+
declare function getEip6963MetaMaskProvider(): EIP1193Provider | null;
|
|
691
|
+
declare function getEip6963RabbyProvider(): EIP1193Provider | null;
|
|
692
|
+
/**
|
|
693
|
+
* Resolves the MetaMask injected target for wagmi/RainbowKit.
|
|
694
|
+
* Never returns undefined — wagmi's injected() connector falls back to
|
|
695
|
+
* window.ethereum (often Rabby) when target() is undefined.
|
|
696
|
+
*/
|
|
697
|
+
declare function resolveMetaMaskInjectedTarget(): InjectedWalletTarget;
|
|
698
|
+
/**
|
|
699
|
+
* Resolves the Rabby injected target for wagmi/RainbowKit.
|
|
700
|
+
* Never returns undefined — avoids wagmi falling back to a generic injected provider.
|
|
701
|
+
*/
|
|
702
|
+
declare function resolveRabbyInjectedTarget(): InjectedWalletTarget;
|
|
703
|
+
/**
|
|
704
|
+
* Returns the typed EIP-1193 provider from `window.ethereum`, or null if unavailable.
|
|
705
|
+
* Use this instead of `window.ethereum as any` throughout the codebase.
|
|
706
|
+
* Handles the case where window.ethereum access may throw due to property
|
|
707
|
+
* redefinition conflicts between wallet extensions.
|
|
708
|
+
*/
|
|
709
|
+
declare function getEthereumProvider(): EIP1193Provider | null;
|
|
710
|
+
/** Minimal wagmi-connector shape needed to resolve its EIP-1193 provider. */
|
|
711
|
+
interface ConnectorProviderSource {
|
|
712
|
+
getProvider?: (params?: {
|
|
713
|
+
chainId?: number;
|
|
714
|
+
}) => Promise<unknown>;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Resolves the EIP-1193 provider for the wallet the user actually connected.
|
|
718
|
+
* Prefers the wagmi connector's provider (the exact wallet chosen via
|
|
719
|
+
* RainbowKit), then the EIP-6963 MetaMask provider, and only then the
|
|
720
|
+
* window.ethereum global — which belongs to whichever extension won the
|
|
721
|
+
* injection race when multiple wallets are installed, so signing through it
|
|
722
|
+
* can pop up a wallet the user never connected.
|
|
723
|
+
*/
|
|
724
|
+
declare function resolveConnectedProvider(connector?: ConnectorProviderSource | null): Promise<EIP1193Provider | null>;
|
|
725
|
+
|
|
726
|
+
type PodTransferFeeQuote = {
|
|
727
|
+
gasPrice: bigint;
|
|
728
|
+
podInboxFeeWei: bigint;
|
|
729
|
+
podCallbackFeeWei: bigint;
|
|
730
|
+
l1ExecutionGasWei: bigint;
|
|
731
|
+
podFeeEstimate: PodFeeEstimate;
|
|
732
|
+
display: {
|
|
733
|
+
podInboxFee: string;
|
|
734
|
+
l1Gas: string;
|
|
735
|
+
feeSymbol: string;
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
declare const buildPodTransferMethodArgs: (params: {
|
|
739
|
+
recipient: string;
|
|
740
|
+
amountWei: bigint;
|
|
741
|
+
}) => PodMethodArgument[];
|
|
742
|
+
/** Single source of truth for PoD pToken Send fee quotes — one gasPrice, inbox + L1 gas. */
|
|
743
|
+
declare const quotePodTransferFees: (params: {
|
|
744
|
+
runner: ethers.ContractRunner;
|
|
745
|
+
chainId: number;
|
|
746
|
+
pTokenAddress: string;
|
|
747
|
+
recipient: string;
|
|
748
|
+
amountWei: bigint;
|
|
749
|
+
gasPrice?: bigint;
|
|
750
|
+
}) => Promise<PodTransferFeeQuote>;
|
|
751
|
+
|
|
752
|
+
interface ExecutePodPrivateTokenTransferParams {
|
|
753
|
+
chainId: number;
|
|
754
|
+
symbol: string;
|
|
755
|
+
recipient: string;
|
|
756
|
+
amount: string;
|
|
757
|
+
walletAddress: string;
|
|
758
|
+
provider?: EIP1193Provider | null;
|
|
759
|
+
}
|
|
760
|
+
interface ExecutePodPrivateTokenTransferResult {
|
|
761
|
+
txHash: string;
|
|
762
|
+
request?: PodPortalRequest;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* PoD pToken peer Send — quote + encrypt + pay inbox fee via `@coti-io/pod-sdk`,
|
|
766
|
+
* mirroring portal in/out fee/send discipline (pinned gasPrice, callback fee slot).
|
|
767
|
+
*/
|
|
768
|
+
declare function executePodPrivateTokenTransfer(params: ExecutePodPrivateTokenTransferParams): Promise<ExecutePodPrivateTokenTransferResult>;
|
|
769
|
+
/** Quote PoD transfer fees for UI (recipient may be a placeholder when unknown). */
|
|
770
|
+
declare function quotePodPrivateTokenTransferFees(params: {
|
|
771
|
+
chainId: number;
|
|
772
|
+
symbol: string;
|
|
773
|
+
recipient: string;
|
|
774
|
+
amount: string;
|
|
775
|
+
walletAddress: string;
|
|
776
|
+
provider?: EIP1193Provider | null;
|
|
777
|
+
}): Promise<PodTransferFeeQuote>;
|
|
778
|
+
|
|
779
|
+
interface UsePodTransferFeesOptions {
|
|
780
|
+
isConnected: boolean;
|
|
781
|
+
walletAddress?: string;
|
|
782
|
+
chainId?: number;
|
|
783
|
+
symbol?: string;
|
|
784
|
+
recipient?: string;
|
|
785
|
+
amount: string;
|
|
786
|
+
enabled?: boolean;
|
|
787
|
+
}
|
|
788
|
+
/** PoD pToken Send fee quotes — inbox fee + L1 gas in native token. */
|
|
789
|
+
declare const usePodTransferFees: ({ isConnected, walletAddress, chainId, symbol, recipient, amount, enabled, }: UsePodTransferFeesOptions) => {
|
|
790
|
+
podInboxFee: string | null;
|
|
791
|
+
l1GasFee: string | null;
|
|
792
|
+
feeSymbol: string;
|
|
793
|
+
isGasEstimating: boolean;
|
|
794
|
+
refreshFees: () => Promise<void>;
|
|
795
|
+
isPodChain: boolean;
|
|
796
|
+
};
|
|
797
|
+
|
|
643
798
|
/**
|
|
644
799
|
* PoDPriceOracle deployed alongside the PoD privacy portals (Band adapter on
|
|
645
800
|
* Sepolia, Chainlink adapter on Fuji). Prices are 18-decimal USD per whole
|
|
@@ -3785,6 +3940,7 @@ interface PrivacyBridgeUnlockContextValue {
|
|
|
3785
3940
|
amount: string;
|
|
3786
3941
|
}) => Promise<{
|
|
3787
3942
|
txHash: string;
|
|
3943
|
+
request?: PodPortalRequest;
|
|
3788
3944
|
}>;
|
|
3789
3945
|
/** Encrypt a human-readable amount into ctUint256 JSON without exposing the AES key. */
|
|
3790
3946
|
encryptPrivateValue: (params: {
|
|
@@ -3922,66 +4078,6 @@ interface FeeEstimate {
|
|
|
3922
4078
|
}
|
|
3923
4079
|
declare function estimateBridgeFee(symbol: string, amount: string, provider: ethers.JsonRpcProvider | ethers.BrowserProvider): Promise<FeeEstimate>;
|
|
3924
4080
|
|
|
3925
|
-
/**
|
|
3926
|
-
* Typed EIP-1193 provider interface for window.ethereum access.
|
|
3927
|
-
* Eliminates `as any` casts throughout the codebase.
|
|
3928
|
-
*/
|
|
3929
|
-
interface EIP1193Provider {
|
|
3930
|
-
request: (args: {
|
|
3931
|
-
method: string;
|
|
3932
|
-
params?: unknown[] | Record<string, unknown>;
|
|
3933
|
-
}) => Promise<any>;
|
|
3934
|
-
isMetaMask?: boolean;
|
|
3935
|
-
isRabby?: boolean;
|
|
3936
|
-
isPhantom?: boolean;
|
|
3937
|
-
on?: (event: string, handler: (...args: any[]) => void) => void;
|
|
3938
|
-
removeListener?: (event: string, handler: (...args: any[]) => void) => void;
|
|
3939
|
-
providers?: EIP1193Provider[];
|
|
3940
|
-
}
|
|
3941
|
-
interface InjectedWalletTarget {
|
|
3942
|
-
id: string;
|
|
3943
|
-
name: string;
|
|
3944
|
-
provider: EIP1193Provider;
|
|
3945
|
-
}
|
|
3946
|
-
/**
|
|
3947
|
-
* Returns the EIP-6963 discovered MetaMask provider when available.
|
|
3948
|
-
*/
|
|
3949
|
-
declare function getEip6963MetaMaskProvider(): EIP1193Provider | null;
|
|
3950
|
-
declare function getEip6963RabbyProvider(): EIP1193Provider | null;
|
|
3951
|
-
/**
|
|
3952
|
-
* Resolves the MetaMask injected target for wagmi/RainbowKit.
|
|
3953
|
-
* Never returns undefined — wagmi's injected() connector falls back to
|
|
3954
|
-
* window.ethereum (often Rabby) when target() is undefined.
|
|
3955
|
-
*/
|
|
3956
|
-
declare function resolveMetaMaskInjectedTarget(): InjectedWalletTarget;
|
|
3957
|
-
/**
|
|
3958
|
-
* Resolves the Rabby injected target for wagmi/RainbowKit.
|
|
3959
|
-
* Never returns undefined — avoids wagmi falling back to a generic injected provider.
|
|
3960
|
-
*/
|
|
3961
|
-
declare function resolveRabbyInjectedTarget(): InjectedWalletTarget;
|
|
3962
|
-
/**
|
|
3963
|
-
* Returns the typed EIP-1193 provider from `window.ethereum`, or null if unavailable.
|
|
3964
|
-
* Use this instead of `window.ethereum as any` throughout the codebase.
|
|
3965
|
-
* Handles the case where window.ethereum access may throw due to property
|
|
3966
|
-
* redefinition conflicts between wallet extensions.
|
|
3967
|
-
*/
|
|
3968
|
-
declare function getEthereumProvider(): EIP1193Provider | null;
|
|
3969
|
-
/** Minimal wagmi-connector shape needed to resolve its EIP-1193 provider. */
|
|
3970
|
-
interface ConnectorProviderSource {
|
|
3971
|
-
getProvider?: (params?: {
|
|
3972
|
-
chainId?: number;
|
|
3973
|
-
}) => Promise<unknown>;
|
|
3974
|
-
}
|
|
3975
|
-
/**
|
|
3976
|
-
* Resolves the EIP-1193 provider for the wallet the user actually connected.
|
|
3977
|
-
* Prefers the wagmi connector's provider (the exact wallet chosen via
|
|
3978
|
-
* RainbowKit), then the EIP-6963 MetaMask provider, and only then the
|
|
3979
|
-
* window.ethereum global — which belongs to whichever extension won the
|
|
3980
|
-
* injection race when multiple wallets are installed, so signing through it
|
|
3981
|
-
* can pop up a wallet the user never connected.
|
|
3982
|
-
*/
|
|
3983
|
-
declare function resolveConnectedProvider(connector?: ConnectorProviderSource | null): Promise<EIP1193Provider | null>;
|
|
3984
|
-
|
|
3985
4081
|
/** Matches coti-snap useTokenOperations private 256-bit transfer selector. */
|
|
3986
4082
|
declare const PRIVATE_ERC20_TRANSFER_256_SIG = "transfer(address,((uint256,uint256),bytes))";
|
|
3987
4083
|
declare function resolvePrivateTokenContractAddress(chainId: number, addressKey: string): string | undefined;
|
|
@@ -4759,4 +4855,4 @@ declare function muteChainUpdates(): void;
|
|
|
4759
4855
|
declare function unmuteChainUpdates(): void;
|
|
4760
4856
|
declare function isChainUpdatesMuted(): boolean;
|
|
4761
4857
|
|
|
4762
|
-
export { type AesKeyChainId, type AesKeyProviderOptions, BRIDGE_ABI, BRIDGE_ERC20_ABI, type BridgeData, type BridgeFees, type BridgeStatus, CHAIN_CONFIGS, CONTRACT_ADDRESSES, COTI_MAINNET_CHAIN_ID, COTI_MAINNET_RPC, COTI_PRICE_CONSUMER_ABI, COTI_TESTNET_CHAIN_ID$1 as COTI_TESTNET_CHAIN_ID, COTI_TESTNET_POD_INBOX, COTI_TESTNET_RPC, type ChainIndexPageUi, type ConnectorProviderSource, type CotiBridgeFeeQuote, CotiErrorCode, type CotiPluginConfig, CotiPluginError, DEFAULT_CHAIN_ID, DEFAULT_POD_BALANCE_STATE, DEFAULT_POD_EXPLORER_BASE_URL, type EIP1193Provider, ERC20_ABI, ETHEREUM_MAINNET_CHAIN_ID, ETHEREUM_MAINNET_RPC, type EncryptedAesBackup, type FeeEstimate, type GrantResult, LIMITS, type Logger, MINIMUM_PORTAL_IN_AMOUNTS, MULTIPLE_WALLETS_ERROR_SUBSTRING, type NetworkEnforcerResult, NetworkGuard, type NetworkGuardProps, ONBOARDING_STEPS, ONBOARD_MODAL_STYLE_KEYS, OnboardModal, type OnboardModalPage, type OnboardModalProps, type OnboardModalTheme, type OnboardModalWarnings, type OnboardingProgressCallback, type OnboardingServiceRequest, type OnboardingServices, type OnboardingStep, type OnboardingStepInfo, COTI_TESTNET_CHAIN_ID as POD_COTI_TESTNET_CHAIN_ID, POD_INBOX_ADDRESS, POD_PORTAL_ADMIN_ABI, POD_PRICE_ORACLE_ABI, POD_PTOKEN_ABI, SEPOLIA_CHAIN_ID as POD_SEPOLIA_CHAIN_ID, PRIVACY_PORTAL_ABI, PRIVATE_ERC20_TRANSFER_256_SIG, type PodBalanceState, type PodBalanceTrustState, type PodPortalFeeQuote, type PodPortalRequest, type PodPortalRequestStatus, type PodWithdrawPermit, type ChainConfig as PortalChainConfig, type PortalStrategy, type PrivacyBridgeContextType, type PrivacyBridgeModalsContextValue, type PrivacyBridgeNetworkContextValue, type PrivacyBridgePodContextValue, PrivacyBridgeProvider, type PrivacyBridgeProviderProps, type PrivacyBridgeSwapContextValue, type PrivacyBridgeTokensContextValue, type PrivacyBridgeUnlockContextValue, type PrivacyBridgeWalletContextValue, type PrivateUnlockControllerValue, PrivateUnlockProvider, type PrivateUnlockProviderOptions, type PrivateUnlockProviderProps, type RefreshPrivateBalancesOptions, type ResolvedIndexPageUi, SEPOLIA_CHAIN_ID$1 as SEPOLIA_CHAIN_ID, SEPOLIA_RPC, SEPOLIA_RPC_FALLBACK, SUPPORTED_TOKENS, type SaveEncryptedAesBackupRequest, type SimulationResult, TOKEN_ABI, type TokenConfig, type UnlockStrategy, WALLET_CONNECT_FAILURE_EVENT, type WagmiConfigOptions, WagmiRainbowKitProvider, type WalletConnectFailureDetail, type WalletNetworkConfig, type WalletType, type WalletTypeInfo, addThousandsSeparators, buildPodExplorerRequestUrl, computeCotiFee, computeErc20Fee, configureCotiPlugin, cotiMainnet, cotiTestnet, estimateBridgeFee, estimateCotiBridgeGasFeeDisplay, estimatePodPortalFees, ethereumMainnet, executePodPortalTransaction, fetchBridgeFees, fetchPodBridgeData, fetchPodOracleTokenUsdPrice, fetchTokenUsdPrice, formatBalanceWithNotation, formatPodFeeDisplay, formatPortalFeeDisplay, formatTokenBalanceDisplay, getChainConfig, getChainIdConstants, getContractAddresses, getEip6963MetaMaskProvider, getEip6963RabbyProvider, getEthereumProvider, getExplorerBaseUrlForChain, getNetworkNameForChain, getPluginConfig, getPodGasPrice, getPodInboxAddress, getPodSdkConfig, getPrivateTokensForChain, getPublicTokensForChain, getRpcUrlForChain, getRpcUrlForChainId, getRpcUrlsForChain, getSepoliaGasPrice, getSnapRequestParams, getTokenSimulationMeta, getTokensForChain, getUnlockStrategyForChain, getWagmiConfig, getWalletNetworkConfigs, getWalletNetworkOptions, hasCotiErrorCode, isChainUpdatesMuted, isCotiPluginError, isMultipleWalletsError, isSnapEnabled, loadPodRequests, logger, mobileZerionWallet, muteChainUpdates, defaultStyles as onboardModalDefaultStyles, podRequestsStorageKey, quoteCotiBridgeFees, quotePodPortalTransactionFees, quotePortalFeeOnly, requireChainConfig, resolveConnectedProvider, resolveIndexPageUi, resolveMetaMaskInjectedTarget, resolvePodRequestStatus, resolvePodTxGasPrice, resolvePrivateTokenContractAddress, resolvePrivateTokenTransferTarget, resolveRabbyInjectedTarget, savePodRequests, sepolia, setDebugLogging, signPodWithdrawPermit, simulateFeeOnChain, simulatePodPortalFee, truncateDecimalValue, unmuteChainUpdates, useBalanceUpdater, useBridgeData, useBridgeStatus, useMetamask, useNetworkEnforcer, usePrivacyBridgeContext, usePrivacyBridgeModals, usePrivacyBridgeNetwork, usePrivacyBridgePod, usePrivacyBridgeSwap, usePrivacyBridgeTokens, usePrivacyBridgeUnlock, usePrivacyBridgeWallet, usePrivateTokenBalance, usePrivateUnlock, useWalletType, wagmiConfig };
|
|
4858
|
+
export { type AesKeyChainId, type AesKeyProviderOptions, BRIDGE_ABI, BRIDGE_ERC20_ABI, type BridgeData, type BridgeFees, type BridgeStatus, CHAIN_CONFIGS, CONTRACT_ADDRESSES, COTI_MAINNET_CHAIN_ID, COTI_MAINNET_RPC, COTI_PRICE_CONSUMER_ABI, COTI_TESTNET_CHAIN_ID$1 as COTI_TESTNET_CHAIN_ID, COTI_TESTNET_POD_INBOX, COTI_TESTNET_RPC, type ChainIndexPageUi, type ConnectorProviderSource, type CotiBridgeFeeQuote, CotiErrorCode, type CotiPluginConfig, CotiPluginError, DEFAULT_CHAIN_ID, DEFAULT_POD_BALANCE_STATE, DEFAULT_POD_EXPLORER_BASE_URL, type EIP1193Provider, ERC20_ABI, ETHEREUM_MAINNET_CHAIN_ID, ETHEREUM_MAINNET_RPC, type EncryptedAesBackup, type FeeEstimate, type GrantResult, LIMITS, type Logger, MINIMUM_PORTAL_IN_AMOUNTS, MULTIPLE_WALLETS_ERROR_SUBSTRING, type NetworkEnforcerResult, NetworkGuard, type NetworkGuardProps, ONBOARDING_STEPS, ONBOARD_MODAL_STYLE_KEYS, OnboardModal, type OnboardModalPage, type OnboardModalProps, type OnboardModalTheme, type OnboardModalWarnings, type OnboardingProgressCallback, type OnboardingServiceRequest, type OnboardingServices, type OnboardingStep, type OnboardingStepInfo, COTI_TESTNET_CHAIN_ID as POD_COTI_TESTNET_CHAIN_ID, POD_INBOX_ADDRESS, POD_PORTAL_ADMIN_ABI, POD_PRICE_ORACLE_ABI, POD_PTOKEN_ABI, SEPOLIA_CHAIN_ID as POD_SEPOLIA_CHAIN_ID, PRIVACY_PORTAL_ABI, PRIVATE_ERC20_TRANSFER_256_SIG, type PodBalanceState, type PodBalanceTrustState, type PodPortalFeeQuote, type PodPortalRequest, type PodPortalRequestStatus, type PodTransferFeeQuote, type PodWithdrawPermit, type ChainConfig as PortalChainConfig, type PortalStrategy, type PrivacyBridgeContextType, type PrivacyBridgeModalsContextValue, type PrivacyBridgeNetworkContextValue, type PrivacyBridgePodContextValue, PrivacyBridgeProvider, type PrivacyBridgeProviderProps, type PrivacyBridgeSwapContextValue, type PrivacyBridgeTokensContextValue, type PrivacyBridgeUnlockContextValue, type PrivacyBridgeWalletContextValue, type PrivateUnlockControllerValue, PrivateUnlockProvider, type PrivateUnlockProviderOptions, type PrivateUnlockProviderProps, type RefreshPrivateBalancesOptions, type ResolvedIndexPageUi, SEPOLIA_CHAIN_ID$1 as SEPOLIA_CHAIN_ID, SEPOLIA_RPC, SEPOLIA_RPC_FALLBACK, SUPPORTED_TOKENS, type SaveEncryptedAesBackupRequest, type SimulationResult, TOKEN_ABI, type TokenConfig, type UnlockStrategy, WALLET_CONNECT_FAILURE_EVENT, type WagmiConfigOptions, WagmiRainbowKitProvider, type WalletConnectFailureDetail, type WalletNetworkConfig, type WalletType, type WalletTypeInfo, addThousandsSeparators, assertPodPTokenReady, buildPodExplorerRequestUrl, buildPodTransferMethodArgs, computeCotiFee, computeErc20Fee, configureCotiPlugin, cotiMainnet, cotiTestnet, estimateBridgeFee, estimateCotiBridgeGasFeeDisplay, estimatePodPortalFees, ethereumMainnet, executePodPortalTransaction, executePodPrivateTokenTransfer, fetchBridgeFees, fetchPodBridgeData, fetchPodOracleTokenUsdPrice, fetchTokenUsdPrice, formatBalanceWithNotation, formatPodFeeDisplay, formatPortalFeeDisplay, formatTokenBalanceDisplay, getChainConfig, getChainIdConstants, getContractAddresses, getEip6963MetaMaskProvider, getEip6963RabbyProvider, getEthereumProvider, getExplorerBaseUrlForChain, getNetworkNameForChain, getPluginConfig, getPodGasPrice, getPodInboxAddress, getPodSdkConfig, getPrivateTokensForChain, getPublicTokensForChain, getRpcUrlForChain, getRpcUrlForChainId, getRpcUrlsForChain, getSepoliaGasPrice, getSnapRequestParams, getTokenSimulationMeta, getTokensForChain, getUnlockStrategyForChain, getWagmiConfig, getWalletNetworkConfigs, getWalletNetworkOptions, hasCotiErrorCode, isChainUpdatesMuted, isCotiPluginError, isMultipleWalletsError, isSnapEnabled, loadPodRequests, logger, mobileZerionWallet, muteChainUpdates, defaultStyles as onboardModalDefaultStyles, podRequestsStorageKey, quoteCotiBridgeFees, quotePodPortalTransactionFees, quotePodPrivateTokenTransferFees, quotePodTransferFees, quotePortalFeeOnly, requireChainConfig, resolveConnectedProvider, resolveIndexPageUi, resolveMetaMaskInjectedTarget, resolvePodRequestStatus, resolvePodTxGasPrice, resolvePrivateTokenContractAddress, resolvePrivateTokenTransferTarget, resolveRabbyInjectedTarget, savePodRequests, sepolia, setDebugLogging, signPodWithdrawPermit, simulateFeeOnChain, simulatePodPortalFee, truncateDecimalValue, unmuteChainUpdates, useBalanceUpdater, useBridgeData, useBridgeStatus, useMetamask, useNetworkEnforcer, usePodTransferFees, usePrivacyBridgeContext, usePrivacyBridgeModals, usePrivacyBridgeNetwork, usePrivacyBridgePod, usePrivacyBridgeSwap, usePrivacyBridgeTokens, usePrivacyBridgeUnlock, usePrivacyBridgeWallet, usePrivateTokenBalance, usePrivateUnlock, useWalletType, wagmiConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigNumberish, ethers } from 'ethers';
|
|
2
|
-
import { PodFeeEstimate, PodSdkConfig } from '@coti-io/pod-sdk';
|
|
2
|
+
import { PodFeeEstimate, PodSdkConfig, PodMethodArgument } from '@coti-io/pod-sdk';
|
|
3
3
|
import react from 'react';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as viem from 'viem';
|
|
@@ -42,6 +42,12 @@ interface PodFeeEstimationLimits {
|
|
|
42
42
|
forwardGasLimit: bigint;
|
|
43
43
|
callBackGasLimit: bigint;
|
|
44
44
|
callBackDataSize?: bigint;
|
|
45
|
+
/**
|
|
46
|
+
* Inbox forward calldata size (bytes). Required for encrypted methods (e.g. itUint256
|
|
47
|
+
* transfer) — plaintext arg-length heuristics understate encrypted payloads.
|
|
48
|
+
* PodERC20 uses 512 for remote call size.
|
|
49
|
+
*/
|
|
50
|
+
forwardDataSize?: bigint;
|
|
45
51
|
}
|
|
46
52
|
interface ChainIndexPageUi {
|
|
47
53
|
/** Extra section below token cards (e.g. PoD request tracker on Sepolia). */
|
|
@@ -66,10 +72,11 @@ interface ChainConfig {
|
|
|
66
72
|
unlockStrategy: UnlockStrategy;
|
|
67
73
|
portalStrategy: PortalStrategy;
|
|
68
74
|
walletNetwork: WalletNetworkConfig;
|
|
69
|
-
/** Inbox fee estimation gas limits for PoD portal deposit/withdraw. */
|
|
75
|
+
/** Inbox fee estimation gas limits for PoD portal deposit/withdraw and pToken transfer. */
|
|
70
76
|
podFeeEstimation?: {
|
|
71
77
|
deposit: PodFeeEstimationLimits;
|
|
72
78
|
withdraw: PodFeeEstimationLimits;
|
|
79
|
+
transfer: PodFeeEstimationLimits;
|
|
73
80
|
};
|
|
74
81
|
/** Main Index page: which chrome and labels to show for this chain. */
|
|
75
82
|
indexPage: ChainIndexPageUi;
|
|
@@ -273,7 +280,16 @@ interface CotiPluginConfig {
|
|
|
273
280
|
* Only COTI Testnet and COTI Mainnet can hold AES keys.
|
|
274
281
|
*/
|
|
275
282
|
aesKeyChainId?: AesKeyChainId;
|
|
276
|
-
/**
|
|
283
|
+
/**
|
|
284
|
+
* When false, skips native COTI grant requests during onboarding.
|
|
285
|
+
* Default: true. Uses built-in grant API when no custom grantNativeCoti is set.
|
|
286
|
+
*/
|
|
287
|
+
onboardingGrantEnabled?: boolean;
|
|
288
|
+
/** COTI Testnet gas-grant endpoint. Default: official COTI Testnet grant API. */
|
|
289
|
+
grantApiUrlTestnet?: string;
|
|
290
|
+
/** COTI Mainnet gas-grant endpoint. No default — grant is skipped on mainnet until set. */
|
|
291
|
+
grantApiUrlMainnet?: string;
|
|
292
|
+
/** Native COTI threshold required before contract onboarding. Defaults to 0.2 COTI. */
|
|
277
293
|
onboardingGrantMinBalanceWei?: BigNumberish;
|
|
278
294
|
/** Polling interval after grant callback. Defaults to 2000ms. */
|
|
279
295
|
onboardingGrantPollIntervalMs?: number;
|
|
@@ -442,7 +458,7 @@ declare const DEFAULT_POD_BALANCE_STATE: PodBalanceState;
|
|
|
442
458
|
type PodPortalRequestStatus = "wallet-signing" | "source-submitted" | "source-mined" | "target-mined" | "callback-generated" | "pod-pending" | "callback-errored" | "succeeded" | "failed" | "burn-debt";
|
|
443
459
|
interface PodPortalRequest {
|
|
444
460
|
id: string;
|
|
445
|
-
kind: "deposit" | "withdraw";
|
|
461
|
+
kind: "deposit" | "withdraw" | "transfer";
|
|
446
462
|
chainId: number;
|
|
447
463
|
sourceTxHash: string;
|
|
448
464
|
requestId?: string;
|
|
@@ -472,7 +488,7 @@ declare const PRIVACY_PORTAL_ABI: readonly ["function underlyingToken() view ret
|
|
|
472
488
|
* - maxFee == type(uint128).max is the deployed "no cap" sentinel.
|
|
473
489
|
*/
|
|
474
490
|
declare const POD_PORTAL_ADMIN_ABI: readonly ["function owner() view returns (address)", "function setDepositFee(uint256 fixedFee, uint256 percentageBps, uint256 maxFee)", "function setWithdrawFee(uint256 fixedFee, uint256 percentageBps, uint256 maxFee)", "function getFeeConfig(bool isDeposit) view returns (uint256 fixedFee, uint256 percentageBps, uint256 maxFee)", "function accumulatedPortalFees() view returns (uint256)", "function estimateDepositFees(uint256 amount) view returns (uint256 portalFee,bool usedDynamicPricing,uint256 mintTotalFee,uint256 mintCallbackFee)", "function estimateWithdrawFees(uint256 amount) view returns (uint256 portalFee,bool usedDynamicPricing,uint256 transferTotalFee,uint256 transferCallbackFee)"];
|
|
475
|
-
declare const POD_PTOKEN_ABI: readonly ["function name() view returns (string)", "function symbol() view returns (string)", "function decimals() view returns (uint8)", "function nonces(address owner) view returns (uint256)", "function failedRequests(bytes32 requestId) view returns (bytes)", "function balanceOf(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow))", "function balanceWithState(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow) balance,bool pending,bool callbackErrored)", "function balanceOfWithStatus(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow),bool)", "error TransferAlreadyPending(address from, address to, bytes32 requestId)", "event TransferRequestSubmitted(address indexed from,address indexed to,bytes32 requestId)", "event Transfer(address indexed from,address indexed to,bytes senderValue,bytes receiverValue)", "event TransferFailed(address indexed from,address indexed to,bytes errorMsg)", "event RequestCallbackFailed(address indexed from,address indexed to,bytes32 requestId,bytes callbackData)"];
|
|
491
|
+
declare const POD_PTOKEN_ABI: readonly ["function name() view returns (string)", "function symbol() view returns (string)", "function decimals() view returns (uint8)", "function nonces(address owner) view returns (uint256)", "function failedRequests(bytes32 requestId) view returns (bytes)", "function balanceOf(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow))", "function balanceWithState(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow) balance,bool pending,bool callbackErrored)", "function balanceOfWithStatus(address account) view returns (tuple(uint256 ciphertextHigh,uint256 ciphertextLow),bool)", "function transfer(address to, ((uint256,uint256),bytes) value, uint256 callbackFeeLocalWei) payable returns (bytes32)", "function estimateFee() view returns (uint256 totalFeeWei, uint256 targetFeeWei, uint256 callbackFeeWei)", "error TransferAlreadyPending(address from, address to, bytes32 requestId)", "event TransferRequestSubmitted(address indexed from,address indexed to,bytes32 requestId)", "event Transfer(address indexed from,address indexed to,bytes senderValue,bytes receiverValue)", "event TransferFailed(address indexed from,address indexed to,bytes errorMsg)", "event RequestCallbackFailed(address indexed from,address indexed to,bytes32 requestId,bytes callbackData)"];
|
|
476
492
|
|
|
477
493
|
declare const podRequestsStorageKey: (wallet?: string) => string;
|
|
478
494
|
declare function loadPodRequests(wallet?: string): PodPortalRequest[];
|
|
@@ -611,6 +627,13 @@ declare const quotePodPortalTransactionFees: (params: {
|
|
|
611
627
|
gasPrice?: bigint;
|
|
612
628
|
}) => Promise<PodPortalFeeQuote>;
|
|
613
629
|
|
|
630
|
+
type PodPTokenReadinessDebugContext = {
|
|
631
|
+
portalAddress?: string;
|
|
632
|
+
tokenSymbol?: string;
|
|
633
|
+
chainId?: number;
|
|
634
|
+
provider?: ethers.Provider | null;
|
|
635
|
+
};
|
|
636
|
+
declare const assertPodPTokenReady: (pToken: ethers.Contract, account: string, action: "deposit" | "withdraw" | "transfer", debugContext?: PodPTokenReadinessDebugContext) => Promise<void>;
|
|
614
637
|
declare function signPodWithdrawPermit(params: {
|
|
615
638
|
signer: ethers.JsonRpcSigner;
|
|
616
639
|
pTokenAddress: string;
|
|
@@ -640,6 +663,138 @@ declare function executePodPortalTransaction(params: {
|
|
|
640
663
|
receipt: ethers.TransactionReceipt;
|
|
641
664
|
}>;
|
|
642
665
|
|
|
666
|
+
/**
|
|
667
|
+
* Typed EIP-1193 provider interface for window.ethereum access.
|
|
668
|
+
* Eliminates `as any` casts throughout the codebase.
|
|
669
|
+
*/
|
|
670
|
+
interface EIP1193Provider {
|
|
671
|
+
request: (args: {
|
|
672
|
+
method: string;
|
|
673
|
+
params?: unknown[] | Record<string, unknown>;
|
|
674
|
+
}) => Promise<any>;
|
|
675
|
+
isMetaMask?: boolean;
|
|
676
|
+
isRabby?: boolean;
|
|
677
|
+
isPhantom?: boolean;
|
|
678
|
+
on?: (event: string, handler: (...args: any[]) => void) => void;
|
|
679
|
+
removeListener?: (event: string, handler: (...args: any[]) => void) => void;
|
|
680
|
+
providers?: EIP1193Provider[];
|
|
681
|
+
}
|
|
682
|
+
interface InjectedWalletTarget {
|
|
683
|
+
id: string;
|
|
684
|
+
name: string;
|
|
685
|
+
provider: EIP1193Provider;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Returns the EIP-6963 discovered MetaMask provider when available.
|
|
689
|
+
*/
|
|
690
|
+
declare function getEip6963MetaMaskProvider(): EIP1193Provider | null;
|
|
691
|
+
declare function getEip6963RabbyProvider(): EIP1193Provider | null;
|
|
692
|
+
/**
|
|
693
|
+
* Resolves the MetaMask injected target for wagmi/RainbowKit.
|
|
694
|
+
* Never returns undefined — wagmi's injected() connector falls back to
|
|
695
|
+
* window.ethereum (often Rabby) when target() is undefined.
|
|
696
|
+
*/
|
|
697
|
+
declare function resolveMetaMaskInjectedTarget(): InjectedWalletTarget;
|
|
698
|
+
/**
|
|
699
|
+
* Resolves the Rabby injected target for wagmi/RainbowKit.
|
|
700
|
+
* Never returns undefined — avoids wagmi falling back to a generic injected provider.
|
|
701
|
+
*/
|
|
702
|
+
declare function resolveRabbyInjectedTarget(): InjectedWalletTarget;
|
|
703
|
+
/**
|
|
704
|
+
* Returns the typed EIP-1193 provider from `window.ethereum`, or null if unavailable.
|
|
705
|
+
* Use this instead of `window.ethereum as any` throughout the codebase.
|
|
706
|
+
* Handles the case where window.ethereum access may throw due to property
|
|
707
|
+
* redefinition conflicts between wallet extensions.
|
|
708
|
+
*/
|
|
709
|
+
declare function getEthereumProvider(): EIP1193Provider | null;
|
|
710
|
+
/** Minimal wagmi-connector shape needed to resolve its EIP-1193 provider. */
|
|
711
|
+
interface ConnectorProviderSource {
|
|
712
|
+
getProvider?: (params?: {
|
|
713
|
+
chainId?: number;
|
|
714
|
+
}) => Promise<unknown>;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Resolves the EIP-1193 provider for the wallet the user actually connected.
|
|
718
|
+
* Prefers the wagmi connector's provider (the exact wallet chosen via
|
|
719
|
+
* RainbowKit), then the EIP-6963 MetaMask provider, and only then the
|
|
720
|
+
* window.ethereum global — which belongs to whichever extension won the
|
|
721
|
+
* injection race when multiple wallets are installed, so signing through it
|
|
722
|
+
* can pop up a wallet the user never connected.
|
|
723
|
+
*/
|
|
724
|
+
declare function resolveConnectedProvider(connector?: ConnectorProviderSource | null): Promise<EIP1193Provider | null>;
|
|
725
|
+
|
|
726
|
+
type PodTransferFeeQuote = {
|
|
727
|
+
gasPrice: bigint;
|
|
728
|
+
podInboxFeeWei: bigint;
|
|
729
|
+
podCallbackFeeWei: bigint;
|
|
730
|
+
l1ExecutionGasWei: bigint;
|
|
731
|
+
podFeeEstimate: PodFeeEstimate;
|
|
732
|
+
display: {
|
|
733
|
+
podInboxFee: string;
|
|
734
|
+
l1Gas: string;
|
|
735
|
+
feeSymbol: string;
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
declare const buildPodTransferMethodArgs: (params: {
|
|
739
|
+
recipient: string;
|
|
740
|
+
amountWei: bigint;
|
|
741
|
+
}) => PodMethodArgument[];
|
|
742
|
+
/** Single source of truth for PoD pToken Send fee quotes — one gasPrice, inbox + L1 gas. */
|
|
743
|
+
declare const quotePodTransferFees: (params: {
|
|
744
|
+
runner: ethers.ContractRunner;
|
|
745
|
+
chainId: number;
|
|
746
|
+
pTokenAddress: string;
|
|
747
|
+
recipient: string;
|
|
748
|
+
amountWei: bigint;
|
|
749
|
+
gasPrice?: bigint;
|
|
750
|
+
}) => Promise<PodTransferFeeQuote>;
|
|
751
|
+
|
|
752
|
+
interface ExecutePodPrivateTokenTransferParams {
|
|
753
|
+
chainId: number;
|
|
754
|
+
symbol: string;
|
|
755
|
+
recipient: string;
|
|
756
|
+
amount: string;
|
|
757
|
+
walletAddress: string;
|
|
758
|
+
provider?: EIP1193Provider | null;
|
|
759
|
+
}
|
|
760
|
+
interface ExecutePodPrivateTokenTransferResult {
|
|
761
|
+
txHash: string;
|
|
762
|
+
request?: PodPortalRequest;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* PoD pToken peer Send — quote + encrypt + pay inbox fee via `@coti-io/pod-sdk`,
|
|
766
|
+
* mirroring portal in/out fee/send discipline (pinned gasPrice, callback fee slot).
|
|
767
|
+
*/
|
|
768
|
+
declare function executePodPrivateTokenTransfer(params: ExecutePodPrivateTokenTransferParams): Promise<ExecutePodPrivateTokenTransferResult>;
|
|
769
|
+
/** Quote PoD transfer fees for UI (recipient may be a placeholder when unknown). */
|
|
770
|
+
declare function quotePodPrivateTokenTransferFees(params: {
|
|
771
|
+
chainId: number;
|
|
772
|
+
symbol: string;
|
|
773
|
+
recipient: string;
|
|
774
|
+
amount: string;
|
|
775
|
+
walletAddress: string;
|
|
776
|
+
provider?: EIP1193Provider | null;
|
|
777
|
+
}): Promise<PodTransferFeeQuote>;
|
|
778
|
+
|
|
779
|
+
interface UsePodTransferFeesOptions {
|
|
780
|
+
isConnected: boolean;
|
|
781
|
+
walletAddress?: string;
|
|
782
|
+
chainId?: number;
|
|
783
|
+
symbol?: string;
|
|
784
|
+
recipient?: string;
|
|
785
|
+
amount: string;
|
|
786
|
+
enabled?: boolean;
|
|
787
|
+
}
|
|
788
|
+
/** PoD pToken Send fee quotes — inbox fee + L1 gas in native token. */
|
|
789
|
+
declare const usePodTransferFees: ({ isConnected, walletAddress, chainId, symbol, recipient, amount, enabled, }: UsePodTransferFeesOptions) => {
|
|
790
|
+
podInboxFee: string | null;
|
|
791
|
+
l1GasFee: string | null;
|
|
792
|
+
feeSymbol: string;
|
|
793
|
+
isGasEstimating: boolean;
|
|
794
|
+
refreshFees: () => Promise<void>;
|
|
795
|
+
isPodChain: boolean;
|
|
796
|
+
};
|
|
797
|
+
|
|
643
798
|
/**
|
|
644
799
|
* PoDPriceOracle deployed alongside the PoD privacy portals (Band adapter on
|
|
645
800
|
* Sepolia, Chainlink adapter on Fuji). Prices are 18-decimal USD per whole
|
|
@@ -3785,6 +3940,7 @@ interface PrivacyBridgeUnlockContextValue {
|
|
|
3785
3940
|
amount: string;
|
|
3786
3941
|
}) => Promise<{
|
|
3787
3942
|
txHash: string;
|
|
3943
|
+
request?: PodPortalRequest;
|
|
3788
3944
|
}>;
|
|
3789
3945
|
/** Encrypt a human-readable amount into ctUint256 JSON without exposing the AES key. */
|
|
3790
3946
|
encryptPrivateValue: (params: {
|
|
@@ -3922,66 +4078,6 @@ interface FeeEstimate {
|
|
|
3922
4078
|
}
|
|
3923
4079
|
declare function estimateBridgeFee(symbol: string, amount: string, provider: ethers.JsonRpcProvider | ethers.BrowserProvider): Promise<FeeEstimate>;
|
|
3924
4080
|
|
|
3925
|
-
/**
|
|
3926
|
-
* Typed EIP-1193 provider interface for window.ethereum access.
|
|
3927
|
-
* Eliminates `as any` casts throughout the codebase.
|
|
3928
|
-
*/
|
|
3929
|
-
interface EIP1193Provider {
|
|
3930
|
-
request: (args: {
|
|
3931
|
-
method: string;
|
|
3932
|
-
params?: unknown[] | Record<string, unknown>;
|
|
3933
|
-
}) => Promise<any>;
|
|
3934
|
-
isMetaMask?: boolean;
|
|
3935
|
-
isRabby?: boolean;
|
|
3936
|
-
isPhantom?: boolean;
|
|
3937
|
-
on?: (event: string, handler: (...args: any[]) => void) => void;
|
|
3938
|
-
removeListener?: (event: string, handler: (...args: any[]) => void) => void;
|
|
3939
|
-
providers?: EIP1193Provider[];
|
|
3940
|
-
}
|
|
3941
|
-
interface InjectedWalletTarget {
|
|
3942
|
-
id: string;
|
|
3943
|
-
name: string;
|
|
3944
|
-
provider: EIP1193Provider;
|
|
3945
|
-
}
|
|
3946
|
-
/**
|
|
3947
|
-
* Returns the EIP-6963 discovered MetaMask provider when available.
|
|
3948
|
-
*/
|
|
3949
|
-
declare function getEip6963MetaMaskProvider(): EIP1193Provider | null;
|
|
3950
|
-
declare function getEip6963RabbyProvider(): EIP1193Provider | null;
|
|
3951
|
-
/**
|
|
3952
|
-
* Resolves the MetaMask injected target for wagmi/RainbowKit.
|
|
3953
|
-
* Never returns undefined — wagmi's injected() connector falls back to
|
|
3954
|
-
* window.ethereum (often Rabby) when target() is undefined.
|
|
3955
|
-
*/
|
|
3956
|
-
declare function resolveMetaMaskInjectedTarget(): InjectedWalletTarget;
|
|
3957
|
-
/**
|
|
3958
|
-
* Resolves the Rabby injected target for wagmi/RainbowKit.
|
|
3959
|
-
* Never returns undefined — avoids wagmi falling back to a generic injected provider.
|
|
3960
|
-
*/
|
|
3961
|
-
declare function resolveRabbyInjectedTarget(): InjectedWalletTarget;
|
|
3962
|
-
/**
|
|
3963
|
-
* Returns the typed EIP-1193 provider from `window.ethereum`, or null if unavailable.
|
|
3964
|
-
* Use this instead of `window.ethereum as any` throughout the codebase.
|
|
3965
|
-
* Handles the case where window.ethereum access may throw due to property
|
|
3966
|
-
* redefinition conflicts between wallet extensions.
|
|
3967
|
-
*/
|
|
3968
|
-
declare function getEthereumProvider(): EIP1193Provider | null;
|
|
3969
|
-
/** Minimal wagmi-connector shape needed to resolve its EIP-1193 provider. */
|
|
3970
|
-
interface ConnectorProviderSource {
|
|
3971
|
-
getProvider?: (params?: {
|
|
3972
|
-
chainId?: number;
|
|
3973
|
-
}) => Promise<unknown>;
|
|
3974
|
-
}
|
|
3975
|
-
/**
|
|
3976
|
-
* Resolves the EIP-1193 provider for the wallet the user actually connected.
|
|
3977
|
-
* Prefers the wagmi connector's provider (the exact wallet chosen via
|
|
3978
|
-
* RainbowKit), then the EIP-6963 MetaMask provider, and only then the
|
|
3979
|
-
* window.ethereum global — which belongs to whichever extension won the
|
|
3980
|
-
* injection race when multiple wallets are installed, so signing through it
|
|
3981
|
-
* can pop up a wallet the user never connected.
|
|
3982
|
-
*/
|
|
3983
|
-
declare function resolveConnectedProvider(connector?: ConnectorProviderSource | null): Promise<EIP1193Provider | null>;
|
|
3984
|
-
|
|
3985
4081
|
/** Matches coti-snap useTokenOperations private 256-bit transfer selector. */
|
|
3986
4082
|
declare const PRIVATE_ERC20_TRANSFER_256_SIG = "transfer(address,((uint256,uint256),bytes))";
|
|
3987
4083
|
declare function resolvePrivateTokenContractAddress(chainId: number, addressKey: string): string | undefined;
|
|
@@ -4759,4 +4855,4 @@ declare function muteChainUpdates(): void;
|
|
|
4759
4855
|
declare function unmuteChainUpdates(): void;
|
|
4760
4856
|
declare function isChainUpdatesMuted(): boolean;
|
|
4761
4857
|
|
|
4762
|
-
export { type AesKeyChainId, type AesKeyProviderOptions, BRIDGE_ABI, BRIDGE_ERC20_ABI, type BridgeData, type BridgeFees, type BridgeStatus, CHAIN_CONFIGS, CONTRACT_ADDRESSES, COTI_MAINNET_CHAIN_ID, COTI_MAINNET_RPC, COTI_PRICE_CONSUMER_ABI, COTI_TESTNET_CHAIN_ID$1 as COTI_TESTNET_CHAIN_ID, COTI_TESTNET_POD_INBOX, COTI_TESTNET_RPC, type ChainIndexPageUi, type ConnectorProviderSource, type CotiBridgeFeeQuote, CotiErrorCode, type CotiPluginConfig, CotiPluginError, DEFAULT_CHAIN_ID, DEFAULT_POD_BALANCE_STATE, DEFAULT_POD_EXPLORER_BASE_URL, type EIP1193Provider, ERC20_ABI, ETHEREUM_MAINNET_CHAIN_ID, ETHEREUM_MAINNET_RPC, type EncryptedAesBackup, type FeeEstimate, type GrantResult, LIMITS, type Logger, MINIMUM_PORTAL_IN_AMOUNTS, MULTIPLE_WALLETS_ERROR_SUBSTRING, type NetworkEnforcerResult, NetworkGuard, type NetworkGuardProps, ONBOARDING_STEPS, ONBOARD_MODAL_STYLE_KEYS, OnboardModal, type OnboardModalPage, type OnboardModalProps, type OnboardModalTheme, type OnboardModalWarnings, type OnboardingProgressCallback, type OnboardingServiceRequest, type OnboardingServices, type OnboardingStep, type OnboardingStepInfo, COTI_TESTNET_CHAIN_ID as POD_COTI_TESTNET_CHAIN_ID, POD_INBOX_ADDRESS, POD_PORTAL_ADMIN_ABI, POD_PRICE_ORACLE_ABI, POD_PTOKEN_ABI, SEPOLIA_CHAIN_ID as POD_SEPOLIA_CHAIN_ID, PRIVACY_PORTAL_ABI, PRIVATE_ERC20_TRANSFER_256_SIG, type PodBalanceState, type PodBalanceTrustState, type PodPortalFeeQuote, type PodPortalRequest, type PodPortalRequestStatus, type PodWithdrawPermit, type ChainConfig as PortalChainConfig, type PortalStrategy, type PrivacyBridgeContextType, type PrivacyBridgeModalsContextValue, type PrivacyBridgeNetworkContextValue, type PrivacyBridgePodContextValue, PrivacyBridgeProvider, type PrivacyBridgeProviderProps, type PrivacyBridgeSwapContextValue, type PrivacyBridgeTokensContextValue, type PrivacyBridgeUnlockContextValue, type PrivacyBridgeWalletContextValue, type PrivateUnlockControllerValue, PrivateUnlockProvider, type PrivateUnlockProviderOptions, type PrivateUnlockProviderProps, type RefreshPrivateBalancesOptions, type ResolvedIndexPageUi, SEPOLIA_CHAIN_ID$1 as SEPOLIA_CHAIN_ID, SEPOLIA_RPC, SEPOLIA_RPC_FALLBACK, SUPPORTED_TOKENS, type SaveEncryptedAesBackupRequest, type SimulationResult, TOKEN_ABI, type TokenConfig, type UnlockStrategy, WALLET_CONNECT_FAILURE_EVENT, type WagmiConfigOptions, WagmiRainbowKitProvider, type WalletConnectFailureDetail, type WalletNetworkConfig, type WalletType, type WalletTypeInfo, addThousandsSeparators, buildPodExplorerRequestUrl, computeCotiFee, computeErc20Fee, configureCotiPlugin, cotiMainnet, cotiTestnet, estimateBridgeFee, estimateCotiBridgeGasFeeDisplay, estimatePodPortalFees, ethereumMainnet, executePodPortalTransaction, fetchBridgeFees, fetchPodBridgeData, fetchPodOracleTokenUsdPrice, fetchTokenUsdPrice, formatBalanceWithNotation, formatPodFeeDisplay, formatPortalFeeDisplay, formatTokenBalanceDisplay, getChainConfig, getChainIdConstants, getContractAddresses, getEip6963MetaMaskProvider, getEip6963RabbyProvider, getEthereumProvider, getExplorerBaseUrlForChain, getNetworkNameForChain, getPluginConfig, getPodGasPrice, getPodInboxAddress, getPodSdkConfig, getPrivateTokensForChain, getPublicTokensForChain, getRpcUrlForChain, getRpcUrlForChainId, getRpcUrlsForChain, getSepoliaGasPrice, getSnapRequestParams, getTokenSimulationMeta, getTokensForChain, getUnlockStrategyForChain, getWagmiConfig, getWalletNetworkConfigs, getWalletNetworkOptions, hasCotiErrorCode, isChainUpdatesMuted, isCotiPluginError, isMultipleWalletsError, isSnapEnabled, loadPodRequests, logger, mobileZerionWallet, muteChainUpdates, defaultStyles as onboardModalDefaultStyles, podRequestsStorageKey, quoteCotiBridgeFees, quotePodPortalTransactionFees, quotePortalFeeOnly, requireChainConfig, resolveConnectedProvider, resolveIndexPageUi, resolveMetaMaskInjectedTarget, resolvePodRequestStatus, resolvePodTxGasPrice, resolvePrivateTokenContractAddress, resolvePrivateTokenTransferTarget, resolveRabbyInjectedTarget, savePodRequests, sepolia, setDebugLogging, signPodWithdrawPermit, simulateFeeOnChain, simulatePodPortalFee, truncateDecimalValue, unmuteChainUpdates, useBalanceUpdater, useBridgeData, useBridgeStatus, useMetamask, useNetworkEnforcer, usePrivacyBridgeContext, usePrivacyBridgeModals, usePrivacyBridgeNetwork, usePrivacyBridgePod, usePrivacyBridgeSwap, usePrivacyBridgeTokens, usePrivacyBridgeUnlock, usePrivacyBridgeWallet, usePrivateTokenBalance, usePrivateUnlock, useWalletType, wagmiConfig };
|
|
4858
|
+
export { type AesKeyChainId, type AesKeyProviderOptions, BRIDGE_ABI, BRIDGE_ERC20_ABI, type BridgeData, type BridgeFees, type BridgeStatus, CHAIN_CONFIGS, CONTRACT_ADDRESSES, COTI_MAINNET_CHAIN_ID, COTI_MAINNET_RPC, COTI_PRICE_CONSUMER_ABI, COTI_TESTNET_CHAIN_ID$1 as COTI_TESTNET_CHAIN_ID, COTI_TESTNET_POD_INBOX, COTI_TESTNET_RPC, type ChainIndexPageUi, type ConnectorProviderSource, type CotiBridgeFeeQuote, CotiErrorCode, type CotiPluginConfig, CotiPluginError, DEFAULT_CHAIN_ID, DEFAULT_POD_BALANCE_STATE, DEFAULT_POD_EXPLORER_BASE_URL, type EIP1193Provider, ERC20_ABI, ETHEREUM_MAINNET_CHAIN_ID, ETHEREUM_MAINNET_RPC, type EncryptedAesBackup, type FeeEstimate, type GrantResult, LIMITS, type Logger, MINIMUM_PORTAL_IN_AMOUNTS, MULTIPLE_WALLETS_ERROR_SUBSTRING, type NetworkEnforcerResult, NetworkGuard, type NetworkGuardProps, ONBOARDING_STEPS, ONBOARD_MODAL_STYLE_KEYS, OnboardModal, type OnboardModalPage, type OnboardModalProps, type OnboardModalTheme, type OnboardModalWarnings, type OnboardingProgressCallback, type OnboardingServiceRequest, type OnboardingServices, type OnboardingStep, type OnboardingStepInfo, COTI_TESTNET_CHAIN_ID as POD_COTI_TESTNET_CHAIN_ID, POD_INBOX_ADDRESS, POD_PORTAL_ADMIN_ABI, POD_PRICE_ORACLE_ABI, POD_PTOKEN_ABI, SEPOLIA_CHAIN_ID as POD_SEPOLIA_CHAIN_ID, PRIVACY_PORTAL_ABI, PRIVATE_ERC20_TRANSFER_256_SIG, type PodBalanceState, type PodBalanceTrustState, type PodPortalFeeQuote, type PodPortalRequest, type PodPortalRequestStatus, type PodTransferFeeQuote, type PodWithdrawPermit, type ChainConfig as PortalChainConfig, type PortalStrategy, type PrivacyBridgeContextType, type PrivacyBridgeModalsContextValue, type PrivacyBridgeNetworkContextValue, type PrivacyBridgePodContextValue, PrivacyBridgeProvider, type PrivacyBridgeProviderProps, type PrivacyBridgeSwapContextValue, type PrivacyBridgeTokensContextValue, type PrivacyBridgeUnlockContextValue, type PrivacyBridgeWalletContextValue, type PrivateUnlockControllerValue, PrivateUnlockProvider, type PrivateUnlockProviderOptions, type PrivateUnlockProviderProps, type RefreshPrivateBalancesOptions, type ResolvedIndexPageUi, SEPOLIA_CHAIN_ID$1 as SEPOLIA_CHAIN_ID, SEPOLIA_RPC, SEPOLIA_RPC_FALLBACK, SUPPORTED_TOKENS, type SaveEncryptedAesBackupRequest, type SimulationResult, TOKEN_ABI, type TokenConfig, type UnlockStrategy, WALLET_CONNECT_FAILURE_EVENT, type WagmiConfigOptions, WagmiRainbowKitProvider, type WalletConnectFailureDetail, type WalletNetworkConfig, type WalletType, type WalletTypeInfo, addThousandsSeparators, assertPodPTokenReady, buildPodExplorerRequestUrl, buildPodTransferMethodArgs, computeCotiFee, computeErc20Fee, configureCotiPlugin, cotiMainnet, cotiTestnet, estimateBridgeFee, estimateCotiBridgeGasFeeDisplay, estimatePodPortalFees, ethereumMainnet, executePodPortalTransaction, executePodPrivateTokenTransfer, fetchBridgeFees, fetchPodBridgeData, fetchPodOracleTokenUsdPrice, fetchTokenUsdPrice, formatBalanceWithNotation, formatPodFeeDisplay, formatPortalFeeDisplay, formatTokenBalanceDisplay, getChainConfig, getChainIdConstants, getContractAddresses, getEip6963MetaMaskProvider, getEip6963RabbyProvider, getEthereumProvider, getExplorerBaseUrlForChain, getNetworkNameForChain, getPluginConfig, getPodGasPrice, getPodInboxAddress, getPodSdkConfig, getPrivateTokensForChain, getPublicTokensForChain, getRpcUrlForChain, getRpcUrlForChainId, getRpcUrlsForChain, getSepoliaGasPrice, getSnapRequestParams, getTokenSimulationMeta, getTokensForChain, getUnlockStrategyForChain, getWagmiConfig, getWalletNetworkConfigs, getWalletNetworkOptions, hasCotiErrorCode, isChainUpdatesMuted, isCotiPluginError, isMultipleWalletsError, isSnapEnabled, loadPodRequests, logger, mobileZerionWallet, muteChainUpdates, defaultStyles as onboardModalDefaultStyles, podRequestsStorageKey, quoteCotiBridgeFees, quotePodPortalTransactionFees, quotePodPrivateTokenTransferFees, quotePodTransferFees, quotePortalFeeOnly, requireChainConfig, resolveConnectedProvider, resolveIndexPageUi, resolveMetaMaskInjectedTarget, resolvePodRequestStatus, resolvePodTxGasPrice, resolvePrivateTokenContractAddress, resolvePrivateTokenTransferTarget, resolveRabbyInjectedTarget, savePodRequests, sepolia, setDebugLogging, signPodWithdrawPermit, simulateFeeOnChain, simulatePodPortalFee, truncateDecimalValue, unmuteChainUpdates, useBalanceUpdater, useBridgeData, useBridgeStatus, useMetamask, useNetworkEnforcer, usePodTransferFees, usePrivacyBridgeContext, usePrivacyBridgeModals, usePrivacyBridgeNetwork, usePrivacyBridgePod, usePrivacyBridgeSwap, usePrivacyBridgeTokens, usePrivacyBridgeUnlock, usePrivacyBridgeWallet, usePrivateTokenBalance, usePrivateUnlock, useWalletType, wagmiConfig };
|