stacks-archive / stacks-transactions-js

The JavaScript library for generating Stacks 2.0 transactions
19 stars 17 forks source link

Use network instead of specifying tx version, chain ID and API URLs #64

Closed yknl closed 4 years ago

yknl commented 4 years ago

Use a network object to specify tx version, chain ID and API URLs instead of setting them separately in the options object of transaction builders. Constants for Mainnet and Testnet should be made available to simplify transaction building.

Currently the options looks like

export interface TokenTransferOptions {
  nonce?: BigNum;
  version?: TransactionVersion;
  chainId?: ChainID;
  anchorMode?: AnchorMode;
  memo?: string;
  postConditionMode?: PostConditionMode;
  postConditions?: PostCondition[];
  transferFeeEstimateApiUrl: string;
}

Using networks:

export interface TokenTransferOptions {
  fee?: BigNum;
  nonce?: BigNum;
  network?: StacksNetwork;
  anchorMode?: AnchorMode;
  memo?: string;
  postConditionMode?: PostConditionMode;
  postConditions?: PostCondition[];
}