app-monorepo icon indicating copy to clipboard operation
app-monorepo copied to clipboard

[Feature] Support Stacks Blockchain

Open friedger opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. As a Stx holder, I would like to send and receive stx. Ideally, I would be able to stack/stake my stx.

Describe the solution you'd like The app should show the stx balance and let me receive and send stx.

Support for sip9 tokens would be the next step.

Describe alternatives you've considered Use a different app 😭

Additional context I can help developing, but need some guidance about the process.

friedger avatar Dec 02 '23 11:12 friedger

You can refer to it first. https://github.com/OneKeyHQ/app-monorepo/pull/3146

If there's anything you don't understand, or that method doesn't understand, I'll help you out.

ByteZhang1024 avatar Dec 04 '23 02:12 ByteZhang1024

@ByteZhang1024 What is the different between IEncodedTx and IDecodedTx? They are both structured objects.

friedger avatar Dec 07 '23 16:12 friedger

IEncodedTx It is generally defined in terms of different chains, usually transaction formats. It is primarily an object of direct flow within our internal business. e.g Everyone is familiar with ETH.

export type IEncodedTxEvm = {
  from: string;
  to: string;
  value: string;
  data?: string;
  customData?: string;
  nonce?: number | string;

  gas?: string;
  gasLimit?: string;
  gasPrice?: string;
  maxFeePerGas?: string;
  maxPriorityFeePerGas?: string;
};

IDecodedTx Is a format we define for trading decode, which is used for various ui presentations. Transactions from any other chain can be converted into i decoded tx to display information on different business pages. It can be converted from IEncodedTx e.g https://github.com/OneKeyHQ/app-monorepo/blob/onekey/packages/engine/src/vaults/impl/evm/Vault.ts#L238

ByteZhang1024 avatar Dec 08 '23 06:12 ByteZhang1024

@ByteZhang1024 Thank you for the clarification.

How do you handle testnets? I see that create createClientFromURL does not take a testnet or chainid flag.

friedger avatar Dec 08 '23 10:12 friedger

packages/shared/src/config/presetNetworks.ts Looking at the format here, just add a test chain.

ByteZhang1024 avatar Dec 08 '23 11:12 ByteZhang1024