Skip to content

Incompatible network types for connect and transactions #452

Description

@ECBSJ

This relates to @stacks/connect and @stacks/transactions having different "network" types.

@stacks/connect methods uses NetworkString:
export type NetworkString = LiteralUnion<'mainnet' | 'testnet' | 'regtest' | 'devnet', string>;

@stacks/transactions methods uses StacksNetworkName | StacksNetwork:

export declare const StacksNetworks: readonly ["mainnet", "testnet", "devnet", "mocknet"];
export type StacksNetworkName = (typeof StacksNetworks)[number];

So if building a wallet that is accepting the MethodParams<"getAddresses"> of Connect and passing into a @stacks/transactions method such as privateKeyToAddress, there's going to be a type conflict. See the example below:

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions