@toon-protocol/client 4.0.0 → 4.1.1

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.
@@ -32,7 +32,7 @@ import {
32
32
  resolveConfig,
33
33
  send,
34
34
  toEnvelopeRequest
35
- } from "./chunk-CG3OXV74.js";
35
+ } from "./chunk-SS3GGBUE.js";
36
36
  import "./chunk-WJKJ6Y4N.js";
37
37
  import "./chunk-32MD3CXE.js";
38
38
  export {
@@ -70,4 +70,4 @@ export {
70
70
  send,
71
71
  toEnvelopeRequest
72
72
  };
73
- //# sourceMappingURL=client-7YIJOR5K.js.map
73
+ //# sourceMappingURL=client-CTOUNPZD.js.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Hex, TransactionReceipt, http } from 'viem';
1
+ import { Hex, LocalAccount, TransactionReceipt, http } from 'viem';
2
2
  import { C as ChainKind } from './hidden-service-BtIv3u0L.js';
3
3
  export { H as HiddenServiceTransport, a as HiddenServiceTransportOptions, v as validateSocks5hUrl } from './hidden-service-BtIv3u0L.js';
4
4
  import { PrivateKeyAccount } from 'viem/accounts';
@@ -67,6 +67,17 @@ interface BatchSettlementEvmOffer {
67
67
  /** The token's own EIP-712 domain, which an ERC-3009 authorization signs under. */
68
68
  name?: string;
69
69
  version?: string;
70
+ /**
71
+ * How a deposit moves the token: `eip3009` (x402's default) for a token
72
+ * with ERC-3009, `permit2` for any other ERC-20. x402's own field.
73
+ */
74
+ assetTransferMethod?: 'eip3009' | 'permit2';
75
+ /**
76
+ * The x402 facilitator this connector relays deposits through and pays the
77
+ * gas of — TOON's addition, since here the payer, not the seller, calls it
78
+ * (toon-client#695).
79
+ */
80
+ facilitator?: string;
70
81
  };
71
82
  }
72
83
  /** `x402BatchSettlement.ChannelConfig` — the seven immutable fields a channel id hashes. */
@@ -1605,6 +1616,178 @@ declare class BatchChannelManager {
1605
1616
  private findBinding;
1606
1617
  }
1607
1618
 
