Skip to content

Commit

Permalink
feat(core): Transfer Domain feature branch (WIP) (#4007)
Browse files Browse the repository at this point in the history
* feat(core): allow evm conversion

* update value and text based on domain

* feature(ui-ux): evm support for address book  (#4008)

* initial commit for address book

* added backward compatibility

* create and edit address update

* added style for portfolio bottom sheet

* fix linting

* lint fix

* added address type selector

* making close icon size to 22 px consistant

* added address type selector in AddressRow component

* seperating instance of addressbook and walletaddresses

* test fix

* chore

* backward compatibility for already saved address

* bug fix

* add search support for evm address

* lint issue fix

* added selectAllLabeledWalletAddress selector to show address label for evm address

* removed unused filters and attributes

* chore

* added evm tag

* chore fix

* chore key error fix

* added e2e tests

* added translation

* chore: fixed pr comments

* translation

* fix(ui-ux): fixed domain switch toggle (#4012)

* fix(ui-ux): fixed domain switch toggle

* added testcse

* updated DFI to DVM

* updated DFI to DVM in enum

* updated dfi to dvm in useWalletAddress

* toggle btn style fix

* test case fix

* feat(core): support transfer domain in convert screen (#4014)

* feat(core): support transfer domain in convert screen

* ensure utxo reserved fee when converting from utxo to dfi

* consistent function init

* explicit function return type

* set state by following data change instead of triggering via event

* consistent naming convention across convert screen and hooks

* fix displayed text for token symbol

* declare hooks before any function

* handle disabled toggle button

* fix displayed text on convert screen

* update toast in text

* fix transfer domain signer

* fix lints

* fix token detail screen navigation to convert

* update unit texts

* update drawer and prompts for dfi converter

* Update more explicit token convert symbols

* suffix with -evm for evm tokens

* fix lint

* fix hardcoded domain

* fix(ui-ux): translations for convert screen (#4028)

* fix(ui-ux): update copy text in convert screen

* fix(ui-ux): update translations

* add translations

* translations

* update de translations

* add missing it translation object

* fix conflict

* chore(ops): bump packages to display changi (#4030)

* chore(ops): bump to add changi network

* chore(ops): bump packages to display changi

* feat(ui-ux): add svg icons for sui and xchf tokens (#4031)

* feat(ui-ux): add svg icons for sui and xchf tokens

* fix invlalid svg props

* update sui svg to a flatter one

* fix rect prop

---------

Co-authored-by: JJ Adonis <[email protected]>

* fix(ui-ux): updated walletkit package to filter out burn token pool pair (#4033)

* fix(ui-ux): updated walletkit package to filter out burn token pool pair

* fix(e2e): network details

* chore(ops): bump walletkit (#4036)

* fix(ui-ux): svg border for evm tokens (#4029)

* fix(ui-ux): svg border for evm tokens

* fix(ui-ux): conditional icon sizing with svg border on evm tokens

* feature(ui-ux): enable transfer domain (#4032)

* fix(ui-ux): filter out LP tokens in EVM domain

* fix(ui-ux): UI labels for address types

* fix(ui-ux): sendconfirmationscreen evm bg for addresses

* fix(ui-ux): hide any address labels if there are error messages

* remove unused comment

* fix lint

* fix(ui-ux): to display address label even with err msg

* fix(ui-ux): labelled address

* fix(ui-ux): cater for selected whitelisted evm addr

* feat(e2e): add tests

* fix: lint for AddressRow

* feat: enable transfer domain

* fix(ui-ux): update UI for convert confirmation screen

* fix(e2e): network details

* Revert "fix(e2e): network details"

This reverts commit c29aef8.

* fix(ui-ux): update isEVMDomain flag

* fix(ui-ux): remove LP filter

* fix(lint): add empty data for evmtx

---------

Co-authored-by: Lyka Labrada <[email protected]>

* fix(ui-ux): fix selection of whitelisted address that redirects to edit address (#4040)

* fix(ui-ux): fix selection of whitelisted address that redirects to edit address

* chore(test): update snapshot

* chore(ui-ux): resolved ui bug for address book screen (#4041)

* fix(ui-ux): copy evm address when evm domain is toggled on (#4043)

* feat(core): add evmtx signer on convert (#4038)

* feat(core): add evmtx signer on convert

* feat(core): fix evmxt 'to' address for dvm to evm transferdomain

* feat(core): update transferdomain implementation for dst20 tokens

* feat(core): update handle transferdomain tokenId for EVM tokens

* update docker

* update evmtx signature

* update check for dfi token

* add function to get dst20 token contract address

* revert unnecessary changes on feautureflagcontext

* update blockchain node to beta14

* feat(core): implement transfer domain with signed evmtx on Send

* add README.md for the contractA abi

* extraxt evmtx signer into a separate function

* add todo

* remove commented line

* set nonce to 0

* feature(ui-ux): address book ui for transfer domain (#4042)

* feature(ui-ux): address book UI for transfer domain

* feature(ui-ux): address book bottom sheet in portfolio page

* update comment

* remove eslint-disable-next-line react-hooks/exhaustive-deps

* feat(ui-ux): standardize evm tag UI across screens

* feat(ui-ux): display address label

* fix(ui-ux): remove caret if not from send screen

* chore: update package

* fix: lint for address row

* fix(ui-ux): fix send nonce and vm address (#4045)

---------

Co-authored-by: Harsh R <[email protected]>
Co-authored-by: Chloe <[email protected]>
Co-authored-by: Lyka Labrada <[email protected]>
Co-authored-by: JJ Adonis <[email protected]>
  • Loading branch information
5 people authored Oct 9, 2023
1 parent 41d1a6a commit 609f5e8
Show file tree
Hide file tree
Showing 88 changed files with 29,851 additions and 2,918 deletions.
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ module.exports = function (api) {
},
],
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-transform-private-methods",
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-private-property-in-object",
"react-native-reanimated/plugin",
];

Expand Down
16 changes: 11 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,22 @@ services:
ports:
- "19553:80"
- "19552:8080"
- "19551:8082"
# - "19551:8082"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"

defi-blockchain:
image: defi/defichain:master-91a01aea0
image: defi/defichain:HEAD-420563c450
ports:
- "19554:19554"
- "19551:19551"
command: >
defid
-printtoconsole
-rpcallowip=0.0.0.0/0
-rpcbind=0.0.0.0
-ethrpcbind=0.0.0.0
-rpcallowcors=http://localhost:8081
-rpcuser=playground
-rpcpassword=playground
-rpcworkqueue=512
Expand Down Expand Up @@ -55,10 +60,11 @@ services:
-grandcentralheight=16
-grandcentralepilogueheight=17
-nextnetworkupgradeheight=18
-changiintermediateheight=19
environment:
- RUST_LOG=debug

defi-playground:
image: ghcr.io/birthdayresearch/playground-api:3.34.0
image: ghcr.io/birthdayresearch/playground-api:4.0.0-rc.1.2
depends_on:
- defi-blockchain
ports:
Expand All @@ -71,7 +77,7 @@ services:
- "traefik.http.routers.playground.entrypoints=web"

defi-whale:
image: ghcr.io/birthdayresearch/whale-api:3.34.0
image: ghcr.io/birthdayresearch/whale-api:4.0.0-rc.1.2
depends_on:
- defi-blockchain
ports:
Expand Down
51 changes: 29 additions & 22 deletions mobile-app/app/api/transaction/dfi_converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import {
CTransactionSegWit,
TransactionSegWit,
} from "@defichain/jellyfish-transaction";

export type ConversionMode = "utxosToAccount" | "accountToUtxos";
import { ConvertDirection } from "@screens/enum";

export async function dfiConversionSigner(
account: WhaleWalletAccount,
amount: BigNumber,
mode: ConversionMode
mode: ConvertDirection,
): Promise<CTransactionSegWit> {
const script = await account.getScript();
const builder = account.withTransactionBuilder();
Expand All @@ -32,7 +31,7 @@ export async function dfiConversionSigner(
},
],
},
script
script,
);
} else {
signed = await builder.account.accountToUtxos(
Expand All @@ -46,55 +45,63 @@ export async function dfiConversionSigner(
],
mintingOutputsStart: 2, // 0: DfTx, 1: change, 2: minted utxos (mandated by jellyfish-tx)
},
script
script,
);
}
return new CTransactionSegWit(signed);
}

export function dfiConversionCrafter(
amount: BigNumber,
mode: ConversionMode,
convertDirection: ConvertDirection,
onBroadcast: () => any,
onConfirmation: () => void,
submitButtonLabel?: string
submitButtonLabel?: string,
): DfTxSigner {
if (
![
ConvertDirection.accountToUtxos,
ConvertDirection.utxosToAccount,
].includes(convertDirection)
) {
throw new Error("Unexpected DFI conversion");
}

const [symbolA, symbolB] =
mode === "utxosToAccount"
? ["UTXO", translate("screens/OceanInterface", "tokens")]
: [translate("screens/OceanInterface", "tokens"), "UTXO"];
convertDirection === ConvertDirection.utxosToAccount
? ["UTXO", translate("screens/OceanInterface", "DFI")]
: [translate("screens/OceanInterface", "DFI"), "UTXO"];
return {
sign: async (account: WhaleWalletAccount) =>
await dfiConversionSigner(account, amount, mode),
await dfiConversionSigner(account, amount, convertDirection),
title: translate(
"screens/ConvertConfirmScreen",
"Convert {{amount}} DFI to {{target}}",
"Convert {{amount}} {{symbolA}} to {{symbolB}} tokens",
{
amount: amount.toFixed(8),
target:
mode === "utxosToAccount"
? translate("screens/ConvertScreen", "tokens")
: "UTXO",
}
symbolA,
symbolB,
},
),
drawerMessages: {
preparing: translate("screens/OceanInterface", "Preparing to convert…"),
waiting: translate(
"screens/OceanInterface",
"Converting {{amount}} DFI {{symbolA}} to {{symbolB}}",
"Converting {{amount}} {{symbolA}} to {{symbolB}} tokens",
{
symbolA: symbolA,
symbolB: symbolB,
amount: amount.toFixed(8),
}
},
),
complete: translate(
"screens/OceanInterface",
"{{amount}} DFI converted to {{symbolB}}",
"{{amount}} {{symbolA}} converted to {{symbolB}} tokens",
{
symbolB: symbolB,
symbolA,
symbolB,
amount: amount.toFixed(8),
}
},
),
},
onBroadcast,
Expand Down
Loading

0 comments on commit 609f5e8

Please sign in to comment.