@forevermoney/sdk 0.1.0 → 0.2.0

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
@@ -1,10 +1,10 @@
1
- import { AbstractProvider, TransactionRequest } from 'ethers';
1
+ import { Address, Hex, PublicClient, Chain } from 'viem';
2
2
 
3
- declare function normalizeEvmAddress(value: string): string;
3
+ declare function normalizeEvmAddress(value: string): Address;
4
4
  declare function evmToMirrorSS58(evmAddress: string): string;
5
5
  declare function normalizeSS58(value: string): string;
6
6
  declare function isBittensorSS58(value: string): boolean;
7
- declare function ss58ToPublicKey(value: string): string;
7
+ declare function ss58ToPublicKey(value: string): Hex;
8
8
 
9
9
  declare const BASIS_POINTS = 10000n;
10
10
  declare const NETWORK_FEE_BUFFER_BPS = 200n;
@@ -44,14 +44,14 @@ declare const foreverMoneyDeployment: Readonly<{
44
44
  chainId: 8453;
45
45
  ccipSelector: 15971525489660198786n;
46
46
  contracts: Readonly<{
47
- gateway: string;
48
- wrappedTao: string;
49
- ccipRouter: string;
50
- ccipOffRampFromSubtensor: string;
51
- vaultFactory: string;
52
- vaultManagerImplementation: string;
53
- batchLiquidityManagerQuery: string;
54
- weth: string;
47
+ gateway: `0x${string}`;
48
+ wrappedTao: `0x${string}`;
49
+ ccipRouter: `0x${string}`;
50
+ ccipOffRampFromSubtensor: `0x${string}`;
51
+ vaultFactory: `0x${string}`;
52
+ vaultManagerImplementation: `0x${string}`;
53
+ batchLiquidityManagerQuery: `0x${string}`;
54
+ weth: `0x${string}`;
55
55
  }>;
56
56
  deploymentBlock: 50098800;
57
57
  }>;
@@ -61,23 +61,23 @@ declare const foreverMoneyDeployment: Readonly<{
61
61
  chainId: 4663;
62
62
  ccipSelector: 6180753054346818345n;
63
63
  contracts: Readonly<{
64
- gateway: string;
65
- wrappedTao: string;
66
- ccipRouter: string;
67
- ccipOffRampFromSubtensor: string;
64
+ gateway: `0x${string}`;
65
+ wrappedTao: `0x${string}`;
66
+ ccipRouter: `0x${string}`;
67
+ ccipOffRampFromSubtensor: `0x${string}`;
68
68
  }>;
69
69
  }>;
70
70
  subtensor: Readonly<{
71
71
  chainId: 964;
72
72
  ccipSelector: 2135107236357186872n;
73
73
  contracts: Readonly<{
74
- gateway: string;
75
- alphaVault: string;
76
- wrappedTao: string;
77
- ccipRouter: string;
78
- ccipOffRampFromBase: string;
79
- ccipOffRampFromRobinhood: string;
80
- stakingPrecompile: string;
74
+ gateway: `0x${string}`;
75
+ alphaVault: `0x${string}`;
76
+ wrappedTao: `0x${string}`;
77
+ ccipRouter: `0x${string}`;
78
+ ccipOffRampFromBase: `0x${string}`;
79
+ ccipOffRampFromRobinhood: `0x${string}`;
80
+ stakingPrecompile: `0x${string}`;
81
81
  }>;
82
82
  }>;
83
83
  }>;
@@ -164,6 +164,11 @@ interface HttpTransportOptions {
164
164
  readonly fetch?: typeof globalThis.fetch;
165
165
  }
166
166
  declare function http(url: string, options?: HttpTransportOptions): RpcTransport;
167
+ /** Minimal structural interface implemented by ethers JSON-RPC providers. */
168
+ interface LegacyRpcProvider {
169
+ send(method: string, params: unknown[]): Promise<unknown>;
170
+ }
171
+ type TrackingProvider = PublicClient | LegacyRpcProvider;
167
172
 