1619
+ /**
1620
+ * Who pays the gas for a deposit into an x402 `batch-settlement` channel on
1621
+ * EVM, and how (connector ADR 0074; toon-client#695).
1622
+ *
1623
+ * The contract's `deposit(config, amount, collector, collectorData)` is
1624
+ * callable by anyone: the payer's one signature — an ERC-3009 authorization or
1625
+ * a Permit2 witness transfer — binds the deposit to its channel. So the same
1626
+ * signed payload can be put on chain two ways:
1627
+ *
1628
+ * - **by a facilitator**, which pays the gas (`facilitator.ts`); or
1629
+ * - **by the payer itself**, from its own ETH ({@link depositDirectly}).
1630
+ *
1631
+ * Both spend the one authorization, and its nonce is single-use on chain — the
1632
+ * ERC-3009 nonce is `keccak256(channelId, salt)`, a Permit2 nonce is
1633
+ * unordered and random — so a direct deposit after a facilitator's answer was
1634
+ * lost can never land twice: whichever arrives second reverts.
1635
+ *
1636
+ * A token without ERC-3009 deposits through Permit2, which first needs the
1637
+ * payer's `approve(Permit2, …)`. That approval is gas too, and x402 defines
1638
+ * two extensions for a facilitator to cover it:
1639
+ *
1640
+ * - `eip2612GasSponsoring`, for a token with an EIP-2612 permit: the payer
1641
+ * signs a permit for Permit2 and the facilitator folds it into the deposit;
1642
+ * - `erc20ApprovalGasSponsoring`, for a token with neither: the payer signs
1643
+ * the `approve` transaction without sending it, and the facilitator funds
1644
+ * its gas and broadcasts it before the deposit.
1645
+ *
1646
+ * A payer holding ETH can instead send the approval itself
1647
+ * ({@link approvePermit2}). The encodings below are x402's own
1648
+ * (`@x402/evm` 2.27.0, `batch-settlement/encoding.ts` and
1649
+ * `shared/extensions`), so a facilitator and a direct deposit read the same
1650
+ * bytes.
1651
+ */
1652
+
1653
+ declare const EIP2612_GAS_SPONSORING = "eip2612GasSponsoring";
1654
+ declare const ERC20_APPROVAL_GAS_SPONSORING = "erc20ApprovalGasSponsoring";
1655
+ /** `x402BatchSettlement.deposit`. */
1656
+ declare const X402_BATCH_SETTLEMENT_DEPOSIT_ABI: readonly [{
1657
+ readonly type: "function";
1658
+ readonly name: "deposit";
1659
+ readonly stateMutability: "nonpayable";
1660
+ readonly inputs: readonly [{
1661
+ readonly name: "config";
1662
+ readonly type: "tuple";
1663
+ readonly components: readonly [{
1664
+ readonly name: "payer";
1665
+ readonly type: "address";
1666
+ }, {
1667
+ readonly name: "payerAuthorizer";
1668
+ readonly type: "address";
1669
+ }, {
1670
+ readonly name: "receiver";
1671
+ readonly type: "address";
1672
+ }, {
1673
+ readonly name: "receiverAuthorizer";
1674
+ readonly type: "address";
1675
+ }, {
1676
+ readonly name: "token";
1677
+ readonly type: "address";
1678
+ }, {
1679
+ readonly name: "withdrawDelay";
1680
+ readonly type: "uint40";
1681
+ }, {
1682
+ readonly name: "salt";
1683
+ readonly type: "bytes32";
1684
+ }];
1685
+ }, {
1686
+ readonly name: "amount";
1687
+ readonly type: "uint128";
1688
+ }, {
1689
+ readonly name: "collector";
1690
+ readonly type: "address";
1691
+ }, {
1692
+ readonly name: "collectorData";
1693
+ readonly type: "bytes";
1694
+ }];
1695
+ readonly outputs: readonly [];
1696
+ }];
1697
+ /**
1698
+ * What paying gas from the payer's own wallet needs of the chain, bound to the
1699
+ * payer's account. A viem wallet client extended with public actions provides
1700
+ * all of it; `ToonClient` builds one lazily.
1701
+ */
1702
+ interface EvmWalletAccess {
1703
+ /** The payer's native balance, wei. */
1704
+ getBalance(): Promise<bigint>;
1705
+ /** The payer's next transaction nonce. */
1706
+ getTransactionCount(): Promise<number>;
1707
+ estimateFeesPerGas(): Promise<{
1708
+ maxFeePerGas: bigint;
1709
+ maxPriorityFeePerGas: bigint;
1710
+ }>;
1711
+ /** Sign, without sending, a transaction from the payer's account. */
1712
+ signTransaction(transaction: never): Promise<Hex>;
1713
+ /** Send a contract call from the payer's account. */
1714
+ writeContract(params: never): Promise<Hex>;
1715
+ waitForTransactionReceipt(params: {
1716
+ hash: Hex;
1717
+ }): Promise<{
1718
+ status: string;
1719
+ }>;
1720
+ }
1721
+ /**
1722
+ * {@link EvmWalletAccess} for `account` over `rpcUrl`, on whichever chain the
1723
+ * RPC reports. Nothing connects until it is first used.
1724
+ */
1725
+ declare function evmWalletAccess(params: {
1726
+ rpcUrl: string;
1727
+ account: LocalAccount;
1728
+ /** The proxy-bound dispatcher a hidden payer's RPC rides, if any. */
1729
+ dispatcher?: unknown;
1730
+ }): EvmWalletAccess;
1731
+ /** How much of `token` Permit2 may move for `owner`. */
1732
+ declare function permit2Allowance(reader: ContractReader, token: string, owner: string): Promise<bigint>;
1733
+ /**
1734
+ * `owner`'s EIP-2612 nonce on `token`, or `undefined` when the token has no
1735
+ * `nonces(address)` — and so, for this purpose, no permit.
1736
+ */
1737
+ declare function eip2612Nonce(reader: ContractReader, token: string, owner: string): Promise<bigint | undefined>;
1738
+ /** The extensions a facilitator's `GET /supported` advertises. */
1739
+ declare function facilitatorExtensions(facilitatorUrl: string, fetchImpl?: typeof fetch): Promise<string[]>;
1740
+ /** `paymentPayload.extensions`, as a facilitator reads them. */
1741
+ type DepositExtensions = Record<string, {
1742
+ info: Record<string, unknown>;
1743
+ }>;
1744
+ /**
1745
+ * An EIP-2612 permit letting Permit2 move `amount` of the token, for the
1746
+ * facilitator to fold into the deposit (`eip2612GasSponsoring`).
1747
+ */
1748
+ declare function signEip2612GasSponsoring(params: {
1749
+ payer: TypedDataSigner;
1750
+ token: string;
1751
+ /** The token's own EIP-712 domain. */
1752
+ name: string;
1753
+ version: string;
1754
+ chainId: number;
1755
+ nonce: bigint;
1756
+ amount: bigint;
1757
+ /** The Permit2 authorization's own deadline, unix seconds. */
1758
+ deadline: string;
1759
+ }): Promise<DepositExtensions>;
1760
+ /**
1761
+ * The payer's signed-but-unsent `approve(Permit2, max)`, for the facilitator
1762
+ * to fund and broadcast (`erc20ApprovalGasSponsoring`).
1763
+ */
1764
+ declare function signErc20ApprovalGasSponsoring(params: {
1765
+ payerAddress: string;
1766
+ wallet: Pick<EvmWalletAccess, 'getTransactionCount' | 'estimateFeesPerGas' | 'signTransaction'>;
1767
+ token: string;
1768
+ chainId: number;
1769
+ }): Promise<DepositExtensions>;
1770
+ /** Send `approve(Permit2, max)` from the payer's own wallet, and wait for it. */
1771
+ declare function approvePermit2(wallet: EvmWalletAccess, token: string): Promise<Hex>;
1772
+ /** `collectorData` for the ERC-3009 deposit collector. */
1773
+ declare function erc3009CollectorData(payload: Eip3009DepositPayload): Hex;
1774
+ /**
1775
+ * `collectorData` for the Permit2 deposit collector, optionally carrying an
1776
+ * EIP-2612 permit for Permit2 (`eip2612PermitData`, else empty).
1777
+ */
1778
+ declare function permit2CollectorData(payload: Permit2DepositPayload, eip2612PermitData?: Hex): Hex;
1779
+ /** An EIP-2612 permit as the Permit2 collector reads it. */
1780
+ declare function eip2612PermitData(info: {
1781
+ amount: string;
1782
+ deadline: string;
1783
+ signature: string;
1784
+ }): Hex;
1785
+ /**
1786
+ * Put a signed deposit on chain from the payer's own wallet: the same call a
1787
+ * facilitator makes, with the payer paying the gas.
1788
+ */
1789
+ declare function depositDirectly(wallet: EvmWalletAccess, payload: BatchDepositPayload<unknown>, method: 'eip3009' | 'permit2'): Promise<Hex>;
1790
+
1608
1791
  /**
1609
1792
  * Paying a connector from an x402 `batch-settlement` channel: the one object
1610
1793
  * {@link ../../client/send.js!send} asks for a voucher — the only way this
@@ -1673,11 +1856,28 @@ interface BatchSettlementPayerConfig {
1673
1856
  */
