@pafi-dev/core 0.25.1 → 0.25.2

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.cts CHANGED
@@ -104,6 +104,11 @@ declare const V3_FACTORY_ADDRESSES: Record<number, Address>;
104
104
  * Pool-init code hash for PAFI's V3 deployment. Combined with the factory
105
105
  * address + sorted tokens + fee, deterministically yields a pool's
106
106
  * address via the standard Uniswap V3 CREATE2 derivation.
107
+ *
108
+ * ⚠️ MULTI-CHAIN: this is a SINGLE Base value. The Arbitrum PAFI fork hash
109
+ * is identical ONLY if the pool bytecode matches — confirm with the SC team.
110
+ * When Arbitrum goes live, promote this to `Record<number, Hex>` (like the
111
+ * factory map above). See docs/ARBITRUM_ADDRESSES.md.
107
112
  */
108
113
  declare const V3_POOL_INIT_CODE_HASH: Hex;
109
114
  declare const COMMON_TOKENS: Record<number, Record<string, Address>>;
@@ -124,9 +129,16 @@ declare const ENTRY_POINT_V07: Address;
124
129
  * see `AA23 reverted account: not from EntryPoint`.
125
130
  */
126
131
  declare const ENTRY_POINT_V08: Address;
127
- /** Permit2 — Uniswap's universal approval contract, same address on all EVM chains. */
132
+ /** Permit2 — Uniswap's canonical instance, same address on all EVM chains. */
128
133
  /**
129
- * Permit2 — PAFI's deployed instance. PAFI ships its own forked deployment.
134
+ * Permit2 — PAFI's deployed FORK instance (Base). PAFI ships its own forked
135
+ * deployment paired with the fork UniversalRouter.
136
+ *
137
+ * ⚠️ MULTI-CHAIN: this is a SINGLE Base value; the Arbitrum fork Permit2 is a
138
+ * separate PAFI deploy (TBD — SC team). The per-chain `permit2` field already
139
+ * exists on `CONTRACT_ADDRESSES`; when Arbitrum goes live, migrate callers to
140
+ * `getContractAddresses(chainId).permit2` and retire this single const (or
141
+ * make it `Record<number, Address>`). See docs/ARBITRUM_ADDRESSES.md.
130
142
  */
131
143
  declare const PERMIT2_ADDRESS: Address;
132
144
 