168
173
  interface VaultStashToken {
169
174
  readonly token: string;
@@ -260,9 +265,9 @@ type BridgeSourceStatus = (BridgeSourceStatusBase & {
260
265
  });
261
266
  declare function destinationChainId(direction: BridgeDirection): number;
262
267
  declare function sourceChainId(direction: BridgeDirection): number;
263
- declare function getBridgeSourceStatus(provider: AbstractProvider, input: BridgeSourceStatusRequest): Promise<BridgeSourceStatus>;
264
- declare function getCcipDeliveryCheckpoint(provider: AbstractProvider, direction: BridgeDirection): Promise<CcipDeliveryCheckpoint>;
265
- declare function getCcipDeliveryStatus(provider: AbstractProvider, input: CcipDeliveryStatusRequest): Promise<CcipDeliveryStatus>;
268
+ declare function getBridgeSourceStatus(provider: TrackingProvider, input: BridgeSourceStatusRequest): Promise<BridgeSourceStatus>;
269
+ declare function getCcipDeliveryCheckpoint(provider: TrackingProvider, direction: BridgeDirection): Promise<CcipDeliveryCheckpoint>;
270
+ declare function getCcipDeliveryStatus(provider: TrackingProvider, input: CcipDeliveryStatusRequest): Promise<CcipDeliveryStatus>;
266
271
 
267
272
  interface ForeverMoneyClientOptions {
268
273
  readonly transports: {
@@ -306,6 +311,23 @@ interface Eip1193TransactionRequest {
306
311
  readonly gas?: string;
307
312
  }
308
313
  declare function toEip1193Transaction(transaction: PreparedTransaction): Eip1193TransactionRequest;
309
- declare function toEthersTransaction(transaction: PreparedTransaction): Readonly<TransactionRequest>;
314
+ declare function toEthersTransaction(transaction: PreparedTransaction): Readonly<EthersCompatibleTransactionRequest>;
315
+ interface EthersCompatibleTransactionRequest {
316
+ readonly chainId: number;
317
+ readonly to: string;
318
+ readonly data: string;
319
+ readonly value: bigint;
320
+ readonly gasLimit?: bigint;
321
+ }
322
+ interface ViemTransactionRequest {
323
+ readonly chain: Chain;
324
+ readonly account: Address;
325
+ readonly chainId: number;
326
+ readonly to: Address;
327
+ readonly data: Hex;
328
+ readonly value: bigint;
329
+ readonly gas?: bigint;
330
+ }
331
+ declare function toViemTransaction(transaction: PreparedTransaction): Readonly<ViemTransactionRequest>;
310
332
 
311
- export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, 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 EvmToSubtensorRequest, FOREVERMONEY_DEPLOYMENT_VERSION, type ForeverMoneyClient, type ForeverMoneyClientOptions, type ForeverMoneyDeployment, ForeverMoneyError, type ForeverMoneyErrorCode, type ForeverMoneyEvmChain, GAS_LIMIT_BUFFER_BPS, type HttpTransportOptions, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, NETWORK_FEE_BUFFER_BPS, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RpcRequest, type RpcTransport, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, type SubtensorDelivery, type SubtensorSource, type SubtensorToBaseRequest, type SubtensorToEvmRequest, type TransactionAction, type TransactionPlan, type TransactionReceiptLike, type TransactionStep, type TransactionStepKind, type VaultStashToken, type VaultTokenAllowance, type WithdrawVaultRequest, assertWholeRao, bridgeMessageIdFromReceipt, buildBaseToSubtensorPlan, buildClaimVaultFeesPlan, buildCreateVaultPlan, buildDepositVaultPlan, buildEvmToSubtensorPlan, buildSetVaultStakingPlan, buildSubtensorToBasePlan, buildSubtensorToEvmPlan, buildWithdrawVaultPlan, createForeverMoneyClient, destinationChainId, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, sourceChainId, ss58ToPublicKey, toEip1193Transaction, toEthersTransaction, vaultManagerFromCreationReceipt };
333
+ export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, 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 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, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, NETWORK_FEE_BUFFER_BPS, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RpcRequest, type RpcTransport, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, 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, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, sourceChainId, ss58ToPublicKey, toEip1193Transaction, toEthersTransaction, toViemTransaction, vaultManagerFromCreationReceipt };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { AbstractProvider, TransactionRequest } from 'ethers';
1
+ import { Address, Hex, PublicClient, Chain } from 'viem';
2
2
 
3
- declare function normalizeEvmAddress(value: string): string;
3
+ declare function normalizeEvmAddress(value: string): Address;
4
4
  declare function evmToMirrorSS58(evmAddress: string): string;
5
5
  declare function normalizeSS58(value: string): string;
6
6
  declare function isBittensorSS58(value: string): boolean;
7
- declare function ss58ToPublicKey(value: string): string;
7
+ declare function ss58ToPublicKey(value: string): Hex;
8
8
 
9
9
  declare const BASIS_POINTS = 10000n;
10
10
  declare const NETWORK_FEE_BUFFER_BPS = 200n;
@@ -44,14 +44,14 @@ declare const foreverMoneyDeployment: Readonly<{
44
44
  chainId: 8453;
45
45
  ccipSelector: 15971525489660198786n;
46
46
  contracts: Readonly<{
47
- gateway: string;
48
- wrappedTao: string;
49
- ccipRouter: string;
50
- ccipOffRampFromSubtensor: string;
51
- vaultFactory: string;
52
- vaultManagerImplementation: string;
53
- batchLiquidityManagerQuery: string;
54
- weth: string;
47
+ gateway: `0x${string}`;
48
+ wrappedTao: `0x${string}`;
49
+ ccipRouter: `0x${string}`;
50
+ ccipOffRampFromSubtensor: `0x${string}`;
51
+ vaultFactory: `0x${string}`;
52
+ vaultManagerImplementation: `0x${string}`;
53
+ batchLiquidityManagerQuery: `0x${string}`;
54
+ weth: `0x${string}`;
55
55
  }>;
56
56
  deploymentBlock: 50098800;
57
57
  }>;
@@ -61,23 +61,23 @@ declare const foreverMoneyDeployment: Readonly<{
61
61
  chainId: 4663;
62
62
  ccipSelector: 6180753054346818345n;
63
63
  contracts: Readonly<{
64
- gateway: string;
65
- wrappedTao: string;
66
- ccipRouter: string;
67
- ccipOffRampFromSubtensor: string;
64
+ gateway: `0x${string}`;
65
+ wrappedTao: `0x${string}`;
66
+ ccipRouter: `0x${string}`;
67
+ ccipOffRampFromSubtensor: `0x${string}`;
68
68
  }>;
69
69
  }>;
70
70
  subtensor: Readonly<{
71
71
  chainId: 964;
72
72
  ccipSelector: 2135107236357186872n;
73
73
  contracts: Readonly<{
74
- gateway: string;
75
- alphaVault: string;
76
- wrappedTao: string;
77
- ccipRouter: string;
78
- ccipOffRampFromBase: string;
79
- ccipOffRampFromRobinhood: string;
80
- stakingPrecompile: string;
74
+ gateway: `0x${string}`;
75
+ alphaVault: `0x${string}`;
76
+ wrappedTao: `0x${string}`;
77
+ ccipRouter: `0x${string}`;
78
+ ccipOffRampFromBase: `0x${string}`;
79
+ ccipOffRampFromRobinhood: `0x${string}`;
80
+ stakingPrecompile: `0x${string}`;
81
81
  }>;
82
82
  }>;
83
83
  }>;