1674
1857
  facilitatorUrl?: string;
1675
1858
  /**
1676
- * `eip3009` (the default) for a token with ERC-3009, gasless outright;
1677
- * `permit2` for one without, which needs the payer's one-time Permit2
1678
- * approval first.
1859
+ * How a deposit moves the token: `eip3009` for a token with ERC-3009,
1860
+ * `permit2` for any other ERC-20. Defaults to what the connector's offer
1861
+ * names (`assetTransferMethod`), and to `eip3009` when it names nothing.
1679
1862
  */
1680
1863
  depositMethod?: 'eip3009' | 'permit2';
1864
+ /**
1865
+ * Who pays a deposit's gas, and a Permit2 token's one-time approval's:
1866
+ *
1867
+ * - `auto` (the default): the facilitator, when there is one and it will;
1868
+ * otherwise the payer, when it holds ETH;
1869
+ * - `facilitator`: only ever the facilitator — the payer's ETH is never
1870
+ * spent;
1871
+ * - `self`: always the payer, and no facilitator is contacted at all.
1872
+ */
1873
+ depositGas?: 'auto' | 'facilitator' | 'self';
1874
+ /**
1875
+ * The payer's own chain access: what a self-paid deposit or approval, and
1876
+ * an approval the facilitator sponsors, are signed and sent with. Without
1877
+ * it the payer can only use a facilitator, and only for tokens it needs no
1878
+ * approval for.
1879
+ */
1880
+ wallet?: EvmWalletAccess;
1681
1881
  /**
1682
1882
  * Reads the escrow back, to settle a deposit whose answer was lost and to
1683
1883
  * rebuild a lost watermark. Without one, either of those is an error
@@ -1791,7 +1991,21 @@ declare class BatchSettlementPayer {
1791
1991
  private evmOnboard;
1792
1992
  /** Deposit `amount` more into `channel`, carrying the running cumulative `voucherAmount`. */
1793
1993
  private evmDeposit;
1994
+ /**
1995
+ * Put a deposit of `amount`, carrying the voucher for `voucherAmount`, on
1996
+ * chain — through the facilitator, or from the payer's own ETH, as
1997
+ * `depositGas` and what is available decide (toon-client#695).
1998
+ */
1794
1999
  private evmSettle;
2000
+ /**
2001
+ * One of x402's gas-sponsoring extensions for a Permit2 approval, when the
2002
+ * facilitator offers one this token can use; `undefined` otherwise.
2003
+ */
2004
+ private sponsoredApproval;
2005
+ /** Refuse, naming what would work, unless the payer holds ETH to pay `what` with. */
2006
+ private payOwnGas;
2007
+ private requireReader;
2008
+ private requireWallet;
1795
2009
  /**
1796
2010
  * Open a channel the receiving connector sponsors: the connector pays the fee
1797
2011
  * and the rent, and the payer needs no SOL at all.
@@ -3189,6 +3403,13 @@ interface ToonClientConfig {
3189
3403
  * payer's one-time Permit2 approval — a transaction of its own — first.
3190
3404
  */
3191
3405
  depositMethod?: 'eip3009' | 'permit2';
3406
+ /**
3407
+ * Who pays a Base deposit's gas, and a Permit2 token's one-time approval's.
3408
+ * `auto` (the default): the facilitator when there is one and it will,
3409
+ * otherwise this wallet when it holds ETH. `facilitator`: never this
3410
+ * wallet's ETH. `self`: always this wallet's, and no facilitator at all.
3411
+ */
3412
+ depositGas?: 'auto' | 'facilitator' | 'self';
3192
3413
  /** Per-packet timeout in milliseconds. Default `30000`. */
3193
3414
  timeoutMs?: number;
3194
3415
  /** BTP carriage tuning. */