@@ -719,6 +731,72 @@ interface BuildPerpDepositViaRelayParams {
719
731
  */
720
732
  declare function buildPerpDepositViaRelay(params: BuildPerpDepositViaRelayParams): PartialUserOperation;
721
733
 
734
+ declare const ASTER_DEPOSIT_ABI: readonly [{
735
+ readonly type: "function";
736
+ readonly name: "deposit";
737
+ readonly stateMutability: "nonpayable";
738
+ readonly inputs: readonly [{
739
+ readonly name: "token";
740
+ readonly type: "address";
741
+ }, {
742
+ readonly name: "amount";
743
+ readonly type: "uint256";
744
+ }, {
745
+ readonly name: "broker";
746
+ readonly type: "uint256";
747
+ }];
748
+ readonly outputs: readonly [];
749
+ }];
750
+ /** 4-byte selector of the assumed `deposit(address,uint256,uint256)`. Kept as
751
+ * a derived constant so it updates automatically when the ABI is corrected. */
752
+ declare const ASTER_DEPOSIT_SELECTOR: Hex;
753
+ /**
754
+ * PAFI's registered Aster broker id per chain (referral attribution — PAFI
755
+ * earns broker fees the way it does on Orderly). `0n` = no broker / not yet
756
+ * registered. TBD: replace with PAFI's real Aster broker id once assigned.
757
+ */
758
+ declare const ASTER_BROKER_IDS: Record<number, bigint>;
759
+ declare function getAsterBrokerId(chainId: number): bigint;
760
+ interface BuildAsterDepositParams {
761
+ /** User EOA (msg.sender via EIP-7702 delegation — also the Aster account). */
762
+ userAddress: Address;
763
+ /** ERC-4337 account nonce. */
764
+ aaNonce: bigint;
765
+ /** Aster Deposit Bridge — `getContractAddresses(chainId).asterDepositBridge`. */
766
+ bridgeAddress: Address;
767
+ /** Deposit token — Arbitrum USDT (`getContractAddresses(chainId).usdt`). */
768
+ token: Address;
769
+ /** Raw deposit amount (token decimals — USDT is 6). Credited to the user. */
770
+ amount: bigint;
771
+ /** PAFI Aster broker id (referral) — `getAsterBrokerId(chainId)`. */
772
+ broker: bigint;
773
+ /**
774
+ * Optional gas-fee transfer prepended to the batch (PAFI gas reimbursement,
775
+ * sponsored path). Same input-token as the deposit (USDT), so the user needs
776
+ * no second token. Set both together; omit for the fee-free fallback where
777
+ * the user pays ERC-4337 gas in ETH. Fee runs FIRST (user holds USDT before
778
+ * the deposit) — the token-availability rule, same as `buildPerpDepositViaRelay`.
779
+ */
780
+ gasFee?: bigint;
781
+ gasFeeRecipient?: Address;
782
+ gasLimits?: {
783
+ callGasLimit?: bigint;
784
+ verificationGasLimit?: bigint;
785
+ preVerificationGas?: bigint;
786
+ };
787
+ }
788
+ /**
789
+ * Build a UserOp for an Aster perp deposit (same-chain on Arbitrum).
790
+ *
791
+ * Sponsored: `[USDT.transfer(feeRecipient, gasFee), USDT.approve(bridge, amount), Bridge.deposit(token, amount, broker)]`
792
+ * Fallback: `[ USDT.approve(bridge, amount), Bridge.deposit(token, amount, broker)]`
793
+ *
794
+ * No `msg.value`, no Relay indirection (unlike Orderly) — Aster is same-chain,
795
+ * so the user's own delegated account is the depositor and the beneficiary.
796
+ * Net deposit to Aster = `amount` (the gasFee is a separate PAFI reimbursement).
797
+ */
798
+ declare function buildAsterDeposit(params: BuildAsterDepositParams): PartialUserOperation;
799
+
722
800
  /**
723
801
  * Builder for the `erc20-transfer` sponsored scenario.
724
802
  *
@@ -1043,7 +1121,7 @@ interface PaymasterConfig {
1043
1121
  * validates the request's target contracts + function selectors
1044
1122
  * match the expected pattern for the scenario.
1045
1123
  */
1046
- type SponsorshipScenario = "mint" | "burn" | "swap" | "perp-deposit" | "delegate" | "erc20-transfer";
1124
+ type SponsorshipScenario = "mint" | "burn" | "swap" | "perp-deposit" | "aster-deposit" | "delegate" | "erc20-transfer";
1047
1125
 
1048
1126
  /**
1049
1127
  * Submission path chosen by `checkEthAndBranch`.
@@ -1628,7 +1706,7 @@ declare function sendWithPaymasterFallback(params: SendWithPaymasterFallbackPara
1628
1706
  *
1629
1707
  * Pass an explicit `gasUnits` to override.
1630
1708
  */
1631
- type FeeScenario = "mint" | "burn" | "swap" | "perp-deposit" | "delegate" | "erc20-transfer";
1709
+ type FeeScenario = "mint" | "burn" | "swap" | "perp-deposit" | "aster-deposit" | "delegate" | "erc20-transfer";
1632
1710
  declare const SCENARIO_GAS_UNITS: Record<FeeScenario, bigint>;
1633
1711
  interface QuoteOperatorFeePtConfig {
1634
1712
  provider: PublicClient;
@@ -2324,6 +2402,14 @@ interface ContractAddresses {
2324
2402
  * consumers can resolve the full registry set from one address.
2325
2403
  */
2326
2404
  pointModuleCore: Address;
2405
+ /**
2406
+ * Aster "Deposit Bridge" — the on-chain contract users deposit USDT into
2407
+ * to fund their Aster perp account (same-chain on Arbitrum). Optional
2408
+ * because it only exists on chains where Aster is deployed (Arbitrum);
2409
+ * undefined on Base. Target-pinned by sponsor-relayer's `aster-deposit`
2410
+ * scenario. See `buildAsterDeposit`.
2411
+ */
2412
+ asterDepositBridge?: Address;
2327
2413
  }
2328
2414
  declare const CONTRACT_ADDRESSES: Record<number, ContractAddresses>;
2329
2415
  /**
@@ -2743,4 +2829,4 @@ declare class PafiSDK {
2743
2829
  signLoginMessage(message: string): Promise<Hex>;
2744
2830
  }
2745
2831
 
2746
- export { ApiError, type AttachDelegationIfNeededParams, BROKER_HASHES, type BuildErc20TransferParams, type BuildPartialUserOpParams, type BuildPerpDepositViaRelayParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, DUMMY_SIGNATURE_V07, type DelegateDirectParams, type DelegateDirectResult, type DelegateImpl, EIP712Signature, ENTRY_POINT_V07, ENTRY_POINT_V08, type Eip7702AuthorizationJsonRpc, type FallbackInfo, type FeeScenario, KERNEL_ADDRESS_BASE_MAINNET, KERNEL_ADDRESS_BASE_SEPOLIA, KERNEL_EXECUTE_ABI, KERNEL_EXECUTE_SELECTOR, KERNEL_EXECUTE_USEROP_SELECTOR, KERNEL_V3_3_IMPL, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, type Operation, OracleStaleError, type OrderlyRelayDepositRequest, PAFI_SERVICE_URLS, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_ABI, POINT_TOKEN_BEACON_ADDRESSES, POINT_TOKEN_BURN_SIG_ABI, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_MINT_SIG_ABI, POINT_TOKEN_POOLS, type PafiErrorType, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSdkError, type PafiServiceUrls, type PafiWebModalAdapter, type PafiWebModalHandle, type PartialUserOperation, type PaymasterConfig, type PaymasterFields, PointTokenDomainConfig, PoolKey, QUOTER_V2_ADDRESSES, type QuoteOperatorFeeForTransferConfig, type QuoteOperatorFeePtConfig, type QuoteOperatorFeeUsdtConfig, SCENARIO_GAS_UNITS, SDK_ERROR_HTTP_STATUS_CODE, SUPPORTED_CHAINS, type SdkErrorHttpStatus, type SendWithPaymasterFallbackParams, type SignAuthorizationFn, type SignatureStruct, SignatureVerification, SignatureVerifyOptions, type SignedAuthorization, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOperation, V3Path, V3_FACTORY_ADDRESSES, V3_POOL_INIT_CODE_HASH, V3_SWAP_ROUTER_ADDRESSES, VAULT_BEACON_ADDRESSES, ValidationError, type VaultDepositFE, ZERO_VALUE, assembleUserOperation, attachDelegationIfNeeded, buildEip7702Authorization, buildErc20TransferUserOp, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, computeV3PoolAddress, createPafiProxyTransport, decodeKernelExecute, decodeKernelExecuteCalls, defaultErrorTypeForStatus, delegateDirect, detectDelegateImpl, encodeKernelExecute, encodeV3Path, encodeV3PathReversed, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getDummySignatureFor7702, getPafiServiceUrls, getPafiWebModalAdapter, isDelegatedTo, isDelegatedToTarget, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, quoteOperatorFeeForTransfer, quoteOperatorFeePt, quoteOperatorFeeUsdt, rawCallOp, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, splitAuthorizationSig, webPopupAdapter };
2832
+ export { ASTER_BROKER_IDS, ASTER_DEPOSIT_ABI, ASTER_DEPOSIT_SELECTOR, ApiError, type AttachDelegationIfNeededParams, BROKER_HASHES, type BuildAsterDepositParams, type BuildErc20TransferParams, type BuildPartialUserOpParams, type BuildPerpDepositViaRelayParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, DUMMY_SIGNATURE_V07, type DelegateDirectParams, type DelegateDirectResult, type DelegateImpl, EIP712Signature, ENTRY_POINT_V07, ENTRY_POINT_V08, type Eip7702AuthorizationJsonRpc, type FallbackInfo, type FeeScenario, KERNEL_ADDRESS_BASE_MAINNET, KERNEL_ADDRESS_BASE_SEPOLIA, KERNEL_EXECUTE_ABI, KERNEL_EXECUTE_SELECTOR, KERNEL_EXECUTE_USEROP_SELECTOR, KERNEL_V3_3_IMPL, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, type Operation, OracleStaleError, type OrderlyRelayDepositRequest, PAFI_SERVICE_URLS, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_ABI, POINT_TOKEN_BEACON_ADDRESSES, POINT_TOKEN_BURN_SIG_ABI, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_MINT_SIG_ABI, POINT_TOKEN_POOLS, type PafiErrorType, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSdkError, type PafiServiceUrls, type PafiWebModalAdapter, type PafiWebModalHandle, type PartialUserOperation, type PaymasterConfig, type PaymasterFields, PointTokenDomainConfig, PoolKey, QUOTER_V2_ADDRESSES, type QuoteOperatorFeeForTransferConfig, type QuoteOperatorFeePtConfig, type QuoteOperatorFeeUsdtConfig, SCENARIO_GAS_UNITS, SDK_ERROR_HTTP_STATUS_CODE, SUPPORTED_CHAINS, type SdkErrorHttpStatus, type SendWithPaymasterFallbackParams, type SignAuthorizationFn, type SignatureStruct, SignatureVerification, SignatureVerifyOptions, type SignedAuthorization, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOperation, V3Path, V3_FACTORY_ADDRESSES, V3_POOL_INIT_CODE_HASH, V3_SWAP_ROUTER_ADDRESSES, VAULT_BEACON_ADDRESSES, ValidationError, type VaultDepositFE, ZERO_VALUE, assembleUserOperation, attachDelegationIfNeeded, buildAsterDeposit, buildEip7702Authorization, buildErc20TransferUserOp, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, computeV3PoolAddress, createPafiProxyTransport, decodeKernelExecute, decodeKernelExecuteCalls, defaultErrorTypeForStatus, delegateDirect, detectDelegateImpl, encodeKernelExecute, encodeV3Path, encodeV3PathReversed, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getAsterBrokerId, getContractAddresses, getDummySignatureFor7702, getPafiServiceUrls, getPafiWebModalAdapter, isDelegatedTo, isDelegatedToTarget, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, quoteOperatorFeeForTransfer, quoteOperatorFeePt, quoteOperatorFeeUsdt, rawCallOp, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, splitAuthorizationSig, webPopupAdapter };
package/dist/index.d.ts CHANGED
@@ -104,6 +104,11 @@ declare const V3_FACTORY_ADDRESSES: Record<number, Address>;
104
104
  * Pool-init code hash for PAFI's V3 deployment. Combined with the factory
105
105
  * address + sorted tokens + fee, deterministically yields a pool's
106
106
  * address via the standard Uniswap V3 CREATE2 derivation.
107
+ *
108
+ * ⚠️ MULTI-CHAIN: this is a SINGLE Base value. The Arbitrum PAFI fork hash
109
+ * is identical ONLY if the pool bytecode matches — confirm with the SC team.
110
+ * When Arbitrum goes live, promote this to `Record<number, Hex>` (like the
111
+ * factory map above). See docs/ARBITRUM_ADDRESSES.md.
107
112
  */
108
113
  declare const V3_POOL_INIT_CODE_HASH: Hex;
109
114
  declare const COMMON_TOKENS: Record<number, Record<string, Address>>;
@@ -124,9 +129,16 @@ declare const ENTRY_POINT_V07: Address;
124
129
  * see `AA23 reverted account: not from EntryPoint`.
125
130
  */
126
131
  declare const ENTRY_POINT_V08: Address;
127
- /** Permit2 — Uniswap's universal approval contract, same address on all EVM chains. */
132
+ /** Permit2 — Uniswap's canonical instance, same address on all EVM chains. */
128
133
  /**
129
- * Permit2 — PAFI's deployed instance. PAFI ships its own forked deployment.
134
+ * Permit2 — PAFI's deployed FORK instance (Base). PAFI ships its own forked
135
+ * deployment paired with the fork UniversalRouter.
136
+ *
137
+ * ⚠️ MULTI-CHAIN: this is a SINGLE Base value; the Arbitrum fork Permit2 is a
138
+ * separate PAFI deploy (TBD — SC team). The per-chain `permit2` field already
139
+ * exists on `CONTRACT_ADDRESSES`; when Arbitrum goes live, migrate callers to
140
+ * `getContractAddresses(chainId).permit2` and retire this single const (or
141
+ * make it `Record<number, Address>`). See docs/ARBITRUM_ADDRESSES.md.
130
142
  */
131
143
  declare const PERMIT2_ADDRESS: Address;
132
144
 
@@ -719,6 +731,72 @@ interface BuildPerpDepositViaRelayParams {
719
731
  */
720
732
  declare function buildPerpDepositViaRelay(params: BuildPerpDepositViaRelayParams): PartialUserOperation;
721
733
 
734
+ declare const ASTER_DEPOSIT_ABI: readonly [{
735
+ readonly type: "function";
736
+ readonly name: "deposit";
737
+ readonly stateMutability: "nonpayable";
738
+ readonly inputs: readonly [{
739
+ readonly name: "token";
740
+ readonly type: "address";
741
+ }, {
742
+ readonly name: "amount";
743
+ readonly type: "uint256";
744
+ }, {
745
+ readonly name: "broker";
746
+ readonly type: "uint256";
747
+ }];
748
+ readonly outputs: readonly [];
749
+ }];
750
+ /** 4-byte selector of the assumed `deposit(address,uint256,uint256)`. Kept as
751
+ * a derived constant so it updates automatically when the ABI is corrected. */
752
+ declare const ASTER_DEPOSIT_SELECTOR: Hex;
753
+ /**
754
+ * PAFI's registered Aster broker id per chain (referral attribution — PAFI
755
+ * earns broker fees the way it does on Orderly). `0n` = no broker / not yet
756
+ * registered. TBD: replace with PAFI's real Aster broker id once assigned.
757
+ */
758
+ declare const ASTER_BROKER_IDS: Record<number, bigint>;
759
+ declare function getAsterBrokerId(chainId: number): bigint;
760
+ interface BuildAsterDepositParams {
761
+ /** User EOA (msg.sender via EIP-7702 delegation — also the Aster account). */
762
+ userAddress: Address;
763
+ /** ERC-4337 account nonce. */
764
+ aaNonce: bigint;
765
+ /** Aster Deposit Bridge — `getContractAddresses(chainId).asterDepositBridge`. */
766
+ bridgeAddress: Address;
767
+ /** Deposit token — Arbitrum USDT (`getContractAddresses(chainId).usdt`). */
768
+ token: Address;
769
+ /** Raw deposit amount (token decimals — USDT is 6). Credited to the user. */
770
+ amount: bigint;
771
+ /** PAFI Aster broker id (referral) — `getAsterBrokerId(chainId)`. */
772
+ broker: bigint;
773
+ /**
774
+ * Optional gas-fee transfer prepended to the batch (PAFI gas reimbursement,
775
+ * sponsored path). Same input-token as the deposit (USDT), so the user needs
776
+ * no second token. Set both together; omit for the fee-free fallback where
777
+ * the user pays ERC-4337 gas in ETH. Fee runs FIRST (user holds USDT before
778
+ * the deposit) — the token-availability rule, same as `buildPerpDepositViaRelay`.
779
+ */
780
+ gasFee?: bigint;
781
+ gasFeeRecipient?: Address;
782
+ gasLimits?: {
783
+ callGasLimit?: bigint;
784
+ verificationGasLimit?: bigint;
785
+ preVerificationGas?: bigint;
786
+ };
787
+ }
788
+ /**
789
+ * Build a UserOp for an Aster perp deposit (same-chain on Arbitrum).
790
+ *
791
+ * Sponsored: `[USDT.transfer(feeRecipient, gasFee), USDT.approve(bridge, amount), Bridge.deposit(token, amount, broker)]`
792
+ * Fallback: `[ USDT.approve(bridge, amount), Bridge.deposit(token, amount, broker)]`
793
+ *
794
+ * No `msg.value`, no Relay indirection (unlike Orderly) — Aster is same-chain,
795
+ * so the user's own delegated account is the depositor and the beneficiary.
796
+ * Net deposit to Aster = `amount` (the gasFee is a separate PAFI reimbursement).
797
+ */
798
+ declare function buildAsterDeposit(params: BuildAsterDepositParams): PartialUserOperation;
799
+
722
800
  /**
723
801
  * Builder for the `erc20-transfer` sponsored scenario.
724
802
  *
@@ -1043,7 +1121,7 @@ interface PaymasterConfig {
1043
1121
  * validates the request's target contracts + function selectors
1044
1122
  * match the expected pattern for the scenario.
1045
1123
  */
1046
- type SponsorshipScenario = "mint" | "burn" | "swap" | "perp-deposit" | "delegate" | "erc20-transfer";
1124
+ type SponsorshipScenario = "mint" | "burn" | "swap" | "perp-deposit" | "aster-deposit" | "delegate" | "erc20-transfer";
1047
1125
 
1048
1126
  /**
1049
1127
  * Submission path chosen by `checkEthAndBranch`.
@@ -1628,7 +1706,7 @@ declare function sendWithPaymasterFallback(params: SendWithPaymasterFallbackPara
1628
1706
  *
1629
1707
  * Pass an explicit `gasUnits` to override.
1630
1708
  */
1631
- type FeeScenario = "mint" | "burn" | "swap" | "perp-deposit" | "delegate" | "erc20-transfer";
1709
+ type FeeScenario = "mint" | "burn" | "swap" | "perp-deposit" | "aster-deposit" | "delegate" | "erc20-transfer";
1632
1710
  declare const SCENARIO_GAS_UNITS: Record<FeeScenario, bigint>;
1633
1711
  interface QuoteOperatorFeePtConfig {
1634
1712
  provider: PublicClient;
@@ -2324,6 +2402,14 @@ interface ContractAddresses {
2324
2402
  * consumers can resolve the full registry set from one address.
2325
2403
  */
2326
2404
  pointModuleCore: Address;
2405
+ /**
2406
+ * Aster "Deposit Bridge" — the on-chain contract users deposit USDT into
2407
+ * to fund their Aster perp account (same-chain on Arbitrum). Optional
2408
+ * because it only exists on chains where Aster is deployed (Arbitrum);
2409
+ * undefined on Base. Target-pinned by sponsor-relayer's `aster-deposit`
2410
+ * scenario. See `buildAsterDeposit`.
2411
+ */
2412
+ asterDepositBridge?: Address;
2327
2413
  }
2328
2414
  declare const CONTRACT_ADDRESSES: Record<number, ContractAddresses>;
2329
2415
  /**
@@ -2743,4 +2829,4 @@ declare class PafiSDK {
2743
2829
  signLoginMessage(message: string): Promise<Hex>;
2744
2830
  }
2745
2831
 
2746
- export { ApiError, type AttachDelegationIfNeededParams, BROKER_HASHES, type BuildErc20TransferParams, type BuildPartialUserOpParams, type BuildPerpDepositViaRelayParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, DUMMY_SIGNATURE_V07, type DelegateDirectParams, type DelegateDirectResult, type DelegateImpl, EIP712Signature, ENTRY_POINT_V07, ENTRY_POINT_V08, type Eip7702AuthorizationJsonRpc, type FallbackInfo, type FeeScenario, KERNEL_ADDRESS_BASE_MAINNET, KERNEL_ADDRESS_BASE_SEPOLIA, KERNEL_EXECUTE_ABI, KERNEL_EXECUTE_SELECTOR, KERNEL_EXECUTE_USEROP_SELECTOR, KERNEL_V3_3_IMPL, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, type Operation, OracleStaleError, type OrderlyRelayDepositRequest, PAFI_SERVICE_URLS, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_ABI, POINT_TOKEN_BEACON_ADDRESSES, POINT_TOKEN_BURN_SIG_ABI, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_MINT_SIG_ABI, POINT_TOKEN_POOLS, type PafiErrorType, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSdkError, type PafiServiceUrls, type PafiWebModalAdapter, type PafiWebModalHandle, type PartialUserOperation, type PaymasterConfig, type PaymasterFields, PointTokenDomainConfig, PoolKey, QUOTER_V2_ADDRESSES, type QuoteOperatorFeeForTransferConfig, type QuoteOperatorFeePtConfig, type QuoteOperatorFeeUsdtConfig, SCENARIO_GAS_UNITS, SDK_ERROR_HTTP_STATUS_CODE, SUPPORTED_CHAINS, type SdkErrorHttpStatus, type SendWithPaymasterFallbackParams, type SignAuthorizationFn, type SignatureStruct, SignatureVerification, SignatureVerifyOptions, type SignedAuthorization, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOperation, V3Path, V3_FACTORY_ADDRESSES, V3_POOL_INIT_CODE_HASH, V3_SWAP_ROUTER_ADDRESSES, VAULT_BEACON_ADDRESSES, ValidationError, type VaultDepositFE, ZERO_VALUE, assembleUserOperation, attachDelegationIfNeeded, buildEip7702Authorization, buildErc20TransferUserOp, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, computeV3PoolAddress, createPafiProxyTransport, decodeKernelExecute, decodeKernelExecuteCalls, defaultErrorTypeForStatus, delegateDirect, detectDelegateImpl, encodeKernelExecute, encodeV3Path, encodeV3PathReversed, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getDummySignatureFor7702, getPafiServiceUrls, getPafiWebModalAdapter, isDelegatedTo, isDelegatedToTarget, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, quoteOperatorFeeForTransfer, quoteOperatorFeePt, quoteOperatorFeeUsdt, rawCallOp, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, splitAuthorizationSig, webPopupAdapter };
2832
+ export { ASTER_BROKER_IDS, ASTER_DEPOSIT_ABI, ASTER_DEPOSIT_SELECTOR, ApiError, type AttachDelegationIfNeededParams, BROKER_HASHES, type BuildAsterDepositParams, type BuildErc20TransferParams, type BuildPartialUserOpParams, type BuildPerpDepositViaRelayParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, DUMMY_SIGNATURE_V07, type DelegateDirectParams, type DelegateDirectResult, type DelegateImpl, EIP712Signature, ENTRY_POINT_V07, ENTRY_POINT_V08, type Eip7702AuthorizationJsonRpc, type FallbackInfo, type FeeScenario, KERNEL_ADDRESS_BASE_MAINNET, KERNEL_ADDRESS_BASE_SEPOLIA, KERNEL_EXECUTE_ABI, KERNEL_EXECUTE_SELECTOR, KERNEL_EXECUTE_USEROP_SELECTOR, KERNEL_V3_3_IMPL, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, type Operation, OracleStaleError, type OrderlyRelayDepositRequest, PAFI_SERVICE_URLS, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_ABI, POINT_TOKEN_BEACON_ADDRESSES, POINT_TOKEN_BURN_SIG_ABI, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_MINT_SIG_ABI, POINT_TOKEN_POOLS, type PafiErrorType, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSdkError, type PafiServiceUrls, type PafiWebModalAdapter, type PafiWebModalHandle, type PartialUserOperation, type PaymasterConfig, type PaymasterFields, PointTokenDomainConfig, PoolKey, QUOTER_V2_ADDRESSES, type QuoteOperatorFeeForTransferConfig, type QuoteOperatorFeePtConfig, type QuoteOperatorFeeUsdtConfig, SCENARIO_GAS_UNITS, SDK_ERROR_HTTP_STATUS_CODE, SUPPORTED_CHAINS, type SdkErrorHttpStatus, type SendWithPaymasterFallbackParams, type SignAuthorizationFn, type SignatureStruct, SignatureVerification, SignatureVerifyOptions, type SignedAuthorization, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOperation, V3Path, V3_FACTORY_ADDRESSES, V3_POOL_INIT_CODE_HASH, V3_SWAP_ROUTER_ADDRESSES, VAULT_BEACON_ADDRESSES, ValidationError, type VaultDepositFE, ZERO_VALUE, assembleUserOperation, attachDelegationIfNeeded, buildAsterDeposit, buildEip7702Authorization, buildErc20TransferUserOp, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, computeV3PoolAddress, createPafiProxyTransport, decodeKernelExecute, decodeKernelExecuteCalls, defaultErrorTypeForStatus, delegateDirect, detectDelegateImpl, encodeKernelExecute, encodeV3Path, encodeV3PathReversed, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getAsterBrokerId, getContractAddresses, getDummySignatureFor7702, getPafiServiceUrls, getPafiWebModalAdapter, isDelegatedTo, isDelegatedToTarget, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, quoteOperatorFeeForTransfer, quoteOperatorFeePt, quoteOperatorFeeUsdt, rawCallOp, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, splitAuthorizationSig, webPopupAdapter };
package/dist/index.js CHANGED
@@ -1,15 +1,3 @@
1
- import {
2
- erc20Abi,
3
- permit2Abi,
4
- pointModuleCoreAbi,
5
- pointTokenFactoryAbi,
6
- settlementVaultAbi,
7
- tokenRegistryAbi,
8
- universalRouterAbi,
9
- v3QuoterV2Abi,
10
- vaultFactoryAbi,
11
- vaultRegistryAbi
12
- } from "./chunk-ZQVYWMOG.js";
13
1
  import {
14
2
  SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET,
15
3
  SPONSOR_AUTH_DOMAIN_NAME,
@@ -26,6 +14,18 @@ import {
26
14
  verifyLoginMessage,
27
15
  verifySponsorAuth
28
16
  } from "./chunk-NSTUVR2D.js";
17
+ import {
18
+ erc20Abi,
19
+ permit2Abi,
20
+ pointModuleCoreAbi,
21
+ pointTokenFactoryAbi,
22
+ settlementVaultAbi,
23
+ tokenRegistryAbi,
24
+ universalRouterAbi,
25
+ v3QuoterV2Abi,
26
+ vaultFactoryAbi,
27
+ vaultRegistryAbi
28
+ } from "./chunk-ZQVYWMOG.js";
29
29
  import {
30
30
  Source,
31
31
  computeEquityCap,
@@ -74,7 +74,7 @@ import {
74
74
  signMintRequest,
75
75
  verifyBurnRequest,
76
76
  verifyMintRequest
77
- } from "./chunk-K4GBOB5V.js";
77
+ } from "./chunk-MOTNU74I.js";
78
78
  import {
79
79
  pointTokenAbi
80
80
  } from "./chunk-5Y7MGN56.js";
@@ -203,7 +203,11 @@ import { encodeFunctionData as encodeFunctionData3 } from "viem";
203
203
  import { keccak256, encodePacked, encodeAbiParameters } from "viem";
204
204
  var ORDERLY_VAULT_BASE_MAINNET = "0x816f722424B49Cf1275cc86DA9840Fbd5a6167e9";
205
205
  var ORDERLY_VAULT_ADDRESSES = {
206
- 8453: ORDERLY_VAULT_BASE_MAINNET
206
+ 8453: ORDERLY_VAULT_BASE_MAINNET,
207
+ // Arbitrum One (42161) — Orderly perp path is KEPT on the Arbitrum move.
208
+ // Orderly's Vault Proxy is deployed at the SAME address on Arbitrum as on
209
+ // Base (verified on-chain: 2882 bytes at this address on Arbitrum One).
210
+ 42161: "0x816f722424B49Cf1275cc86DA9840Fbd5a6167e9"
207
211
  };
208
212
  var BROKER_HASHES = {
209
213
  /** Default partner broker on Base — most commonly whitelisted. */
@@ -620,6 +624,70 @@ function buildPerpDepositViaRelay(params) {
620
624
  });
621
625
  }
622
626
 
627
+ // src/perp/buildAsterDeposit.ts
628
+ import { encodeFunctionData as encodeFunctionData5, toFunctionSelector } from "viem";
629
+ var ASTER_DEPOSIT_ABI = [
630
+ {
631
+ type: "function",
632
+ name: "deposit",
633
+ stateMutability: "nonpayable",
634
+ inputs: [
635
+ { name: "token", type: "address" },
636
+ { name: "amount", type: "uint256" },
637
+ { name: "broker", type: "uint256" }
638
+ ],
639
+ outputs: []
640
+ }
641
+ ];
642
+ var ASTER_DEPOSIT_SELECTOR = toFunctionSelector(
643
+ ASTER_DEPOSIT_ABI[0]
644
+ );
645
+ var ASTER_BROKER_IDS = {
646
+ 42161: 0n
647
+ // TBD — PAFI Aster broker id
648
+ };
649
+ function getAsterBrokerId(chainId) {
650
+ return ASTER_BROKER_IDS[chainId] ?? 0n;
651
+ }
652
+ function buildAsterDeposit(params) {
653
+ if (params.amount <= 0n) {
654
+ throw new Error("buildAsterDeposit: amount must be positive");
655
+ }
656
+ if (!params.bridgeAddress) {
657
+ throw new Error("buildAsterDeposit: bridgeAddress required");
658
+ }
659
+ const operations = [];
660
+ if (params.gasFee && params.gasFee > 0n) {
661
+ if (!params.gasFeeRecipient) {
662
+ throw new Error(
663
+ "buildAsterDeposit: gasFeeRecipient required when gasFee > 0"
664
+ );
665
+ }
666
+ operations.push(
667
+ erc20TransferOp(params.token, params.gasFeeRecipient, params.gasFee)
668
+ );
669
+ }
670
+ operations.push(
671
+ erc20ApproveOp(params.token, params.bridgeAddress, params.amount)
672
+ );
673
+ const depositCallData = encodeFunctionData5({
674
+ abi: ASTER_DEPOSIT_ABI,
675
+ functionName: "deposit",
676
+ args: [params.token, params.amount, params.broker]
677
+ });
678
+ operations.push(rawCallOp(params.bridgeAddress, depositCallData));
679
+ return buildPartialUserOperation({
680
+ sender: params.userAddress,
681
+ nonce: params.aaNonce,
682
+ operations,
683
+ gasLimits: {
684
+ callGasLimit: params.gasLimits?.callGasLimit ?? 600000n,
685
+ verificationGasLimit: params.gasLimits?.verificationGasLimit ?? 150000n,
686
+ preVerificationGas: params.gasLimits?.preVerificationGas ?? 50000n
687
+ }
688
+ });
689
+ }
690
+
623
691
  // src/transfer/buildErc20Transfer.ts
624
692
  function buildErc20TransferUserOp(params) {
625
693
  if (params.amount <= 0n) {
@@ -896,6 +964,7 @@ function buildEip7702Authorization(params) {
896
964
 
897
965
  // src/contracts/real/addresses.ts
898
966
  var PLACEHOLDER_DEAD = (suffix) => `0x000000000000000000000000000000000000${suffix.toLowerCase().padStart(4, "0")}`;
967
+ var TBD_ARBITRUM = "0x0000000000000000000000000000000000000000";
899
968
  var CONTRACT_ADDRESSES = {
900
969
  // ──────────────────────────────────────────────────────────────────
901
970
  // Base mainnet (8453) — V2 dual-bucket deploy 2026-06-12
@@ -972,27 +1041,72 @@ var CONTRACT_ADDRESSES = {
972
1041
  vaultRegistry: PLACEHOLDER_DEAD("de08"),
973
1042
  vaultFactory: PLACEHOLDER_DEAD("de09"),
974
1043
  pointModuleCore: PLACEHOLDER_DEAD("de0a")
1044
+ },
1045
+ // ──────────────────────────────────────────────────────────────────
1046
+ // Arbitrum One (42161) — PAFI SC (re)deploy target (2026-07-03).
1047
+ // Aster deposit is same-chain here (no bridge). Researched/canonical
1048
+ // fields are FINAL; PAFI-deployed fields are TBD_ARBITRUM until the SC
1049
+ // team sends the Arbitrum addresses. See docs/ARBITRUM_ADDRESSES.md.
1050
+ // ──────────────────────────────────────────────────────────────────
1051
+ 42161: {
1052
+ // ── Researched / canonical (FINAL) ────────────────────────────
1053
+ // Kernel v3.3 impl — CREATE2-deterministic, identical on every chain.
1054
+ kernel: "0xd6CEDDe84be40893d153Be9d467CD6aD37875b28",
1055
+ // Arbitrum USDT is now "USDT0" (LayerZero OFT), 6 decimals — also the
1056
+ // token Aster deposits accept on Arbitrum.
1057
+ usdt: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
1058
+ // Native Circle USDC on Arbitrum, 6 decimals.
1059
+ usdc: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
1060
+ chainlinkEthUsd: "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612",
1061
+ chainlinkUsdcUsd: "0x50834F3163758fcC1Df9973b6e91f0F0F0434aD3",
1062
+ // Aster "Deposit Bridge" on Arbitrum (labelled on Arbiscan). Users
1063
+ // deposit USDT here to fund their Aster perp account. FINAL.
1064
+ asterDepositBridge: "0x9E36CB86a159d479cEd94Fa05036f235Ac40E1d5",
1065
+ // ── PAFI-deployed (TBD — awaiting SC team Arbitrum deploy) ─────
1066
+ issuerRegistry: TBD_ARBITRUM,
1067
+ mintingOracle: TBD_ARBITRUM,
1068
+ mintFeeWrapper: TBD_ARBITRUM,
1069
+ tokenRegistry: TBD_ARBITRUM,
1070
+ vaultRegistry: TBD_ARBITRUM,
1071
+ vaultFactory: TBD_ARBITRUM,
1072
+ pointModuleCore: TBD_ARBITRUM,
1073
+ // Only if the Orderly perp path is kept on Arbitrum (else remove).
1074
+ orderlyRelay: TBD_ARBITRUM,
1075
+ // PAFI-controlled fee recipient — confirm whether Base EOA is reused.
1076
+ pafiFeeRecipient: TBD_ARBITRUM,
1077
+ // PAFI V3-fork UniversalRouter + its paired fork Permit2 — NOT the
1078
+ // canonical Arbitrum UR / canonical Permit2 (0x0000…22D473).
1079
+ universalRouter: TBD_ARBITRUM,
1080
+ permit2: TBD_ARBITRUM
975
1081
  }
976
1082
  };
977
1083
  var POINT_TOKEN_FACTORY_ADDRESSES = {
978
1084
  // V2 dual-bucket factory (2026-06-12). Replaces v1.6 factory
979
1085
  // `0xA08274458b43E7D6F4ff61ddFe8A9852c6531085`.
980
1086
  8453: "0x34f9F84841A77A19040686396b8B64522A2da4c8",
981
- 84532: PLACEHOLDER_DEAD("dead")
1087
+ 84532: PLACEHOLDER_DEAD("dead"),
1088
+ 42161: TBD_ARBITRUM
1089
+ // Arbitrum PAFI deploy — SC team
982
1090
  };
983
1091
  var POINT_TOKEN_IMPL_ADDRESSES = {
984
1092
  // V2 dual-bucket impl (2026-06-12). Replaces v1.6 impl
985
1093
  // `0xc41c3F8A0380c7760Ee1209d6d19C4b81dE994e4` (single-bucket).
986
1094
  8453: "0x067d2d82F7cfbAf9bBA1f493167cC6043eD5d7dd",
987
- 84532: PLACEHOLDER_DEAD("dead")
1095
+ 84532: PLACEHOLDER_DEAD("dead"),
1096
+ 42161: TBD_ARBITRUM
1097
+ // Arbitrum PAFI deploy — SC team
988
1098
  };
989
1099
  var POINT_TOKEN_BEACON_ADDRESSES = {
990
1100
  8453: "0xdC479E294FD12658FDC68B9400c2073De291acf3",
991
- 84532: PLACEHOLDER_DEAD("dead")
1101
+ 84532: PLACEHOLDER_DEAD("dead"),
1102
+ 42161: TBD_ARBITRUM
1103
+ // Arbitrum PAFI deploy — SC team
992
1104
  };
993
1105
  var VAULT_BEACON_ADDRESSES = {
994
1106
  8453: "0x4E583d64bfcCD86dFf1f68b792D5a1Cd169f22eB",
995
- 84532: PLACEHOLDER_DEAD("dead")
1107
+ 84532: PLACEHOLDER_DEAD("dead"),
1108
+ 42161: TBD_ARBITRUM
1109
+ // Arbitrum PAFI deploy — SC team
996
1110
  };
997
1111
  function getContractAddresses(chainId) {
998
1112
  const addrs = CONTRACT_ADDRESSES[chainId];
@@ -1279,6 +1393,9 @@ var SCENARIO_GAS_UNITS = {
1279
1393
  burn: 500000n,
1280
1394
  swap: 700000n,
1281
1395
  "perp-deposit": 800000n,
1396
+ // Aster deposit is same-chain (no Orderly LayerZero msg.value hop) — a
1397
+ // plain [fee, approve, bridge.deposit] batch, so cheaper than perp-deposit.
1398
+ "aster-deposit": 600000n,
1282
1399
  delegate: 200000n,
1283
1400
  // 2-call batch: 1 ERC-20 fee transfer + 1 ERC-20 transfer + 7702
1284
1401
  // delegation overhead. ~70-90k empirical; 200k matches `delegate`
@@ -1548,6 +1665,12 @@ var PAFI_SERVICE_URLS = {
1548
1665
  84532: {
1549
1666
  sponsorRelayer: "https://api-dev.pacificfinance.org/api/sponsor",
1550
1667
  issuerApi: "https://api-dev.pacificfinance.org/api/issuer"
1668
+ },
1669
+ // Arbitrum One — same Kong host, path-routed (chain lives in the ZeroDev
1670
+ // forward URL, not the PAFI service URL). Swap to prod hosts when live.
1671
+ 42161: {
1672
+ sponsorRelayer: "https://api-dev.pacificfinance.org/api/sponsor",
1673
+ issuerApi: "https://api-dev.pacificfinance.org/api/issuer"
1551
1674
  }
1552
1675
  };
1553
1676
  function getPafiServiceUrls(chainId, overrides) {
@@ -1831,6 +1954,9 @@ var PafiSDK = class {
1831
1954
  }
1832
1955
  };
1833
1956
  export {
1957
+ ASTER_BROKER_IDS,
1958
+ ASTER_DEPOSIT_ABI,
1959
+ ASTER_DEPOSIT_SELECTOR,
1834
1960
  ApiError,
1835
1961
  BROKER_HASHES,
1836
1962
  COMMON_POOLS,
@@ -1886,6 +2012,7 @@ export {
1886
2012
  assertDomainMatchesContract,
1887
2013
  attachDelegationIfNeeded,
1888
2014
  buildAndSignSponsorAuth,
2015
+ buildAsterDeposit,
1889
2016
  buildBurnRequestTypedData,
1890
2017
  buildDomain,
1891
2018
  buildEip7702Authorization,
@@ -1922,6 +2049,7 @@ export {
1922
2049
  fetchPafiPools,
1923
2050
  generateSponsorAuthNonce,
1924
2051
  getAaNonce,
2052
+ getAsterBrokerId,
1925
2053
  getBurnRequestNonce,
1926
2054
  getContractAddresses,
1927
2055
  getDummySignatureFor7702,