@@ -164,6 +164,11 @@ interface HttpTransportOptions {
164
164
  readonly fetch?: typeof globalThis.fetch;
165
165
  }
166
166
  declare function http(url: string, options?: HttpTransportOptions): RpcTransport;
167
+ /** Minimal structural interface implemented by ethers JSON-RPC providers. */
168
+ interface LegacyRpcProvider {
169
+ send(method: string, params: unknown[]): Promise<unknown>;
170
+ }
171
+ type TrackingProvider = PublicClient | LegacyRpcProvider;
167
172
 
168
173
  interface VaultStashToken {
169
174
  readonly token: string;
@@ -260,9 +265,9 @@ type BridgeSourceStatus = (BridgeSourceStatusBase & {
260
265
  });
261
266
  declare function destinationChainId(direction: BridgeDirection): number;
262
267
  declare function sourceChainId(direction: BridgeDirection): number;
263
- declare function getBridgeSourceStatus(provider: AbstractProvider, input: BridgeSourceStatusRequest): Promise<BridgeSourceStatus>;
264
- declare function getCcipDeliveryCheckpoint(provider: AbstractProvider, direction: BridgeDirection): Promise<CcipDeliveryCheckpoint>;
265
- declare function getCcipDeliveryStatus(provider: AbstractProvider, input: CcipDeliveryStatusRequest): Promise<CcipDeliveryStatus>;
268
+ declare function getBridgeSourceStatus(provider: TrackingProvider, input: BridgeSourceStatusRequest): Promise<BridgeSourceStatus>;
269
+ declare function getCcipDeliveryCheckpoint(provider: TrackingProvider, direction: BridgeDirection): Promise<CcipDeliveryCheckpoint>;
270
+ declare function getCcipDeliveryStatus(provider: TrackingProvider, input: CcipDeliveryStatusRequest): Promise<CcipDeliveryStatus>;
266
271
 
267
272
  interface ForeverMoneyClientOptions {
268
273
  readonly transports: {
@@ -306,6 +311,23 @@ interface Eip1193TransactionRequest {
306
311
  readonly gas?: string;
307
312
  }
308
313
  declare function toEip1193Transaction(transaction: PreparedTransaction): Eip1193TransactionRequest;
309
- declare function toEthersTransaction(transaction: PreparedTransaction): Readonly<TransactionRequest>;
314
+ declare function toEthersTransaction(transaction: PreparedTransaction): Readonly<EthersCompatibleTransactionRequest>;
315
+ interface EthersCompatibleTransactionRequest {
316
+ readonly chainId: number;
317
+ readonly to: string;
318
+ readonly data: string;
319
+ readonly value: bigint;
320
+ readonly gasLimit?: bigint;
321
+ }
322
+ interface ViemTransactionRequest {
323
+ readonly chain: Chain;
324
+ readonly account: Address;
325
+ readonly chainId: number;
326
+ readonly to: Address;
327
+ readonly data: Hex;
328
+ readonly value: bigint;
329
+ readonly gas?: bigint;
330
+ }
331
+ declare function toViemTransaction(transaction: PreparedTransaction): Readonly<ViemTransactionRequest>;
310
332
 
311
- export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, 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 EvmToSubtensorRequest, FOREVERMONEY_DEPLOYMENT_VERSION, type ForeverMoneyClient, type ForeverMoneyClientOptions, type ForeverMoneyDeployment, ForeverMoneyError, type ForeverMoneyErrorCode, type ForeverMoneyEvmChain, GAS_LIMIT_BUFFER_BPS, type HttpTransportOptions, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, NETWORK_FEE_BUFFER_BPS, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RpcRequest, type RpcTransport, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, type SubtensorDelivery, type SubtensorSource, type SubtensorToBaseRequest, type SubtensorToEvmRequest, type TransactionAction, type TransactionPlan, type TransactionReceiptLike, type TransactionStep, type TransactionStepKind, type VaultStashToken, type VaultTokenAllowance, type WithdrawVaultRequest, assertWholeRao, bridgeMessageIdFromReceipt, buildBaseToSubtensorPlan, buildClaimVaultFeesPlan, buildCreateVaultPlan, buildDepositVaultPlan, buildEvmToSubtensorPlan, buildSetVaultStakingPlan, buildSubtensorToBasePlan, buildSubtensorToEvmPlan, buildWithdrawVaultPlan, createForeverMoneyClient, destinationChainId, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, sourceChainId, ss58ToPublicKey, toEip1193Transaction, toEthersTransaction, vaultManagerFromCreationReceipt };
333
+ export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, 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 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, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, NETWORK_FEE_BUFFER_BPS, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RpcRequest, type RpcTransport, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, 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, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, sourceChainId, ss58ToPublicKey, toEip1193Transaction, toEthersTransaction, toViemTransaction, vaultManagerFromCreationReceipt };