@xlink-network/xlink-sdk
Version:
44 lines (41 loc) • 2.55 kB
TypeScript
import { BigNumber } from '../utils/BigNumber.js';
import 'big.js';
import '../utils/typeHelpers.js';
type SDKBrandedLiteral<Type extends string, T extends string | number> = `${T} (XLinkSDK ${Type})`;
/**
* Represents a unique identifier for a blockchain network.
*/
type ChainId<T extends string = string> = SDKBrandedLiteral<"ChainId", T>;
/**
* Represents a unique identifier for a cryptocurrency token.
*/
type TokenId<T extends string = string> = SDKBrandedLiteral<"TokenId", T>;
type SDKNumber = SDKBrandedLiteral<"number", string>;
type SDKNumberifyNestly<T> = {
[K in keyof T]: number extends T[K] ? SDKNumber | Exclude<T[K], number> : bigint extends T[K] ? SDKNumber | Exclude<T[K], bigint> : BigNumber extends T[K] ? SDKNumber | Exclude<T[K], BigNumber> : undefined extends T[K] ? undefined | SDKNumberifyNestly<Exclude<T[K], undefined>> : null extends T[K] ? null | SDKNumberifyNestly<Exclude<T[K], null>> : T[K] extends object ? SDKNumberifyNestly<T[K]> : T[K];
};
declare function toSDKNumberOrUndefined<T extends null | undefined | SDKNumber | number | bigint | BigNumber>(n: T): Exclude<T, number | bigint | BigNumber> | SDKNumber;
type EVMAddress = `0x${string}`;
declare const evmNativeCurrencyAddress: unique symbol;
type EVMNativeCurrencyAddress = typeof evmNativeCurrencyAddress;
interface StacksContractAddress {
deployerAddress: string;
contractName: string;
}
declare const isStacksContractAddressEqual: (a: StacksContractAddress, b: StacksContractAddress) => boolean;
/**
* Represents the type of public EVM contracts that are accessible through the SDK.
* The `PublicEVMContractType` is tied to the specific `BridgeEndpoint` contract type defined
* in the `EVMEndpointContract` namespace.
*/
type PublicEVMContractType = typeof PublicEVMContractType.BridgeEndpoint;
/**
* A namespace that defines the public contract types available in the SDK for EVM-compatible blockchains.
* This namespace currently includes only the `BridgeEndpoint` contract type, which corresponds to
* the main contract used for bridging assets across EVM-compatible blockchains.
*/
declare namespace PublicEVMContractType {
/** Represents the bridge endpoint contract type in an EVM-compatible blockchain. */
const BridgeEndpoint = "BridgeEndpoint";
}
export { type ChainId, type EVMAddress, type EVMNativeCurrencyAddress, PublicEVMContractType, type SDKNumber, type SDKNumberifyNestly, type StacksContractAddress, type TokenId, evmNativeCurrencyAddress, isStacksContractAddressEqual, toSDKNumberOrUndefined };