@@ -3757,7 +3978,9 @@ interface ResolvedConfig {
3757
3978
  deposit: bigint;
3758
3979
  /** The x402 facilitator for Base deposits, or `undefined` for the network's default. */
3759
3980
  facilitatorUrl: string | undefined;
3760
- depositMethod: 'eip3009' | 'permit2';
3981
+ /** `undefined`: whatever the connector's offer names, else `eip3009`. */
3982
+ depositMethod: 'eip3009' | 'permit2' | undefined;
3983
+ depositGas: 'auto' | 'facilitator' | 'self';
3761
3984
  autoOpenChannel: boolean;
3762
3985
  timeoutMs: number;
3763
3986
  channelStore: ChannelStore;
@@ -5569,6 +5792,13 @@ declare function settleDeposit(params: {
5569
5792
  facilitatorUrl: string;
5570
5793
  offer: BatchSettlementEvmOffer;
5571
5794
  payload: BatchDepositPayload<unknown>;
5795
+ /**
5796
+ * x402 extensions for the facilitator — a gas-sponsored Permit2 approval
5797
+ * (`deposit-gas.ts`) — carried as `paymentPayload.extensions`.
5798
+ */
5799
+ extensions?: Record<string, {
5800
+ info: Record<string, unknown>;
5801
+ }>;
5572
5802
  fetchImpl?: typeof fetch;
5573
5803
  }): Promise<SettledDeposit>;
5574
5804
 
@@ -6736,4 +6966,4 @@ interface RetryOptions {
6736
6966
  */
6737
6967
  declare function withRetry<T>(operation: () => Promise<T>, options: RetryOptions): Promise<T>;
6738
6968
 
6739
- export { ACCUMULATED_COST_HEADER, ACCUMULATED_COST_PROTOCOL, ARNS_KIND, type AntSpawnOutcome, type AntSpawnParams, type AntSpawnRefused, type AntSpawnStep, type AntSpawned, type ArnsAntPrepareReceipt, type ArnsBuyOutcome, type ArnsBuyParams, type ArnsBuyReceipt, type ArnsNameType, type ArnsNameWithAntOutcome, type ArnsNetwork, type BTPMessage, BTPMessageType, type BTPProtocolData, type BatchChannel, type BatchChannelConfig, BatchChannelManager, type BatchChannelSummary, type BatchDepositPayload, type BatchExitResult, type BatchSettlementBinding, type BatchSettlementEvmOffer, type BatchSettlementOffer, BatchSettlementPayer, type BatchSettlementPayerConfig, type BatchSettlementSvmOffer, type BatchSettlementTerms, type BatchVoucher, BeforePayRefusedError, BtpAuthError, type BtpChannelDeclaration, BtpConnectionError, type BtpPacketResponse, BtpPaidWriteTransport, type BtpPaidWriteTransportConfig, BtpRuntimeClient, type BtpRuntimeClientConfig, CHANNEL_CHALLENGE_MAX_LIFETIME_SECONDS, CLAIM_ACK_HEADER, CLAIM_ACK_PROTOCOL, CLAIM_REJECT_REASONS, CONNECTOR_MAX_TIMEOUT_SECONDS, ChainKind, ChainUnavailableError, type ChannelBinding, type ChannelBindingContext, type ChannelFacade, type ChannelFacadeDeps, ChannelFundingError, ChannelNotOpenError, ChannelResumeError, type ChannelState, type ChannelStore, type ChannelStoreEntry, type ClaimAck, type ClaimSendingTransport$1 as ClaimSendingTransport, type ClaimStateFailed, type ClaimStateOk, type ClaimStateRequestEntry, type ClaimStateResult, type ClaimSummary, ClientChannelFacade, ClientWalletFacade, ConfigError, ConnectorEdgeClient, type ConnectorEdgeClientConfig, ConnectorEdgeError, type ConnectorEdgeErrorCode, ConnectorError, type ConnectorIdentity, type ConnectorRoutePrice, type ConnectorRouteTerms, type ContractReader, DEFAULT_DEPOSIT, DEFAULT_TIMEOUT_MS, DEVNET, type Decoded, type DeriveIdentityOptions, type DerivedIdentity, type DevnetNode, ERC3009_DEPOSIT_COLLECTOR_ADDRESS, type EdgeIdentity, type Eip3009DepositPayload, type EncryptedKeystore, type Envelope, EnvelopeError, EnvelopeErrorKind, type EnvelopeHeader, type EnvelopeRequest, type EnvelopeResponse, type EvmBatchChannelState, type EvmExitClients, EvmSigner, type ExchangeOutcome, FULFILLMENT_MISMATCH_CODE, FULFILLMENT_MISMATCH_MESSAGE, FacilitatorError, type FaucetChain, type FundWalletOptions, type FundWalletResult, GIFTWRAP_NONCE_LENGTH, GIFTWRAP_PUBLIC_KEY_LENGTH, GIFTWRAP_SECRET_LENGTH, GIFTWRAP_TYPE_REQUEST, GIFTWRAP_TYPE_RESPONSE, type GasStationExecuteReceipt, type GasStationFailureReason, type GasStationFailureReceipt, type GasStationQuoteReceipt, type GasStationReceipt, type GiftWrapEcdh, GiftWrapError, GiftWrapErrorKind, HS_HOSTNAME_MAX_LENGTH, HS_HOSTNAME_REGEX, HttpIlpClient, type HttpIlpClientConfig, type ILPFulfillPacket, ILPPacketType, type ILPPreparePacket, type ILPRejectPacket, type ILPResponsePacket, ILP_CLAIM_HEADER, ILP_PEER_ID_HEADER, type IlpClient, type IlpResponseMeta, type IlpSendParams, type IlpSendResult, type IlpSendResultWithFulfillment, InMemoryChannelStore, InsufficientBalanceError, InvalidAddressError, IsomorphicBtpClient, type JobAnswer, type JobEndpoint, type JobEvent, type JobEventParams, type JobSender, JsonFileChannelStore, KEYSTORE_VERSION, type KeyDerivationScheme, MAX_GRACE_PERIOD_SECONDS, MAX_WITHDRAW_DELAY_SECONDS, MIN_GRACE_PERIOD_SECONDS, MIN_WITHDRAW_DELAY_SECONDS, NetworkError, type NodeSelfDescription, OerError, OerErrorKind, type OpenedKeystore, type OpenedRequest, PACKET_EXPIRY_HEADROOM_MS, PAYMENT_CHANNELS_PROGRAM_ID, PAYMENT_REQUIRED_HEADER, PAYMENT_REQUIRED_PROTOCOL, PERMIT2_ADDRESS, PERMIT2_DEPOSIT_COLLECTOR_ADDRESS, PROXIED_RPC_DEFAULTS, type PaidWriteTransport, type ParsedX402Challenge, PaymentRequiredError, type PaymentTerms, type Permit2DepositPayload, type PreparedVoucher, type ProxiedChainRpc, type RequiredTransport, type ResolvedConfig, type ResolvedIdentity, type ResponseHeaderSource, type RetryOptions, type RouteCharge, RouteNotPricedError, type RoutePrice, type RpcTransportOptions, SOLANA_GAS_KIND, type SealedExchange, type SealedRequest, SealedResponseError, type SealedResponseErrorKind, type SendContext, type SendFulfilled, type SendOptions, type SendRefused, type SendRequest, type SendResult, type SendTransferParams, type SendTransferResult, type SettledDeposit, type Signer as SolanaKeypair, type SolanaNetwork, SolanaRpcTransportError, type SolanaWireTransaction, SponsorRefusedError, type SponsoredOpen, StaleRpcReadError, type SvmBatchChannelConfig, type SvmBatchChannelState, type SvmBatchVoucher, ToonClient, type ToonClientConfig, ToonClientError, type ToonClientLike, type ToonGreeting, type ToonIdentity, type ToonTermsInfo, TransactionOutcomeError, type TransferConfig, TransferNotDeliveredError, TransferUnsupportedError, type TransportChoice, type TransportPreference, TransportRequiredError, type TypedDataSigner, UnknownChainError, ValidationError, type VoucherClaimEnvelope, type VoucherOutcome, type VoucherSigner, type WalletBalance, type WalletBalanceSources, type WalletChainBalances, type WalletFacade, type WalletFacadeDeps, type WalletTokenAmount, type WriteKeystoreOptions, X402_BATCH_SETTLEMENT_ADDRESS, X402_BATCH_SETTLEMENT_EXIT_ABI, X402_BATCH_SETTLEMENT_READ_ABI, addressFor, assertRoutableHsHostname, batchChannelId, batchVoucherDigest, buildBatchChannelConfig, buildEip3009Deposit, buildJobEvent, buildPermit2Deposit, buildResponseMeta, buildSponsoredOpen, buildSvmBatchChannelConfig, buildSvmRequestCloseInstruction, buildSvmSealInstruction, buildSvmTopUpInstruction, buildSvmVoucherMessage, buildSvmWithdrawPayerInstruction, buyArnsName, buyArnsNameWithNewAnt, chainUnavailableMessage, chargeFor, chooseBatchSettlement, connectorEdgeBaseUrl, decodeAccumulatedCost, decodeBase64Text, decodeClaimAck, decodeEnvelope, decodeEnvelopeRequest, decodeEnvelopeResponse, decodePaymentRequired, decodeSvmBatchChannel, decodeVarOctetString, decodeVarUint, decryptMnemonic, defaultDestinationFor, defaultFacilitatorFor, defaultFaucetTimeout, defaultRpcUrl, deriveFulfillment, deriveFullIdentity, deserializeIlpPacket, deserializeIlpPrepare, encodeEnvelope, encodeEnvelopeRequest, encodeEnvelopeResponse, encodeVarOctetString, encodeVarUint, encryptMnemonic, envelopeHeader, evmChainIdOf, evmChallengeDigest, evmDerivationPath, evmIdentityFromKey, evmVoucherClaim, finalizeEvmBatchWithdraw, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, generateSolanaKeypair, getSvmBatchChannel, giftWrapPublicKey, httpEndpointToBtpUrl, importKeystore, initiateEvmBatchWithdraw, isGasStationFailure, isHiddenServiceUrl, isInsufficientGasError, isRoutableHsHostname, jobEventParam, keystoreDerivation, loadKeystore, localGiftWrapEcdh, looksLikeSealedResponse, mapIlpResponse, nextVoucherAmount, offerFromTerms, openKeystore, openRequest, openResponse, parseBatchSettlementOffer, parseBatchSettlementTerms, parseBtpMessage, parsePaymentTerms, parseSelfDescription, parseSolanaWireTransaction, parseX402Body, parseX402Challenge, patchSolanaRecentBlockhash, paymentChannelsEventAuthority, readBaseUnits, readResponseMeta$1 as readBtpResponseMeta, readEvmBatchChannel, readEvmNativeBalance, readEvmTokenBalance, readExchangeOutcome, readResponseMeta, readSolanaNativeBalance, readSolanaTokenBalance, readVoucherRefusal, readWalletBalances, requestSponsoredOpen, requestSvmBatchClose, resolveConfig, resolveExpectedFulfillment, resolveExpiresAt, routeFor, routePriceFor, rpcFetch, rpcTransport, sealExchange, sealRequest, sealRequestWithRandomness, sealResponse, sealResponseWithRandomness, selectTransport, send, sendJob, sendTransfer, serializeBtpMessage, serializeIlpFulfill, serializeIlpPrepare, serializeIlpReject, settleDeposit, signBatchVoucher, signEvmChallenge, signSolanaChallenge, signSolanaWireTransaction, signSvmVoucher, singleRecipientDistributionHash, solanaChallengeMessage, solanaKeypair, solanaVoucherClaim, spawnAnt, svmBatchChannelAddress, toEnvelopeRequest, trimTrailingSlashes, validateMnemonic, withRetry, withdrawSvmBatchChannel, writeKeystoreFile };
6969
+ export { ACCUMULATED_COST_HEADER, ACCUMULATED_COST_PROTOCOL, ARNS_KIND, type AntSpawnOutcome, type AntSpawnParams, type AntSpawnRefused, type AntSpawnStep, type AntSpawned, type ArnsAntPrepareReceipt, type ArnsBuyOutcome, type ArnsBuyParams, type ArnsBuyReceipt, type ArnsNameType, type ArnsNameWithAntOutcome, type ArnsNetwork, type BTPMessage, BTPMessageType, type BTPProtocolData, type BatchChannel, type BatchChannelConfig, BatchChannelManager, type BatchChannelSummary, type BatchDepositPayload, type BatchExitResult, type BatchSettlementBinding, type BatchSettlementEvmOffer, type BatchSettlementOffer, BatchSettlementPayer, type BatchSettlementPayerConfig, type BatchSettlementSvmOffer, type BatchSettlementTerms, type BatchVoucher, BeforePayRefusedError, BtpAuthError, type BtpChannelDeclaration, BtpConnectionError, type BtpPacketResponse, BtpPaidWriteTransport, type BtpPaidWriteTransportConfig, BtpRuntimeClient, type BtpRuntimeClientConfig, CHANNEL_CHALLENGE_MAX_LIFETIME_SECONDS, CLAIM_ACK_HEADER, CLAIM_ACK_PROTOCOL, CLAIM_REJECT_REASONS, CONNECTOR_MAX_TIMEOUT_SECONDS, ChainKind, ChainUnavailableError, type ChannelBinding, type ChannelBindingContext, type ChannelFacade, type ChannelFacadeDeps, ChannelFundingError, ChannelNotOpenError, ChannelResumeError, type ChannelState, type ChannelStore, type ChannelStoreEntry, type ClaimAck, type ClaimSendingTransport$1 as ClaimSendingTransport, type ClaimStateFailed, type ClaimStateOk, type ClaimStateRequestEntry, type ClaimStateResult, type ClaimSummary, ClientChannelFacade, ClientWalletFacade, ConfigError, ConnectorEdgeClient, type ConnectorEdgeClientConfig, ConnectorEdgeError, type ConnectorEdgeErrorCode, ConnectorError, type ConnectorIdentity, type ConnectorRoutePrice, type ConnectorRouteTerms, type ContractReader, DEFAULT_DEPOSIT, DEFAULT_TIMEOUT_MS, DEVNET, type Decoded, type DepositExtensions, type DeriveIdentityOptions, type DerivedIdentity, type DevnetNode, EIP2612_GAS_SPONSORING, ERC20_APPROVAL_GAS_SPONSORING, ERC3009_DEPOSIT_COLLECTOR_ADDRESS, type EdgeIdentity, type Eip3009DepositPayload, type EncryptedKeystore, type Envelope, EnvelopeError, EnvelopeErrorKind, type EnvelopeHeader, type EnvelopeRequest, type EnvelopeResponse, type EvmBatchChannelState, type EvmExitClients, EvmSigner, type EvmWalletAccess, type ExchangeOutcome, FULFILLMENT_MISMATCH_CODE, FULFILLMENT_MISMATCH_MESSAGE, FacilitatorError, type FaucetChain, type FundWalletOptions, type FundWalletResult, GIFTWRAP_NONCE_LENGTH, GIFTWRAP_PUBLIC_KEY_LENGTH, GIFTWRAP_SECRET_LENGTH, GIFTWRAP_TYPE_REQUEST, GIFTWRAP_TYPE_RESPONSE, type GasStationExecuteReceipt, type GasStationFailureReason, type GasStationFailureReceipt, type GasStationQuoteReceipt, type GasStationReceipt, type GiftWrapEcdh, GiftWrapError, GiftWrapErrorKind, HS_HOSTNAME_MAX_LENGTH, HS_HOSTNAME_REGEX, HttpIlpClient, type HttpIlpClientConfig, type ILPFulfillPacket, ILPPacketType, type ILPPreparePacket, type ILPRejectPacket, type ILPResponsePacket, ILP_CLAIM_HEADER, ILP_PEER_ID_HEADER, type IlpClient, type IlpResponseMeta, type IlpSendParams, type IlpSendResult, type IlpSendResultWithFulfillment, InMemoryChannelStore, InsufficientBalanceError, InvalidAddressError, IsomorphicBtpClient, type JobAnswer, type JobEndpoint, type JobEvent, type JobEventParams, type JobSender, JsonFileChannelStore, KEYSTORE_VERSION, type KeyDerivationScheme, MAX_GRACE_PERIOD_SECONDS, MAX_WITHDRAW_DELAY_SECONDS, MIN_GRACE_PERIOD_SECONDS, MIN_WITHDRAW_DELAY_SECONDS, NetworkError, type NodeSelfDescription, OerError, OerErrorKind, type OpenedKeystore, type OpenedRequest, PACKET_EXPIRY_HEADROOM_MS, PAYMENT_CHANNELS_PROGRAM_ID, PAYMENT_REQUIRED_HEADER, PAYMENT_REQUIRED_PROTOCOL, PERMIT2_ADDRESS, PERMIT2_DEPOSIT_COLLECTOR_ADDRESS, PROXIED_RPC_DEFAULTS, type PaidWriteTransport, type ParsedX402Challenge, PaymentRequiredError, type PaymentTerms, type Permit2DepositPayload, type PreparedVoucher, type ProxiedChainRpc, type RequiredTransport, type ResolvedConfig, type ResolvedIdentity, type ResponseHeaderSource, type RetryOptions, type RouteCharge, RouteNotPricedError, type RoutePrice, type RpcTransportOptions, SOLANA_GAS_KIND, type SealedExchange, type SealedRequest, SealedResponseError, type SealedResponseErrorKind, type SendContext, type SendFulfilled, type SendOptions, type SendRefused, type SendRequest, type SendResult, type SendTransferParams, type SendTransferResult, type SettledDeposit, type Signer as SolanaKeypair, type SolanaNetwork, SolanaRpcTransportError, type SolanaWireTransaction, SponsorRefusedError, type SponsoredOpen, StaleRpcReadError, type SvmBatchChannelConfig, type SvmBatchChannelState, type SvmBatchVoucher, ToonClient, type ToonClientConfig, ToonClientError, type ToonClientLike, type ToonGreeting, type ToonIdentity, type ToonTermsInfo, TransactionOutcomeError, type TransferConfig, TransferNotDeliveredError, TransferUnsupportedError, type TransportChoice, type TransportPreference, TransportRequiredError, type TypedDataSigner, UnknownChainError, ValidationError, type VoucherClaimEnvelope, type VoucherOutcome, type VoucherSigner, type WalletBalance, type WalletBalanceSources, type WalletChainBalances, type WalletFacade, type WalletFacadeDeps, type WalletTokenAmount, type WriteKeystoreOptions, X402_BATCH_SETTLEMENT_ADDRESS, X402_BATCH_SETTLEMENT_DEPOSIT_ABI, X402_BATCH_SETTLEMENT_EXIT_ABI, X402_BATCH_SETTLEMENT_READ_ABI, addressFor, approvePermit2, assertRoutableHsHostname, batchChannelId, batchVoucherDigest, buildBatchChannelConfig, buildEip3009Deposit, buildJobEvent, buildPermit2Deposit, buildResponseMeta, buildSponsoredOpen, buildSvmBatchChannelConfig, buildSvmRequestCloseInstruction, buildSvmSealInstruction, buildSvmTopUpInstruction, buildSvmVoucherMessage, buildSvmWithdrawPayerInstruction, buyArnsName, buyArnsNameWithNewAnt, chainUnavailableMessage, chargeFor, chooseBatchSettlement, connectorEdgeBaseUrl, decodeAccumulatedCost, decodeBase64Text, decodeClaimAck, decodeEnvelope, decodeEnvelopeRequest, decodeEnvelopeResponse, decodePaymentRequired, decodeSvmBatchChannel, decodeVarOctetString, decodeVarUint, decryptMnemonic, defaultDestinationFor, defaultFacilitatorFor, defaultFaucetTimeout, defaultRpcUrl, depositDirectly, deriveFulfillment, deriveFullIdentity, deserializeIlpPacket, deserializeIlpPrepare, eip2612Nonce, eip2612PermitData, encodeEnvelope, encodeEnvelopeRequest, encodeEnvelopeResponse, encodeVarOctetString, encodeVarUint, encryptMnemonic, envelopeHeader, erc3009CollectorData, evmChainIdOf, evmChallengeDigest, evmDerivationPath, evmIdentityFromKey, evmVoucherClaim, evmWalletAccess, facilitatorExtensions, finalizeEvmBatchWithdraw, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, generateSolanaKeypair, getSvmBatchChannel, giftWrapPublicKey, httpEndpointToBtpUrl, importKeystore, initiateEvmBatchWithdraw, isGasStationFailure, isHiddenServiceUrl, isInsufficientGasError, isRoutableHsHostname, jobEventParam, keystoreDerivation, loadKeystore, localGiftWrapEcdh, looksLikeSealedResponse, mapIlpResponse, nextVoucherAmount, offerFromTerms, openKeystore, openRequest, openResponse, parseBatchSettlementOffer, parseBatchSettlementTerms, parseBtpMessage, parsePaymentTerms, parseSelfDescription, parseSolanaWireTransaction, parseX402Body, parseX402Challenge, patchSolanaRecentBlockhash, paymentChannelsEventAuthority, permit2Allowance, permit2CollectorData, readBaseUnits, readResponseMeta$1 as readBtpResponseMeta, readEvmBatchChannel, readEvmNativeBalance, readEvmTokenBalance, readExchangeOutcome, readResponseMeta, readSolanaNativeBalance, readSolanaTokenBalance, readVoucherRefusal, readWalletBalances, requestSponsoredOpen, requestSvmBatchClose, resolveConfig, resolveExpectedFulfillment, resolveExpiresAt, routeFor, routePriceFor, rpcFetch, rpcTransport, sealExchange, sealRequest, sealRequestWithRandomness, sealResponse, sealResponseWithRandomness, selectTransport, send, sendJob, sendTransfer, serializeBtpMessage, serializeIlpFulfill, serializeIlpPrepare, serializeIlpReject, settleDeposit, signBatchVoucher, signEip2612GasSponsoring, signErc20ApprovalGasSponsoring, signEvmChallenge, signSolanaChallenge, signSolanaWireTransaction, signSvmVoucher, singleRecipientDistributionHash, solanaChallengeMessage, solanaKeypair, solanaVoucherClaim, spawnAnt, svmBatchChannelAddress, toEnvelopeRequest, trimTrailingSlashes, validateMnemonic, withRetry, withdrawSvmBatchChannel, writeKeystoreFile };
package/dist/index.js CHANGED
@@ -37,6 +37,8 @@ import {
37
37
  ConnectorError,
38
38
  DEFAULT_DEPOSIT,
39
39
  DEFAULT_TIMEOUT_MS,
40
+ EIP2612_GAS_SPONSORING,
41
+ ERC20_APPROVAL_GAS_SPONSORING,
40
42
  ERC3009_DEPOSIT_COLLECTOR_ADDRESS,
41
43
  EnvelopeError,
42
44
  EnvelopeErrorKind,
@@ -89,9 +91,11 @@ import {
89
91
  UnknownChainError,
90
92
  ValidationError,
91
93
  X402_BATCH_SETTLEMENT_ADDRESS,
94
+ X402_BATCH_SETTLEMENT_DEPOSIT_ABI,
92
95
  X402_BATCH_SETTLEMENT_EXIT_ABI,
93
96
  X402_BATCH_SETTLEMENT_READ_ABI,
94
97
  addressFor,
98
+ approvePermit2,
95
99
  batchChannelId,
96
100
  batchVoucherDigest,
97
101
  buildBatchChannelConfig,
@@ -122,9 +126,12 @@ import {
122
126
  decodeVarUint,
123
127
  defaultDestinationFor,
124
128
  defaultFaucetTimeout,
129
+ depositDirectly,
125
130
  deriveFulfillment,
126
131
  deserializeIlpPacket,
127
132
  deserializeIlpPrepare,
133
+ eip2612Nonce,
134
+ eip2612PermitData,
128
135
  encodeEnvelope,
129
136
  encodeEnvelopeRequest,
130
137
  encodeEnvelopeResponse,
@@ -132,9 +139,12 @@ import {
132
139
  encodeVarOctetString,
133
140
  encodeVarUint,
134
141
  envelopeHeader,
142
+ erc3009CollectorData,
135
143
  evmChainIdOf,
136
144
  evmChallengeDigest,
137
145
  evmVoucherClaim,
146
+ evmWalletAccess,
147
+ facilitatorExtensions,
138
148
  finalizeEvmBatchWithdraw,
139
149
  fromBase64,
140
150
  fundWallet,
@@ -161,6 +171,8 @@ import {
161
171
  parseX402Challenge,
162
172
  patchSolanaRecentBlockhash,
163
173
  paymentChannelsEventAuthority,
174
+ permit2Allowance,
175
+ permit2CollectorData,
164
176
  readBaseUnits,
165
177
  readEvmBatchChannel,
166
178
  readEvmNativeBalance,
@@ -195,6 +207,8 @@ import {
195
207
  serializeIlpReject,
196
208
  settleDeposit,
197
209
  signBatchVoucher,
210
+ signEip2612GasSponsoring,
211
+ signErc20ApprovalGasSponsoring,
198
212
  signEvmChallenge,
199
213
  signSolanaChallenge,
200
214
  signSolanaWireTransaction,
@@ -209,7 +223,7 @@ import {
209
223
  trimTrailingSlashes,
210
224
  withRetry,
211
225
  withdrawSvmBatchChannel
212
- } from "./chunk-CG3OXV74.js";
226
+ } from "./chunk-SS3GGBUE.js";
213
227
  import {
214
228
  DEVNET,
215
229
  HS_HOSTNAME_MAX_LENGTH,
@@ -607,6 +621,8 @@ export {
607
621
  DEFAULT_DEPOSIT,
608
622
  DEFAULT_TIMEOUT_MS,
609
623
  DEVNET,
624
+ EIP2612_GAS_SPONSORING,
625
+ ERC20_APPROVAL_GAS_SPONSORING,
610
626
  ERC3009_DEPOSIT_COLLECTOR_ADDRESS,
611
627
  EnvelopeError,
612
628
  EnvelopeErrorKind,
@@ -663,9 +679,11 @@ export {
663
679
  UnknownChainError,
664
680
  ValidationError,
665
681
  X402_BATCH_SETTLEMENT_ADDRESS,
682
+ X402_BATCH_SETTLEMENT_DEPOSIT_ABI,
666
683
  X402_BATCH_SETTLEMENT_EXIT_ABI,
667
684
  X402_BATCH_SETTLEMENT_READ_ABI,
668
685
  addressFor,
686
+ approvePermit2,
669
687
  assertRoutableHsHostname,
670
688
  batchChannelId,
671
689
  batchVoucherDigest,
@@ -702,10 +720,13 @@ export {
702
720
  defaultFacilitatorFor,
703
721
  defaultFaucetTimeout,
704
722
  defaultRpcUrl,
723
+ depositDirectly,
705
724
  deriveFulfillment,
706
725
  deriveFullIdentity,
707
726
  deserializeIlpPacket,
708
727
  deserializeIlpPrepare,
728
+ eip2612Nonce,
729
+ eip2612PermitData,
709
730
  encodeEnvelope,
710
731
  encodeEnvelopeRequest,
711
732
  encodeEnvelopeResponse,
@@ -713,11 +734,14 @@ export {
713
734
  encodeVarUint,
714
735
  encryptMnemonic,
715
736
  envelopeHeader,
737
+ erc3009CollectorData,
716
738
  evmChainIdOf,
717
739
  evmChallengeDigest,
718
740
  evmDerivationPath,
719
741
  evmIdentityFromKey,
720
742
  evmVoucherClaim,
743
+ evmWalletAccess,
744
+ facilitatorExtensions,
721
745
  finalizeEvmBatchWithdraw,
722
746
  fundWallet,
723
747
  generateKeystore,
@@ -754,6 +778,8 @@ export {
754
778
  parseX402Challenge,
755
779
  patchSolanaRecentBlockhash,
756
780
  paymentChannelsEventAuthority,
781
+ permit2Allowance,
782
+ permit2CollectorData,
757
783
  readBaseUnits,
758
784
  readResponseMeta as readBtpResponseMeta,
759
785
  readEvmBatchChannel,
@@ -789,6 +815,8 @@ export {
789
815
  serializeIlpReject,
790
816
  settleDeposit,
791
817
  signBatchVoucher,
818
+ signEip2612GasSponsoring,
819
+ signErc20ApprovalGasSponsoring,
792
820
  signEvmChallenge,
793
821
  signSolanaChallenge,
794
822
  signSolanaWireTransaction,