@forevermoney/sdk 0.5.4 → 0.5.6

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
@@ -8,10 +8,11 @@ declare const ROBINHOOD_CCIP_SELECTOR = 6180753054346818345n;
8
8
  declare const SUBTENSOR_CCIP_SELECTOR = 2135107236357186872n;
9
9
  declare const RAO_PER_TAO = 1000000000n;
10
10
  declare const EVM_WEI_PER_RAO = 1000000000n;
11
+ declare const SN10_NETUID = 10n;
11
12
  declare const SN80_NETUID = 80n;
12
- declare const FOREVERMONEY_DEPLOYMENT_VERSION: "1.4.0";
13
+ declare const FOREVERMONEY_DEPLOYMENT_VERSION: "1.5.0";
13
14
  declare const foreverMoneyDeployment: Readonly<{
14
- version: "1.4.0";
15
+ version: "1.5.0";
15
16
  base: Readonly<{
16
17
  key: "base";
17
18
  name: "Base";
@@ -21,6 +22,7 @@ declare const foreverMoneyDeployment: Readonly<{
21
22
  gateway: `0x${string}`;
22
23
  legacyGateways: readonly `0x${string}`[];
23
24
  wrappedTao: `0x${string}`;
25
+ wrappedSn10: `0x${string}`;
24
26
  wrappedSn80: `0x${string}`;
25
27
  ccipRouter: `0x${string}`;
26
28
  ccipOffRampFromSubtensor: `0x${string}`;
@@ -40,6 +42,7 @@ declare const foreverMoneyDeployment: Readonly<{
40
42
  gateway: `0x${string}`;
41
43
  legacyGateways: readonly `0x${string}`[];
42
44
  wrappedTao: `0x${string}`;
45
+ wrappedSn10: `0x${string}`;
43
46
  wrappedSn80: `0x${string}`;
44
47
  ccipRouter: `0x${string}`;
45
48
  ccipOffRampFromSubtensor: `0x${string}`;
@@ -53,6 +56,7 @@ declare const foreverMoneyDeployment: Readonly<{
53
56
  legacyGateways: readonly `0x${string}`[];
54
57
  alphaVault: `0x${string}`;
55
58
  wrappedTao: `0x${string}`;
59
+ wrappedSn10: `0x${string}`;
56
60
  wrappedSn80: `0x${string}`;
57
61
  ccipRouter: `0x${string}`;
58
62
  ccipOffRampFromBase: `0x${string}`;
@@ -95,7 +99,7 @@ declare const MIN_LIQUID_SUBTENSOR_TO_EVM_WEI: bigint;
95
99
  declare const EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT = 3500000n;
96
100
  type SubtensorDelivery = 'liquid' | 'staked';
97
101
  type SubtensorSource = 'liquid' | 'staked';
98
- type BridgeAsset = 'tao' | 'sn80';
102
+ type BridgeAsset = 'tao' | 'sn80' | 'sn10';
99
103
  /**
100
104
  * Optional partner (integrator) fee, charged ON TOP of the bridged amount and
101
105
  * paid to `recipient` on the source chain. The full `amountWei` still crosses.
@@ -263,7 +267,7 @@ declare const foreverMoneyAbis: Readonly<{
263
267
  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)"];
264
268
  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)"];
265
269
  ccipExecution: readonly ["event ExecutionStateChanged(uint64 indexed sourceChainSelector,uint64 indexed sequenceNumber,bytes32 indexed messageId,bytes32 messageHash,uint8 state,bytes returnData,uint256 gasUsed)"];
266
- ccipRouter: readonly ["function isOffRamp(uint64 sourceChainSelector,address offRamp) view returns (bool)"];
270
+ ccipRouter: readonly ["function isOffRamp(uint64 sourceChainSelector,address offRamp) view returns (bool)", "function getOffRamps() view returns ((uint64 sourceChainSelector,address offRamp)[])"];
267
271
  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)"];
268
272
  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)"];
269
273
  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)"];
@@ -449,4 +453,4 @@ interface ViemTransactionRequest {
449
453
  }
450
454
  declare function toViemTransaction(transaction: PreparedTransaction): Readonly<ViemTransactionRequest>;
451
455
 
452
- 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 };
456
+ 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, SN10_NETUID, 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
@@ -8,10 +8,11 @@ declare const ROBINHOOD_CCIP_SELECTOR = 6180753054346818345n;
8
8
  declare const SUBTENSOR_CCIP_SELECTOR = 2135107236357186872n;
9
9
  declare const RAO_PER_TAO = 1000000000n;
10
10
  declare const EVM_WEI_PER_RAO = 1000000000n;
11
+ declare const SN10_NETUID = 10n;
11
12
  declare const SN80_NETUID = 80n;
12
- declare const FOREVERMONEY_DEPLOYMENT_VERSION: "1.4.0";
13
+ declare const FOREVERMONEY_DEPLOYMENT_VERSION: "1.5.0";
13
14
  declare const foreverMoneyDeployment: Readonly<{
14
- version: "1.4.0";
15
+ version: "1.5.0";
15
16
  base: Readonly<{
16
17
  key: "base";
17
18
  name: "Base";
@@ -21,6 +22,7 @@ declare const foreverMoneyDeployment: Readonly<{
21
22
  gateway: `0x${string}`;
22
23
  legacyGateways: readonly `0x${string}`[];
23
24
  wrappedTao: `0x${string}`;
25
+ wrappedSn10: `0x${string}`;
24
26
  wrappedSn80: `0x${string}`;
25
27
  ccipRouter: `0x${string}`;
26
28
  ccipOffRampFromSubtensor: `0x${string}`;
@@ -40,6 +42,7 @@ declare const foreverMoneyDeployment: Readonly<{
40
42
  gateway: `0x${string}`;
41
43
  legacyGateways: readonly `0x${string}`[];
42
44
  wrappedTao: `0x${string}`;
45
+ wrappedSn10: `0x${string}`;
43
46
  wrappedSn80: `0x${string}`;
44
47
  ccipRouter: `0x${string}`;
45
48
  ccipOffRampFromSubtensor: `0x${string}`;
@@ -53,6 +56,7 @@ declare const foreverMoneyDeployment: Readonly<{
53
56
  legacyGateways: readonly `0x${string}`[];
54
57
  alphaVault: `0x${string}`;
55
58
  wrappedTao: `0x${string}`;
59
+ wrappedSn10: `0x${string}`;
56
60
  wrappedSn80: `0x${string}`;
57
61
  ccipRouter: `0x${string}`;
58
62
  ccipOffRampFromBase: `0x${string}`;
@@ -95,7 +99,7 @@ declare const MIN_LIQUID_SUBTENSOR_TO_EVM_WEI: bigint;
95
99
  declare const EVM_TO_SUBTENSOR_DESTINATION_GAS_LIMIT = 3500000n;
96
100
  type SubtensorDelivery = 'liquid' | 'staked';
97
101
  type SubtensorSource = 'liquid' | 'staked';
98
- type BridgeAsset = 'tao' | 'sn80';
102
+ type BridgeAsset = 'tao' | 'sn80' | 'sn10';
99
103
  /**
100
104
  * Optional partner (integrator) fee, charged ON TOP of the bridged amount and
101
105
  * paid to `recipient` on the source chain. The full `amountWei` still crosses.
@@ -263,7 +267,7 @@ declare const foreverMoneyAbis: Readonly<{
263
267
  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)"];
264
268
  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)"];
265
269
  ccipExecution: readonly ["event ExecutionStateChanged(uint64 indexed sourceChainSelector,uint64 indexed sequenceNumber,bytes32 indexed messageId,bytes32 messageHash,uint8 state,bytes returnData,uint256 gasUsed)"];
266
- ccipRouter: readonly ["function isOffRamp(uint64 sourceChainSelector,address offRamp) view returns (bool)"];
270
+ ccipRouter: readonly ["function isOffRamp(uint64 sourceChainSelector,address offRamp) view returns (bool)", "function getOffRamps() view returns ((uint64 sourceChainSelector,address offRamp)[])"];
267
271
  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)"];
268
272
  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)"];
269
273
  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)"];
@@ -449,4 +453,4 @@ interface ViemTransactionRequest {
449
453
  }
450
454
  declare function toViemTransaction(transaction: PreparedTransaction): Readonly<ViemTransactionRequest>;
451
455
 
452
- 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 };
456
+ 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, SN10_NETUID, 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
@@ -8,8 +8,9 @@ var ROBINHOOD_CCIP_SELECTOR = 6180753054346818345n;
8
8
  var SUBTENSOR_CCIP_SELECTOR = 2135107236357186872n;
9
9
  var RAO_PER_TAO = 1000000000n;
10
10
  var EVM_WEI_PER_RAO = 1000000000n;
11
+ var SN10_NETUID = 10n;
11
12
  var SN80_NETUID = 80n;
12
- var FOREVERMONEY_DEPLOYMENT_VERSION = "1.4.0";
13
+ var FOREVERMONEY_DEPLOYMENT_VERSION = "1.5.0";
13
14
  var foreverMoneyDeployment = Object.freeze({
14
15
  version: FOREVERMONEY_DEPLOYMENT_VERSION,
15
16
  base: Object.freeze({
@@ -27,6 +28,9 @@ var foreverMoneyDeployment = Object.freeze({
27
28
  wrappedTao: getAddress(
28
29
  "0xf3081494b87e8d5fb7960f066e931d1d0e6e3d67"
29
30
  ),
31
+ wrappedSn10: getAddress(
32
+ "0xDdDE5965D49e69b6362BD8743e139a45dBFEb7b3"
33
+ ),
30
34
  wrappedSn80: getAddress(
31
35
  "0x6f63d869011f95274498023b4abfc00b30c34378"
32
36
  ),
@@ -62,6 +66,9 @@ var foreverMoneyDeployment = Object.freeze({
62
66
  wrappedTao: getAddress(
63
67
  "0xf3081494B87e8D5fb7960f066E931D1D0e6E3d67"
64
68
  ),
69
+ wrappedSn10: getAddress(
70
+ "0xDdDE5965D49e69b6362BD8743e139a45dBFEb7b3"
71
+ ),
65
72
  wrappedSn80: getAddress(
66
73
  "0x6f63d869011f95274498023b4abfc00b30c34378"
67
74
  ),
@@ -91,6 +98,9 @@ var foreverMoneyDeployment = Object.freeze({
91
98
  wrappedTao: getAddress(
92
99
  "0xC5b6C1632d34901239396F5E1BDe54B342900256"
93
100
  ),
101
+ wrappedSn10: getAddress(
102
+ "0xcd0836D1ecE4AEDf5B39f2792e0790BBE79449b3"
103
+ ),
94
104
  wrappedSn80: getAddress(
95
105
  "0xfD628dE75EF96f0A5C59659159C6cA81E0DC2222"
96
106
  ),
@@ -634,7 +644,8 @@ var CCIP_EXECUTION_ABI = Object.freeze([
634
644
  "event ExecutionStateChanged(uint64 indexed sourceChainSelector,uint64 indexed sequenceNumber,bytes32 indexed messageId,bytes32 messageHash,uint8 state,bytes returnData,uint256 gasUsed)"
635
645
  ]);
636
646
  var CCIP_ROUTER_ABI = Object.freeze([
637
- "function isOffRamp(uint64 sourceChainSelector,address offRamp) view returns (bool)"
647
+ "function isOffRamp(uint64 sourceChainSelector,address offRamp) view returns (bool)",
648
+ "function getOffRamps() view returns ((uint64 sourceChainSelector,address offRamp)[])"
638
649
  ]);
639
650
  var foreverMoneyAbis = Object.freeze({
640
651
  alphaGateway: ALPHA_GATEWAY_ABI,
@@ -737,18 +748,19 @@ function assertPartnerFeeAllowed(fee, maxBps) {
737
748
  }
738
749
  }
739
750
  function bridgeAsset(evmChain, asset = "tao") {
740
- if (asset !== "tao" && asset !== "sn80") {
751
+ if (asset !== "tao" && asset !== "sn80" && asset !== "sn10") {
741
752
  throw new ForeverMoneyError(
742
753
  "INVALID_TRANSACTION_PLAN",
743
- 'Asset must be "tao" or "sn80".'
754
+ 'Asset must be "tao", "sn80", or "sn10".'
744
755
  );
745
756
  }
746
757
  const evm = getForeverMoneyEvmDeployment(evmChain);
747
- return asset === "sn80" ? {
748
- evmToken: evm.contracts.wrappedSn80,
749
- subtensorToken: foreverMoneyDeployment.subtensor.contracts.wrappedSn80,
750
- label: "SN80",
751
- wrappedLabel: "SN80"
758
+ const tokenKey = asset === "sn10" ? "wrappedSn10" : "wrappedSn80";
759
+ return asset !== "tao" ? {
760
+ evmToken: evm.contracts[tokenKey],
761
+ subtensorToken: foreverMoneyDeployment.subtensor.contracts[tokenKey],
762
+ label: asset.toUpperCase(),
763
+ wrappedLabel: asset.toUpperCase()
752
764
  } : {
753
765
  evmToken: evm.contracts.wrappedTao,
754
766
  subtensorToken: foreverMoneyDeployment.subtensor.contracts.wrappedTao,
@@ -757,16 +769,17 @@ function bridgeAsset(evmChain, asset = "tao") {
757
769
  };
758
770
  }
759
771
  function assertAssetMode(asset, mode) {
760
- if (asset === "sn80" && mode !== "staked") {
772
+ if ((asset === "sn80" || asset === "sn10") && mode !== "staked") {
761
773
  throw new ForeverMoneyError(
762
774
  "INVALID_TRANSACTION_PLAN",
763
- "SN80 bridging requires staked subnet 80 input or delivery; liquid TAO conversion is not supported."
775
+ `${asset.toUpperCase()} bridging requires staked subnet ${asset === "sn10" ? SN10_NETUID : SN80_NETUID} input or delivery; liquid TAO conversion is not supported.`
764
776
  );
765
777
  }
766
778
  }
767
779
  function sourceNetuid(input) {
768
780
  if (input.source !== "staked") return void 0;
769
- const netuid = input.netuid ?? (input.asset === "sn80" ? SN80_NETUID : void 0);
781
+ const assetNetuid = input.asset === "sn10" ? SN10_NETUID : input.asset === "sn80" ? SN80_NETUID : void 0;
782
+ const netuid = input.netuid ?? assetNetuid;
770
783
  if (netuid === void 0) {
771
784
  throw new ForeverMoneyError(
772
785
  "INVALID_TRANSACTION_PLAN",
@@ -774,10 +787,10 @@ function sourceNetuid(input) {
774
787
  );
775
788
  }
776
789
  assertNonNegativeAmount(netuid, "netuid");
777
- if (input.asset === "sn80" && netuid !== SN80_NETUID) {
790
+ if (assetNetuid !== void 0 && netuid !== assetNetuid) {
778
791
  throw new ForeverMoneyError(
779
792
  "INVALID_TRANSACTION_PLAN",
780
- "SN80 staking approvals must use netuid 80."
793
+ `${input.asset.toUpperCase()} staking approvals must use netuid ${assetNetuid}.`
781
794
  );
782
795
  }
783
796
  return netuid;
@@ -2010,6 +2023,41 @@ function bridgeMessageIdFromReceipt(direction, receipt) {
2010
2023
  // src/bridge/tracking.ts
2011
2024
  var ccipExecutionAbi = parseAbi4(CCIP_EXECUTION_ABI);
2012
2025
  var alphaGatewayAbi2 = parseAbi4(ALPHA_GATEWAY_ABI);
2026
+ var routerAbi = parseAbi4(CCIP_ROUTER_ABI);
2027
+ var executionV2Abi = parseAbi4([
2028
+ "event ExecutionStateChanged(uint64 indexed sourceChainSelector,uint64 indexed sequenceNumber,bytes32 indexed messageId,uint8 state,bytes returnData)"
2029
+ ]);
2030
+ var rampCache = /* @__PURE__ */ new WeakMap();
2031
+ function deliveryOffRamps(provider, client, router, selector, legacy) {
2032
+ let cache = rampCache.get(provider);
2033
+ if (!cache) {
2034
+ cache = /* @__PURE__ */ new Map();
2035
+ rampCache.set(provider, cache);
2036
+ }
2037
+ const key = `${router}:${selector}:${legacy}`;
2038
+ const cached = cache.get(key);
2039
+ if (cached && cached.expires > Date.now()) return cached.request;
2040
+ const request = client.readContract({
2041
+ address: router,
2042
+ abi: routerAbi,
2043
+ functionName: "getOffRamps"
2044
+ }).then((ramps) => {
2045
+ const addresses = /* @__PURE__ */ new Map([
2046
+ [legacy.toLowerCase(), legacy]
2047
+ ]);
2048
+ for (const ramp of ramps) {
2049
+ if (ramp.sourceChainSelector === selector)
2050
+ addresses.set(ramp.offRamp.toLowerCase(), ramp.offRamp);
2051
+ }
2052
+ return [...addresses.values()];
2053
+ });
2054
+ const entry = { expires: Date.now() + 3e5, request };
2055
+ cache.set(key, entry);
2056
+ void request.catch(() => {
2057
+ if (cache.get(key) === entry) cache.delete(key);
2058
+ });
2059
+ return request;
2060
+ }
2013
2061
  function destinationChainId(direction) {
2014
2062
  assertBridgeDirection(direction);
2015
2063
  const evm = getForeverMoneyEvmDeployment(
@@ -2123,13 +2171,29 @@ async function getCcipDeliveryStatus(provider, input) {
2123
2171
  const evmToSubtensor = isEvmToSubtensorDirection(input.direction);
2124
2172
  const sourceSelector = evmToSubtensor ? evm.ccipSelector : foreverMoneyDeployment.subtensor.ccipSelector;
2125
2173
  const offRamp = evmToSubtensor ? evmChain === "base" ? foreverMoneyDeployment.subtensor.contracts.ccipOffRampFromBase : foreverMoneyDeployment.subtensor.contracts.ccipOffRampFromRobinhood : evm.contracts.ccipOffRampFromSubtensor;
2126
- const logs = await client.getLogs({
2127
- address: offRamp,
2128
- fromBlock: BigInt(input.fromBlock),
2129
- toBlock: "latest",
2130
- event: ccipExecutionAbi[0],
2131
- args: { sourceChainSelector: sourceSelector, messageId },
2132
- strict: true
2174
+ const offRamps = await deliveryOffRamps(
2175
+ provider,
2176
+ client,
2177
+ evmToSubtensor ? foreverMoneyDeployment.subtensor.contracts.ccipRouter : evm.contracts.ccipRouter,
2178
+ sourceSelector,
2179
+ offRamp
2180
+ );
2181
+ const batches = await Promise.all(
2182
+ [executionV2Abi[0], ccipExecutionAbi[0]].map(
2183
+ (event) => client.getLogs({
2184
+ address: offRamps.length === 1 ? offRamps[0] : [...offRamps],
2185
+ fromBlock: BigInt(input.fromBlock),
2186
+ toBlock: "latest",
2187
+ event,
2188
+ args: { sourceChainSelector: sourceSelector, messageId },
2189
+ strict: true
2190
+ })
2191
+ )
2192
+ );
2193
+ const logs = batches.flat().sort((a, b) => {
2194
+ const blockA = a.blockNumber ?? 0n;
2195
+ const blockB = b.blockNumber ?? 0n;
2196
+ return blockA === blockB ? (a.logIndex ?? 0) - (b.logIndex ?? 0) : blockA < blockB ? -1 : 1;
2133
2197
  });
2134
2198
  const latest = logs.at(-1);
2135
2199
  if (latest === void 0) return "waiting";
@@ -2456,6 +2520,7 @@ export {
2456
2520
  RAO_PER_TAO,
2457
2521
  ROBINHOOD_CCIP_SELECTOR,
2458
2522
  ROBINHOOD_CHAIN_ID,
2523
+ SN10_NETUID,
2459
2524
  SN80_NETUID,
2460
2525
  SUBTENSOR_CCIP_SELECTOR,
2461
2526
  SUBTENSOR_CHAIN_ID,