Skip to content

[BTC] Tx crafting#65

Merged
regnarock merged 9 commits into
feat/btc_balancesfrom
btc_tx_crafting
Aug 15, 2024
Merged

[BTC] Tx crafting#65
regnarock merged 9 commits into
feat/btc_balancesfrom
btc_tx_crafting

Conversation

@regnarock
Copy link
Copy Markdown

This pull request adds support for:

Incoming:

  • Support for useMaxAmount field in the API transaction intent.

NB: clone of #60 that got automatically closed by Github.

regnarock and others added 9 commits July 26, 2024 11:07
Additionally:
- improved coinselect types and documentation
- moved validation from zod to BTC service prevalidate as handling of
simple transactions is widely different in BTC
- fixed a potential race condition in transaction encoding
# Conflicts:
#	package.json
#	pnpm-lock.yaml
#	public/openapi.json
#	src/app/api/transaction/broadcast/schema.ts
#	src/app/families/common.ts
#	src/app/model/types_WIP.ts
# Conflicts:
#	src/app/config/chains.ts
#	src/app/families/bitcoin/backend/explorer.ts
#	src/app/families/bitcoin/backend/types.ts
#	src/app/families/bitcoin/service/getAddressesState.ts
#	src/app/model/types_WIP.ts
# Conflicts:
#	src/app/config/chains.ts
#	src/app/families/bitcoin/backend/types.ts
@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
adamik ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 15, 2024 6:47pm

@regnarock regnarock merged commit 571f427 into feat/btc_balances Aug 15, 2024
@regnarock regnarock deleted the btc_tx_crafting branch August 15, 2024 18:51
regnarock added a commit that referenced this pull request Aug 15, 2024
* fully typed xpub parsing supported

* feat: Add unconfirmed balance

* feat:Adds prevalidation and tx broadcast

* fix: zod<->openapi generation issues

* fix: remove useless type guard of multiRecipientTx

* fix: Code style & error handling

* fix: confirmation number for BTC

