@forevermoney/sdk 0.5.2 → 0.5.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.cts CHANGED
@@ -91,6 +91,7 @@ interface TransactionPlan {
91
91
  declare const MIN_LIQUID_EVM_TO_SUBTENSOR_WEI = 10000000000000000n;
92
92
  declare const MIN_LIQUID_BASE_TO_SUBTENSOR_WEI = 10000000000000000n;
93
93
  declare const MIN_LIQUID_SUBTENSOR_TO_EVM_WEI: bigint;
94
+ declare const EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT = 3500000n;
94
95
  type SubtensorDelivery = 'liquid' | 'staked';
95
96
  type SubtensorSource = 'liquid' | 'staked';
96
97
  type BridgeAsset = 'tao' | 'sn80';
@@ -121,6 +122,12 @@ interface EvmToSubtensorRequest {
121
122
  readonly evmChain: ForeverMoneyEvmChain;
122
123
  readonly asset?: BridgeAsset;
123
124
  readonly partnerFee?: PartnerFee;
125
+ /**
126
+ * CCIP gas made available to the Subtensor receiver. Defaults to
127
+ * `EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT`; set per transaction when the
128
+ * destination execution path needs a different budget.
129
+ */
130
+ readonly destinationGasLimit?: bigint;
124
131
  readonly sender: string;
125
132
  readonly amountWei: bigint;
126
133
  readonly destination: string;
@@ -252,12 +259,12 @@ declare function feeWithBuffer(fee: bigint): bigint;
252
259
  declare function gasLimitWithBuffer(gasLimit: bigint): bigint;
253
260
 
254
261
  declare const foreverMoneyAbis: Readonly<{
255
- alphaGateway: readonly ["function ROUTER() view returns (address)", "function allowedLane(uint64 selector) view returns (bool)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function integratorTaoTopUp(uint256 taoAmount,uint16 bps) pure returns (uint256)", "function quoteBridgeOut(uint64 destSelector,address token,address recipient,uint256 mintedAmount) view returns (uint256 fee)", "function bridgeOut(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut) payable returns (bytes32 messageId)", "function integratorCut(uint256 amount,uint16 bps) pure returns (uint256)", "function quoteBridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 mintedAmount,uint256 taoAmount,uint256 stakedAlphaRao,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 nativeTopUp,uint256 alphaTopUp,uint256 amountCrossing)", "function bridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function bridgeOutFromValidators(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut) payable returns (bytes32 messageId)", "function bridgeOutFromValidatorsWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function minStakeRequired() view returns (uint256)", "function MAX_STAKE_SOURCES() view returns (uint256)", "function GATEWAY_COLDKEY() view returns (bytes32)", "function claimLiquid(address token,uint256 minTaoOut,address to)", "function claimNative(address to)", "function claimStaked(address token,bytes32 destColdkey,address to)", "function claimToken(address token,address to)", "function claimableNative(address account) view returns (uint256)", "function claimableToken(address token,address account) view returns (uint256)", "event BridgedOut(uint64 destChainSelector,address indexed token,address indexed sender,address indexed recipient,uint256 minted,bytes32 messageId)", "event Claimable(address indexed token,address indexed user,uint256 native,uint256 wsn)", "event NotDelivered(uint64 indexed sourceChainSelector,address indexed token,uint256 amount,uint8 reason)", "event DeliveredLiquid(address indexed token,bytes32 indexed ss58,uint256 taoOut)", "event DeliveredStaked(address indexed token,bytes32 indexed ss58,uint256 alphaRao)"];
262
+ alphaGateway: readonly ["function ROUTER() view returns (address)", "function allowedLane(uint64 selector) view returns (bool)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function integratorTaoTopUp(uint256 taoAmount,uint16 bps) pure returns (uint256)", "function quoteBridgeOut(uint64 destSelector,address token,address recipient,uint256 mintedAmount) view returns (uint256 fee)", "function bridgeOut(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut) payable returns (bytes32 messageId)", "function integratorCut(uint256 amount,uint16 bps) pure returns (uint256)", "function quoteBridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 mintedAmount,uint256 taoAmount,uint256 stakedAlphaRao,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 nativeTopUp,uint256 alphaTopUp,uint256 amountCrossing)", "function bridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function bridgeOutFromValidators(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut) payable returns (bytes32 messageId)", "function bridgeOutFromValidatorsWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function MAX_STAKE_SOURCES() view returns (uint256)", "function GATEWAY_COLDKEY() view returns (bytes32)", "function claimLiquid(address token,uint256 minTaoOut,address to)", "function claimNative(address to)", "function claimStaked(address token,bytes32 destColdkey,address to)", "function claimToken(address token,address to)", "function claimableNative(address account) view returns (uint256)", "function claimableToken(address token,address account) view returns (uint256)", "event BridgedOut(uint64 destChainSelector,address indexed token,address indexed sender,address indexed recipient,uint256 minted,bytes32 messageId)", "event Claimable(address indexed token,address indexed user,uint256 native,uint256 wsn)", "event NotDelivered(uint64 indexed sourceChainSelector,address indexed token,uint256 amount,uint8 reason)", "event DeliveredLiquid(address indexed token,bytes32 indexed ss58,uint256 taoOut)", "event DeliveredStaked(address indexed token,bytes32 indexed ss58,uint256 alphaRao)"];
256
263
  alphaVault: readonly ["function isPaused() view returns (bool)", "function pausedUntil() view returns (uint256)", "function isListed(address token) view returns (bool)", "function backing(address token) view returns (uint256 stakedAlpha)", "function positionOf(address token) view returns (bytes32 validator,uint256 netuid)"];
257
264
  ccipExecution: readonly ["event ExecutionStateChanged(uint64 indexed sourceChainSelector,uint64 indexed sequenceNumber,bytes32 indexed messageId,bytes32 messageHash,uint8 state,bytes returnData,uint256 gasUsed)"];
258
265
  ccipRouter: readonly ["function isOffRamp(uint64 sourceChainSelector,address offRamp) view returns (bool)"];
259
266
  erc20: readonly ["function allowance(address owner,address spender) view returns (uint256)", "function approve(address spender,uint256 amount) returns (bool)", "function balanceOf(address account) view returns (uint256)"];
260
- spokeGateway: readonly ["function ROUTER() view returns (address)", "function BITTENSOR_SELECTOR() view returns (uint64)", "function SUBTENSOR_GATEWAY() view returns (address)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function quoteBridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit) view returns (uint256 fee)", "function bridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit) payable returns (bytes32 messageId)", "function quoteBridgeToFinneyWithFee(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 cut,uint256 amountCrossing)", "function bridgeToFinneyWithFee(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "event BridgedToFinney(address indexed token,address indexed sender,bytes32 indexed ss58,uint256 amount,bytes32 messageId)"];
267
+ spokeGateway: readonly ["function ROUTER() view returns (address)", "function BITTENSOR_SELECTOR() view returns (uint64)", "function SUBTENSOR_GATEWAY() view returns (address)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function quoteBridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit) view returns (uint256 fee)", "function quoteBridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit) view returns (uint256 fee)", "function bridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit) payable returns (bytes32 messageId)", "function bridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit) payable returns (bytes32 messageId)", "function quoteBridgeToFinneyWithFee(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 cut,uint256 amountCrossing)", "function bridgeToFinneyWithFee(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "event BridgedToFinney(address indexed token,address indexed sender,bytes32 indexed ss58,uint256 amount,bytes32 messageId)"];
261
268
  staking: readonly ["function allowance(address sourceAddress,address spenderAddress,uint256 netuid) view returns (uint256)", "function approve(address spenderAddress,uint256 netuid,uint256 absoluteAmount)", "function getStake(bytes32 hotkey,bytes32 coldkey,uint256 netuid) view returns (uint256)"];
262
269
  vaultFactory: readonly ["function create(address owner,bytes32 associatedMiner,address akAddress,address poolManager,address poolAddress,address positionManagerImpl,(address token,uint256 amount)[] stashTokens) payable returns (address manager)", "event SnLiquidityManagerCreated(address indexed manager,address indexed owner,bytes32 associatedMiner,address akAddress,address poolAddress,address poolManager,address positionManager)"];
263
270
  vaultManager: readonly ["function claimFees(address akAddress)", "function topUpAk(address akAddress,address token,uint256 amount) payable", "function withdrawFromAkAndPositions(address akAddress,uint256 amount0,uint256 amount1,uint256[] decreaseTokenIds,bool unwrapETH)", "function stake(address akAddress,bytes data)", "function unstake(address akAddress,bytes data)", "function owner() view returns (address)", "event AKStashTopUp(address akAddress,address token,uint256 amount)", "event AKStashWithdraw(address akAddress,address token,uint256 amount)"];
@@ -441,4 +448,4 @@ interface ViemTransactionRequest {
441
448
  }
442
449
  declare function toViemTransaction(transaction: PreparedTransaction): Readonly<ViemTransactionRequest>;
443
450
 
444
- export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, type BridgeAsset, type BridgeDirection, type BridgePreparation, type BridgeSourceStatus, type BridgeSourceStatusRequest, type BridgeSourceTransactionStatus, type BuildBaseToSubtensorPlanRequest, type BuildEvmToSubtensorPlanRequest, type BuildSubtensorToBasePlanRequest, type BuildSubtensorToEvmPlanRequest, type CcipDeliveryCheckpoint, type CcipDeliveryStatus, type CcipDeliveryStatusRequest, type CreateVaultRequest, type DepositVaultRequest, EVM_WEI_PER_RAO, type Eip1193TransactionRequest, type EstimateRoundedStakeRequest, type EthersCompatibleTransactionRequest, type EvmToSubtensorRequest, FOREVERMONEY_DEPLOYMENT_VERSION, type ForeverMoneyClient, type ForeverMoneyClientOptions, type ForeverMoneyDeployment, ForeverMoneyError, type ForeverMoneyErrorCode, type ForeverMoneyEvmChain, GAS_LIMIT_BUFFER_BPS, type HttpTransportOptions, type LegacyRpcProvider, MAX_PARTNER_FEE_BPS, MAX_STAKE_PULLS, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, MIN_LIQUID_SUBTENSOR_TO_EVM_WEI, NETWORK_FEE_BUFFER_BPS, type PartnerFee, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RoundedStakeEstimate, type RpcRequest, type RpcTransport, SN80_NETUID, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, type StakePosition, type StakePull, type StakeRoundingOptions, type StakeRoundingResult, type SubtensorDelivery, type SubtensorSource, type SubtensorToBaseRequest, type SubtensorToEvmRequest, type TrackingProvider, type TransactionAction, type TransactionPlan, type TransactionReceiptLike, type TransactionStep, type TransactionStepKind, type VaultStashToken, type VaultTokenAllowance, type ViemTransactionRequest, type WithdrawVaultRequest, assertWholeRao, bridgeMessageIdFromReceipt, buildBaseToSubtensorPlan, buildClaimVaultFeesPlan, buildCreateVaultPlan, buildDepositVaultPlan, buildEvmToSubtensorPlan, buildSetVaultStakingPlan, buildSubtensorToBasePlan, buildSubtensorToEvmPlan, buildWithdrawVaultPlan, createForeverMoneyClient, destinationChainId, estimateRoundedStake, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, partnerFeeCut, partnerFeeTaoTopUp, sourceChainId, ss58ToPublicKey, stakedMinimumOutput, strandedStakeSource, toEip1193Transaction, toEthersTransaction, toViemTransaction, vaultManagerFromCreationReceipt };
451
+ export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, type BridgeAsset, type BridgeDirection, type BridgePreparation, type BridgeSourceStatus, type BridgeSourceStatusRequest, type BridgeSourceTransactionStatus, type BuildBaseToSubtensorPlanRequest, type BuildEvmToSubtensorPlanRequest, type BuildSubtensorToBasePlanRequest, type BuildSubtensorToEvmPlanRequest, type CcipDeliveryCheckpoint, type CcipDeliveryStatus, type CcipDeliveryStatusRequest, type CreateVaultRequest, type DepositVaultRequest, EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT, EVM_WEI_PER_RAO, type Eip1193TransactionRequest, type EstimateRoundedStakeRequest, type EthersCompatibleTransactionRequest, type EvmToSubtensorRequest, FOREVERMONEY_DEPLOYMENT_VERSION, type ForeverMoneyClient, type ForeverMoneyClientOptions, type ForeverMoneyDeployment, ForeverMoneyError, type ForeverMoneyErrorCode, type ForeverMoneyEvmChain, GAS_LIMIT_BUFFER_BPS, type HttpTransportOptions, type LegacyRpcProvider, MAX_PARTNER_FEE_BPS, MAX_STAKE_PULLS, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, MIN_LIQUID_SUBTENSOR_TO_EVM_WEI, NETWORK_FEE_BUFFER_BPS, type PartnerFee, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RoundedStakeEstimate, type RpcRequest, type RpcTransport, SN80_NETUID, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, type StakePosition, type StakePull, type StakeRoundingOptions, type StakeRoundingResult, type SubtensorDelivery, type SubtensorSource, type SubtensorToBaseRequest, type SubtensorToEvmRequest, type TrackingProvider, type TransactionAction, type TransactionPlan, type TransactionReceiptLike, type TransactionStep, type TransactionStepKind, type VaultStashToken, type VaultTokenAllowance, type ViemTransactionRequest, type WithdrawVaultRequest, assertWholeRao, bridgeMessageIdFromReceipt, buildBaseToSubtensorPlan, buildClaimVaultFeesPlan, buildCreateVaultPlan, buildDepositVaultPlan, buildEvmToSubtensorPlan, buildSetVaultStakingPlan, buildSubtensorToBasePlan, buildSubtensorToEvmPlan, buildWithdrawVaultPlan, createForeverMoneyClient, destinationChainId, estimateRoundedStake, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, partnerFeeCut, partnerFeeTaoTopUp, sourceChainId, ss58ToPublicKey, stakedMinimumOutput, strandedStakeSource, toEip1193Transaction, toEthersTransaction, toViemTransaction, vaultManagerFromCreationReceipt };
package/dist/index.d.ts CHANGED
@@ -91,6 +91,7 @@ interface TransactionPlan {
91
91
  declare const MIN_LIQUID_EVM_TO_SUBTENSOR_WEI = 10000000000000000n;
92
92
  declare const MIN_LIQUID_BASE_TO_SUBTENSOR_WEI = 10000000000000000n;
93
93
  declare const MIN_LIQUID_SUBTENSOR_TO_EVM_WEI: bigint;
94
+ declare const EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT = 3500000n;
94
95
  type SubtensorDelivery = 'liquid' | 'staked';
95
96
  type SubtensorSource = 'liquid' | 'staked';
96
97
  type BridgeAsset = 'tao' | 'sn80';
@@ -121,6 +122,12 @@ interface EvmToSubtensorRequest {
121
122
  readonly evmChain: ForeverMoneyEvmChain;
122
123
  readonly asset?: BridgeAsset;
123
124
  readonly partnerFee?: PartnerFee;
125
+ /**
126
+ * CCIP gas made available to the Subtensor receiver. Defaults to
127
+ * `EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT`; set per transaction when the
128
+ * destination execution path needs a different budget.
129
+ */
130
+ readonly destinationGasLimit?: bigint;
124
131
  readonly sender: string;
125
132
  readonly amountWei: bigint;
126
133
  readonly destination: string;
@@ -252,12 +259,12 @@ declare function feeWithBuffer(fee: bigint): bigint;
252
259
  declare function gasLimitWithBuffer(gasLimit: bigint): bigint;
253
260
 
254
261
  declare const foreverMoneyAbis: Readonly<{
255
- alphaGateway: readonly ["function ROUTER() view returns (address)", "function allowedLane(uint64 selector) view returns (bool)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function integratorTaoTopUp(uint256 taoAmount,uint16 bps) pure returns (uint256)", "function quoteBridgeOut(uint64 destSelector,address token,address recipient,uint256 mintedAmount) view returns (uint256 fee)", "function bridgeOut(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut) payable returns (bytes32 messageId)", "function integratorCut(uint256 amount,uint16 bps) pure returns (uint256)", "function quoteBridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 mintedAmount,uint256 taoAmount,uint256 stakedAlphaRao,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 nativeTopUp,uint256 alphaTopUp,uint256 amountCrossing)", "function bridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function bridgeOutFromValidators(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut) payable returns (bytes32 messageId)", "function bridgeOutFromValidatorsWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function minStakeRequired() view returns (uint256)", "function MAX_STAKE_SOURCES() view returns (uint256)", "function GATEWAY_COLDKEY() view returns (bytes32)", "function claimLiquid(address token,uint256 minTaoOut,address to)", "function claimNative(address to)", "function claimStaked(address token,bytes32 destColdkey,address to)", "function claimToken(address token,address to)", "function claimableNative(address account) view returns (uint256)", "function claimableToken(address token,address account) view returns (uint256)", "event BridgedOut(uint64 destChainSelector,address indexed token,address indexed sender,address indexed recipient,uint256 minted,bytes32 messageId)", "event Claimable(address indexed token,address indexed user,uint256 native,uint256 wsn)", "event NotDelivered(uint64 indexed sourceChainSelector,address indexed token,uint256 amount,uint8 reason)", "event DeliveredLiquid(address indexed token,bytes32 indexed ss58,uint256 taoOut)", "event DeliveredStaked(address indexed token,bytes32 indexed ss58,uint256 alphaRao)"];
262
+ alphaGateway: readonly ["function ROUTER() view returns (address)", "function allowedLane(uint64 selector) view returns (bool)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function integratorTaoTopUp(uint256 taoAmount,uint16 bps) pure returns (uint256)", "function quoteBridgeOut(uint64 destSelector,address token,address recipient,uint256 mintedAmount) view returns (uint256 fee)", "function bridgeOut(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut) payable returns (bytes32 messageId)", "function integratorCut(uint256 amount,uint16 bps) pure returns (uint256)", "function quoteBridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 mintedAmount,uint256 taoAmount,uint256 stakedAlphaRao,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 nativeTopUp,uint256 alphaTopUp,uint256 amountCrossing)", "function bridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function bridgeOutFromValidators(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut) payable returns (bytes32 messageId)", "function bridgeOutFromValidatorsWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function MAX_STAKE_SOURCES() view returns (uint256)", "function GATEWAY_COLDKEY() view returns (bytes32)", "function claimLiquid(address token,uint256 minTaoOut,address to)", "function claimNative(address to)", "function claimStaked(address token,bytes32 destColdkey,address to)", "function claimToken(address token,address to)", "function claimableNative(address account) view returns (uint256)", "function claimableToken(address token,address account) view returns (uint256)", "event BridgedOut(uint64 destChainSelector,address indexed token,address indexed sender,address indexed recipient,uint256 minted,bytes32 messageId)", "event Claimable(address indexed token,address indexed user,uint256 native,uint256 wsn)", "event NotDelivered(uint64 indexed sourceChainSelector,address indexed token,uint256 amount,uint8 reason)", "event DeliveredLiquid(address indexed token,bytes32 indexed ss58,uint256 taoOut)", "event DeliveredStaked(address indexed token,bytes32 indexed ss58,uint256 alphaRao)"];
256
263
  alphaVault: readonly ["function isPaused() view returns (bool)", "function pausedUntil() view returns (uint256)", "function isListed(address token) view returns (bool)", "function backing(address token) view returns (uint256 stakedAlpha)", "function positionOf(address token) view returns (bytes32 validator,uint256 netuid)"];
257
264
  ccipExecution: readonly ["event ExecutionStateChanged(uint64 indexed sourceChainSelector,uint64 indexed sequenceNumber,bytes32 indexed messageId,bytes32 messageHash,uint8 state,bytes returnData,uint256 gasUsed)"];
258
265
  ccipRouter: readonly ["function isOffRamp(uint64 sourceChainSelector,address offRamp) view returns (bool)"];
259
266
  erc20: readonly ["function allowance(address owner,address spender) view returns (uint256)", "function approve(address spender,uint256 amount) returns (bool)", "function balanceOf(address account) view returns (uint256)"];
260
- spokeGateway: readonly ["function ROUTER() view returns (address)", "function BITTENSOR_SELECTOR() view returns (uint64)", "function SUBTENSOR_GATEWAY() view returns (address)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function quoteBridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit) view returns (uint256 fee)", "function bridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit) payable returns (bytes32 messageId)", "function quoteBridgeToFinneyWithFee(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 cut,uint256 amountCrossing)", "function bridgeToFinneyWithFee(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "event BridgedToFinney(address indexed token,address indexed sender,bytes32 indexed ss58,uint256 amount,bytes32 messageId)"];
267
+ spokeGateway: readonly ["function ROUTER() view returns (address)", "function BITTENSOR_SELECTOR() view returns (uint64)", "function SUBTENSOR_GATEWAY() view returns (address)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function quoteBridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit) view returns (uint256 fee)", "function quoteBridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit) view returns (uint256 fee)", "function bridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit) payable returns (bytes32 messageId)", "function bridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit) payable returns (bytes32 messageId)", "function quoteBridgeToFinneyWithFee(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 cut,uint256 amountCrossing)", "function bridgeToFinneyWithFee(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "event BridgedToFinney(address indexed token,address indexed sender,bytes32 indexed ss58,uint256 amount,bytes32 messageId)"];
261
268
  staking: readonly ["function allowance(address sourceAddress,address spenderAddress,uint256 netuid) view returns (uint256)", "function approve(address spenderAddress,uint256 netuid,uint256 absoluteAmount)", "function getStake(bytes32 hotkey,bytes32 coldkey,uint256 netuid) view returns (uint256)"];
262
269
  vaultFactory: readonly ["function create(address owner,bytes32 associatedMiner,address akAddress,address poolManager,address poolAddress,address positionManagerImpl,(address token,uint256 amount)[] stashTokens) payable returns (address manager)", "event SnLiquidityManagerCreated(address indexed manager,address indexed owner,bytes32 associatedMiner,address akAddress,address poolAddress,address poolManager,address positionManager)"];
263
270
  vaultManager: readonly ["function claimFees(address akAddress)", "function topUpAk(address akAddress,address token,uint256 amount) payable", "function withdrawFromAkAndPositions(address akAddress,uint256 amount0,uint256 amount1,uint256[] decreaseTokenIds,bool unwrapETH)", "function stake(address akAddress,bytes data)", "function unstake(address akAddress,bytes data)", "function owner() view returns (address)", "event AKStashTopUp(address akAddress,address token,uint256 amount)", "event AKStashWithdraw(address akAddress,address token,uint256 amount)"];
@@ -441,4 +448,4 @@ interface ViemTransactionRequest {
441
448
  }
442
449
  declare function toViemTransaction(transaction: PreparedTransaction): Readonly<ViemTransactionRequest>;
443
450
 
444
- export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, type BridgeAsset, type BridgeDirection, type BridgePreparation, type BridgeSourceStatus, type BridgeSourceStatusRequest, type BridgeSourceTransactionStatus, type BuildBaseToSubtensorPlanRequest, type BuildEvmToSubtensorPlanRequest, type BuildSubtensorToBasePlanRequest, type BuildSubtensorToEvmPlanRequest, type CcipDeliveryCheckpoint, type CcipDeliveryStatus, type CcipDeliveryStatusRequest, type CreateVaultRequest, type DepositVaultRequest, EVM_WEI_PER_RAO, type Eip1193TransactionRequest, type EstimateRoundedStakeRequest, type EthersCompatibleTransactionRequest, type EvmToSubtensorRequest, FOREVERMONEY_DEPLOYMENT_VERSION, type ForeverMoneyClient, type ForeverMoneyClientOptions, type ForeverMoneyDeployment, ForeverMoneyError, type ForeverMoneyErrorCode, type ForeverMoneyEvmChain, GAS_LIMIT_BUFFER_BPS, type HttpTransportOptions, type LegacyRpcProvider, MAX_PARTNER_FEE_BPS, MAX_STAKE_PULLS, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, MIN_LIQUID_SUBTENSOR_TO_EVM_WEI, NETWORK_FEE_BUFFER_BPS, type PartnerFee, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RoundedStakeEstimate, type RpcRequest, type RpcTransport, SN80_NETUID, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, type StakePosition, type StakePull, type StakeRoundingOptions, type StakeRoundingResult, type SubtensorDelivery, type SubtensorSource, type SubtensorToBaseRequest, type SubtensorToEvmRequest, type TrackingProvider, type TransactionAction, type TransactionPlan, type TransactionReceiptLike, type TransactionStep, type TransactionStepKind, type VaultStashToken, type VaultTokenAllowance, type ViemTransactionRequest, type WithdrawVaultRequest, assertWholeRao, bridgeMessageIdFromReceipt, buildBaseToSubtensorPlan, buildClaimVaultFeesPlan, buildCreateVaultPlan, buildDepositVaultPlan, buildEvmToSubtensorPlan, buildSetVaultStakingPlan, buildSubtensorToBasePlan, buildSubtensorToEvmPlan, buildWithdrawVaultPlan, createForeverMoneyClient, destinationChainId, estimateRoundedStake, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, partnerFeeCut, partnerFeeTaoTopUp, sourceChainId, ss58ToPublicKey, stakedMinimumOutput, strandedStakeSource, toEip1193Transaction, toEthersTransaction, toViemTransaction, vaultManagerFromCreationReceipt };
451
+ export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, type BridgeAsset, type BridgeDirection, type BridgePreparation, type BridgeSourceStatus, type BridgeSourceStatusRequest, type BridgeSourceTransactionStatus, type BuildBaseToSubtensorPlanRequest, type BuildEvmToSubtensorPlanRequest, type BuildSubtensorToBasePlanRequest, type BuildSubtensorToEvmPlanRequest, type CcipDeliveryCheckpoint, type CcipDeliveryStatus, type CcipDeliveryStatusRequest, type CreateVaultRequest, type DepositVaultRequest, EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT, EVM_WEI_PER_RAO, type Eip1193TransactionRequest, type EstimateRoundedStakeRequest, type EthersCompatibleTransactionRequest, type EvmToSubtensorRequest, FOREVERMONEY_DEPLOYMENT_VERSION, type ForeverMoneyClient, type ForeverMoneyClientOptions, type ForeverMoneyDeployment, ForeverMoneyError, type ForeverMoneyErrorCode, type ForeverMoneyEvmChain, GAS_LIMIT_BUFFER_BPS, type HttpTransportOptions, type LegacyRpcProvider, MAX_PARTNER_FEE_BPS, MAX_STAKE_PULLS, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, MIN_LIQUID_SUBTENSOR_TO_EVM_WEI, NETWORK_FEE_BUFFER_BPS, type PartnerFee, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RoundedStakeEstimate, type RpcRequest, type RpcTransport, SN80_NETUID, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, type StakePosition, type StakePull, type StakeRoundingOptions, type StakeRoundingResult, type SubtensorDelivery, type SubtensorSource, type SubtensorToBaseRequest, type SubtensorToEvmRequest, type TrackingProvider, type TransactionAction, type TransactionPlan, type TransactionReceiptLike, type TransactionStep, type TransactionStepKind, type VaultStashToken, type VaultTokenAllowance, type ViemTransactionRequest, type WithdrawVaultRequest, assertWholeRao, bridgeMessageIdFromReceipt, buildBaseToSubtensorPlan, buildClaimVaultFeesPlan, buildCreateVaultPlan, buildDepositVaultPlan, buildEvmToSubtensorPlan, buildSetVaultStakingPlan, buildSubtensorToBasePlan, buildSubtensorToEvmPlan, buildWithdrawVaultPlan, createForeverMoneyClient, destinationChainId, estimateRoundedStake, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, partnerFeeCut, partnerFeeTaoTopUp, sourceChainId, ss58ToPublicKey, stakedMinimumOutput, strandedStakeSource, toEip1193Transaction, toEthersTransaction, toViemTransaction, vaultManagerFromCreationReceipt };
package/dist/index.js CHANGED
@@ -572,7 +572,9 @@ var SPOKE_GATEWAY_ABI = Object.freeze([
572
572
  "function maxIntegratorFeeBps() view returns (uint16)",
573
573
  "function bridgeFeeBps() view returns (uint16)",
574
574
  "function quoteBridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit) view returns (uint256 fee)",
575
+ "function quoteBridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit) view returns (uint256 fee)",
575
576
  "function bridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit) payable returns (bytes32 messageId)",
577
+ "function bridgeToFinney(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit) payable returns (bytes32 messageId)",
576
578
  "function quoteBridgeToFinneyWithFee(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 cut,uint256 amountCrossing)",
577
579
  "function bridgeToFinneyWithFee(address token,uint256 amount,(bytes32 ss58,address evmFallback,bool wantLiquid,uint256 minTaoOut) exit,uint256 gasLimit,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)",
578
580
  "event BridgedToFinney(address indexed token,address indexed sender,bytes32 indexed ss58,uint256 amount,bytes32 messageId)"
@@ -590,7 +592,6 @@ var ALPHA_GATEWAY_ABI = Object.freeze([
590
592
  "function bridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)",
591
593
  "function bridgeOutFromValidators(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut) payable returns (bytes32 messageId)",
592
594
  "function bridgeOutFromValidatorsWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)",
593
- "function minStakeRequired() view returns (uint256)",
594
595
  "function MAX_STAKE_SOURCES() view returns (uint256)",
595
596
  "function GATEWAY_COLDKEY() view returns (bytes32)",
596
597
  "function claimLiquid(address token,uint256 minTaoOut,address to)",
@@ -677,6 +678,18 @@ var stakingAbi = parseAbi(STAKING_ABI);
677
678
  var MIN_LIQUID_EVM_TO_SUBTENSOR_WEI = 10000000000000000n;
678
679
  var MIN_LIQUID_BASE_TO_SUBTENSOR_WEI = MIN_LIQUID_EVM_TO_SUBTENSOR_WEI;
679
680
  var MIN_LIQUID_SUBTENSOR_TO_EVM_WEI = 2000000n * EVM_WEI_PER_RAO;
681
+ var EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT = 3500000n;
682
+ function resolveDestinationGasLimit(value) {
683
+ const gasLimit = value ?? EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT;
684
+ if (typeof gasLimit !== "bigint" || gasLimit <= 0n) {
685
+ throw new ForeverMoneyError(
686
+ "INVALID_TRANSACTION_PLAN",
687
+ "Destination gas limit must be a positive bigint.",
688
+ { destinationGasLimit: String(gasLimit) }
689
+ );
690
+ }
691
+ return gasLimit;
692
+ }
680
693
  var MAX_PARTNER_FEE_BPS = 1e4;
681
694
  var MAX_STAKE_PULLS = 16;
682
695
  var NO_PARTNER_FEE = {
@@ -853,15 +866,15 @@ function partnerFeeSummary(charged, unit, fee) {
853
866
  if (fee.bps === 0) return "";
854
867
  return ` Partner fee: ${charged} wei of ${unit} (${fee.bps} bps) on top, paid to ${fee.recipient}.`;
855
868
  }
856
- function encodeSpokeBridge(token, amountWei, exit, fee) {
869
+ function encodeSpokeBridge(token, amountWei, exit, destinationGasLimit, fee) {
857
870
  return fee.bps === 0 ? encodeFunctionData({
858
871
  abi: spokeAbi,
859
872
  functionName: "bridgeToFinney",
860
- args: [token, amountWei, exit]
873
+ args: [token, amountWei, exit, destinationGasLimit]
861
874
  }) : encodeFunctionData({
862
875
  abi: spokeAbi,
863
876
  functionName: "bridgeToFinneyWithFee",
864
- args: [token, amountWei, exit, 0n, fee]
877
+ args: [token, amountWei, exit, destinationGasLimit, fee]
865
878
  });
866
879
  }
867
880
  function resolveStakePulls(pulls, amountRao) {
@@ -948,7 +961,7 @@ function encodeHubBridge(destSelector, token, recipient, taoAmount, stakedAlphaR
948
961
  args: [...args, fee]
949
962
  });
950
963
  }
951
- async function quoteSpokeWithFee(provider, gateway, token, amountWei, exit, fee) {
964
+ async function quoteSpokeWithFee(provider, gateway, token, amountWei, exit, destinationGasLimit, fee) {
952
965
  const maxBps = await provider.readContract({
953
966
  address: gateway,
954
967
  abi: spokeAbi,
@@ -959,7 +972,7 @@ async function quoteSpokeWithFee(provider, gateway, token, amountWei, exit, fee)
959
972
  address: gateway,
960
973
  abi: spokeAbi,
961
974
  functionName: "quoteBridgeToFinneyWithFee",
962
- args: [token, amountWei, exit, 0n, fee]
975
+ args: [token, amountWei, exit, destinationGasLimit, fee]
963
976
  });
964
977
  return networkFee;
965
978
  }
@@ -1005,6 +1018,9 @@ function buildEvmToSubtensorPlan(input) {
1005
1018
  assertBaseToSubtensorAmount(input.amountWei, input.delivery);
1006
1019
  assertNonNegativeAmount(input.allowanceWei, "Token allowance");
1007
1020
  assertNonNegativeAmount(input.exactNetworkFeeWei, "Network fee");
1021
+ const destinationGasLimit = resolveDestinationGasLimit(
1022
+ input.destinationGasLimit
1023
+ );
1008
1024
  const destination = normalizeSS58(input.destination);
1009
1025
  const exit = {
1010
1026
  ss58: ss58ToPublicKey(destination),
@@ -1048,6 +1064,7 @@ function buildEvmToSubtensorPlan(input) {
1048
1064
  asset.evmToken,
1049
1065
  input.amountWei,
1050
1066
  exit,
1067
+ destinationGasLimit,
1051
1068
  partnerFee
1052
1069
  ),
1053
1070
  value,
@@ -1163,6 +1180,9 @@ async function prepareEvmToSubtensor(provider, input) {
1163
1180
  assertDelivery(input.delivery);
1164
1181
  assertAssetMode(input.asset, input.delivery);
1165
1182
  assertBaseToSubtensorAmount(input.amountWei, input.delivery);
1183
+ const destinationGasLimit = resolveDestinationGasLimit(
1184
+ input.destinationGasLimit
1185
+ );
1166
1186
  const destination = normalizeSS58(input.destination);
1167
1187
  const evm = getForeverMoneyEvmDeployment(input.evmChain);
1168
1188
  const exit = {
@@ -1187,13 +1207,19 @@ async function prepareEvmToSubtensor(provider, input) {
1187
1207
  address: evm.contracts.gateway,
1188
1208
  abi: spokeAbi,
1189
1209
  functionName: "quoteBridgeToFinney",
1190
- args: [asset.evmToken, input.amountWei, exit]
1210
+ args: [
1211
+ asset.evmToken,
1212
+ input.amountWei,
1213
+ exit,
1214
+ destinationGasLimit
1215
+ ]
1191
1216
  }) : quoteSpokeWithFee(
1192
1217
  provider,
1193
1218
  evm.contracts.gateway,
1194
1219
  asset.evmToken,
1195
1220
  input.amountWei,
1196
1221
  exit,
1222
+ destinationGasLimit,
1197
1223
  partnerFee
1198
1224
  )
1199
1225
  ]);
@@ -1203,6 +1229,7 @@ async function prepareEvmToSubtensor(provider, input) {
1203
1229
  asset.evmToken,
1204
1230
  input.amountWei,
1205
1231
  exit,
1232
+ destinationGasLimit,
1206
1233
  partnerFee
1207
1234
  );
1208
1235
  estimatedBridgeGas = await provider.estimateGas({
@@ -2418,6 +2445,7 @@ export {
2418
2445
  BASE_CCIP_SELECTOR,
2419
2446
  BASE_CHAIN_ID,
2420
2447
  BASIS_POINTS,
2448
+ EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT,
2421
2449
  EVM_WEI_PER_RAO,
2422
2450
  FOREVERMONEY_DEPLOYMENT_VERSION,
2423
2451
  ForeverMoneyError,