* [BTC] Tx crafting (#65)

* feat: Adds simple TX crafting

* feat: adds support for useMaxAmount

Additionally:
- improved coinselect types and documentation
- moved validation from zod to BTC service prevalidate as handling of
simple transactions is widely different in BTC
- fixed a potential race condition in transaction encoding

* fix: patch package.lock version
h-adamik added a commit that referenced this pull request Aug 28, 2024
* feat: first iteration on data model & api

* fix(chains.ts): added btc chain early informations

* feat: implement single get address state

* feat: add address validation & get balance

* feat: add route /addresses/state

* fix: try to fix build by specifying openapi

* fix:try string instead of integer

* fix:turn `pipe(coalesce)` into `transform`

* Update OpenAPI JSON docs

* fix: make multi address state endpoint available

* Update OpenAPI JSON docs

* fix: make address vs origin more explicit in doc

* Update OpenAPI JSON docs

* Update src/app/model/types_WIP.ts

Co-authored-by: Hakim <162046728+hakim-adamik@users.noreply.github.com>

* fix: transaction schema naming and missing fields

* fix: chains

* fix(model/service.ts): remove useless method

* fix: replace state origin by account_id

* fix: renamed account_id to accountId

* Update OpenAPI JSON docs

* fix: MultiRecipientTransaction model definition

* fix:add support for single sender in prevalidation

* feat: fill chain parameters

* fix: non working transactionMethodAdaptator

* Update OpenAPI JSON docs

* fix: code style & error handling

* Implementation of GET addresses and xpub states (#54)

* fully typed xpub parsing supported

* feat: Add unconfirmed balance

* feat:Adds prevalidation and tx broadcast

* fix: zod<->openapi generation issues

* fix: remove useless type guard of multiRecipientTx

* fix: Code style & error handling

* fix: confirmation number for BTC

* [BTC] Tx crafting (#65)

* feat: Adds simple TX crafting

* feat: adds support for useMaxAmount

Additionally:
- improved coinselect types and documentation
- moved validation from zod to BTC service prevalidate as handling of
simple transactions is widely different in BTC
- fixed a potential race condition in transaction encoding

* fix: patch package.lock version

* [BTC] Merge TX_TO_MANY feature to normal TX_NATIVE (#66)

* [adv-279] fix broadcast error on nano (#64)

* fix: attempt signature for legacy

* feat: merge TX_TO_MANY feature to normal TX_NATIVE

- LOTS of code style cleans
- remove all wrappers
- use the new tx schema
  - replace usage of `plain` with `data`
  - moved transaction mod per chainId preValidation to zod
  - removed `PlainTransaction` usage in favor of `Transaction['data']`
  - introduce `CompleteTransaction` to differentiate before and after
  calling the method `completeTransaction` in the Family Service
  new signatures:
    - `completeTransaction(Transaction) => CompleteTransaction`
    - `validateTransaction(CompleteTransaction)`
    - `encodeTransactionToSign(completeTransaction)`
    - `encodeTransactionToBroadcast(completeTransaction)`
- change on /addresses/state:
  - aggregated all balances together
  - use model `AccountState` instead of `AddressState`
  - use the fiel `accountId` instead of `address` or `origin`
- removed MultiBalancesService

---------

Co-authored-by: hakim-adamik <hakim@adamik.io>

* revert: plans for pubkey to address

* Update pnpm-lock.yaml

* Minor review fixes

* Last batch of review fixes

* Update OpenAPI JSON docs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hakim <162046728+hakim-adamik@users.noreply.github.com>
Co-authored-by: hakim-adamik <hakim@adamik.io>
h-adamik added a commit that referenced this pull request Mar 24, 2026
* feat: first iteration on data model & api

* fix(chains.ts): added btc chain early informations

* feat: implement single get address state

* feat: add address validation & get balance

* feat: add route /addresses/state

* fix: try to fix build by specifying openapi

* fix:try string instead of integer

* fix:turn `pipe(coalesce)` into `transform`

* Update OpenAPI JSON docs

* fix: make multi address state endpoint available

* Update OpenAPI JSON docs

* fix: make address vs origin more explicit in doc

* Update OpenAPI JSON docs

* Update src/app/model/types_WIP.ts

Co-authored-by: Hakim <162046728+hakim-adamik@users.noreply.github.com>

* fix: transaction schema naming and missing fields

* fix: chains

* fix(model/service.ts): remove useless method

* fix: replace state origin by account_id

* fix: renamed account_id to accountId

* Update OpenAPI JSON docs

* fix: MultiRecipientTransaction model definition

* fix:add support for single sender in prevalidation

* feat: fill chain parameters

* fix: non working transactionMethodAdaptator

* Update OpenAPI JSON docs

* fix: code style & error handling

* Implementation of GET addresses and xpub states (#54)

* fully typed xpub parsing supported

* feat: Add unconfirmed balance

* feat:Adds prevalidation and tx broadcast

* fix: zod<->openapi generation issues

* fix: remove useless type guard of multiRecipientTx

* fix: Code style & error handling

* fix: confirmation number for BTC

* [BTC] Tx crafting (#65)

* feat: Adds simple TX crafting

* feat: adds support for useMaxAmount

Additionally:
- improved coinselect types and documentation
- moved validation from zod to BTC service prevalidate as handling of
simple transactions is widely different in BTC
- fixed a potential race condition in transaction encoding

* fix: patch package.lock version

* [BTC] Merge TX_TO_MANY feature to normal TX_NATIVE (#66)

* [adv-279] fix broadcast error on nano (#64)

* fix: attempt signature for legacy

* feat: merge TX_TO_MANY feature to normal TX_NATIVE

- LOTS of code style cleans
- remove all wrappers
- use the new tx schema
  - replace usage of `plain` with `data`
  - moved transaction mod per chainId preValidation to zod
  - removed `PlainTransaction` usage in favor of `Transaction['data']`
  - introduce `CompleteTransaction` to differentiate before and after
  calling the method `completeTransaction` in the Family Service
  new signatures:
    - `completeTransaction(Transaction) => CompleteTransaction`
    - `validateTransaction(CompleteTransaction)`
    - `encodeTransactionToSign(completeTransaction)`
    - `encodeTransactionToBroadcast(completeTransaction)`
- change on /addresses/state:
  - aggregated all balances together
  - use model `AccountState` instead of `AddressState`
  - use the fiel `accountId` instead of `address` or `origin`
- removed MultiBalancesService

---------

Co-authored-by: hakim-adamik <hakim@adamik.io>

* revert: plans for pubkey to address

* Update pnpm-lock.yaml

* Minor review fixes

* Last batch of review fixes

* Update OpenAPI JSON docs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hakim <162046728+hakim-adamik@users.noreply.github.com>
Co-authored-by: hakim-adamik <hakim@adamik.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant